You are not logged in.

#1 2020-10-14 14:56:43

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 449

alsa-card-profile overwrites existing configurations

I have a laptop which needs a modification in /usr/share/alsa-card-profile/mixer/paths/analog-output.conf.common to have its 4-speakers system working correctly. An ASUS ZenBook UX431DA.
So far so good, but with the package alsa-card-profile, which replaced another one that used to be where all the .common file were not long ago, now every time it updates, all the files in that path get overwritten:

ll /usr/share/alsa-card-profile/mixer/paths/

.rw-r--r-- 1,4k root 13 d’oct. 14:10 analog-input-aux.conf
.rw-r--r-- 2,2k root 13 d’oct. 14:10 analog-input-dock-mic.conf
.rw-r--r-- 1,4k root 13 d’oct. 14:10 analog-input-fm.conf
.rw-r--r-- 2,2k root 13 d’oct. 14:10 analog-input-front-mic.conf
.rw-r--r-- 2,3k root 13 d’oct. 14:10 analog-input-headphone-mic.conf
.rw-r--r-- 2,4k root 13 d’oct. 14:10 analog-input-headset-mic.conf
.rw-r--r-- 2,8k root 13 d’oct. 14:10 analog-input-internal-mic-always.conf
.rw-r--r-- 3,2k root 13 d’oct. 14:10 analog-input-internal-mic.conf
.rw-r--r-- 2,6k root 13 d’oct. 14:10 analog-input-linein.conf
.rw-r--r-- 1,5k root 13 d’oct. 14:10 analog-input-mic-line.conf
.rw-r--r-- 2,8k root 13 d’oct. 14:10 analog-input-mic.conf
.rw-r--r-- 1,3k root 13 d’oct. 14:10 analog-input-mic.conf.common
.rw-r--r-- 2,2k root 13 d’oct. 14:10 analog-input-rear-mic.conf
.rw-r--r-- 1,4k root 13 d’oct. 14:10 analog-input-tvtuner.conf
.rw-r--r-- 1,4k root 13 d’oct. 14:10 analog-input-video.conf
.rw-r--r-- 2,1k root 13 d’oct. 14:10 analog-input.conf
.rw-r--r-- 5,8k root 13 d’oct. 14:10 analog-input.conf.common
.rw-r--r-- 2,1k root 13 d’oct. 14:10 analog-output-headphones-2.conf
.rw-r--r-- 3,2k root 13 d’oct. 14:10 analog-output-headphones.conf
.rw-r--r-- 4,0k root 13 d’oct. 14:10 analog-output-lineout.conf
.rw-r--r-- 2,0k root 13 d’oct. 14:10 analog-output-mono.conf
.rw-r--r-- 3,7k root 13 d’oct. 14:10 analog-output-speaker-always.conf
.rw-r--r-- 4,6k root 13 d’oct. 14:10 analog-output-speaker.conf
.rw-r--r-- 1,9k root 13 d’oct. 14:10 analog-output.conf
.rw-r--r--  11k root 14 d’oct. 16:36 analog-output.conf.common
.rw-r--r--  193 root 13 d’oct. 14:10 hdmi-output-0.conf
.rw-r--r--  195 root 13 d’oct. 14:10 hdmi-output-1.conf
.rw-r--r--  195 root 13 d’oct. 14:10 hdmi-output-2.conf
.rw-r--r--  195 root 13 d’oct. 14:10 hdmi-output-3.conf
.rw-r--r--  195 root 13 d’oct. 14:10 hdmi-output-4.conf
.rw-r--r--  195 root 13 d’oct. 14:10 hdmi-output-5.conf
.rw-r--r--  195 root 13 d’oct. 14:10 hdmi-output-6.conf
.rw-r--r--  195 root 13 d’oct. 14:10 hdmi-output-7.conf
.rw-r--r--  789 root 13 d’oct. 14:10 iec958-stereo-input.conf
.rw-r--r--  712 root 13 d’oct. 14:10 iec958-stereo-output.conf
.rw-r--r-- 1,1k root 13 d’oct. 14:10 steelseries-arctis-output-chat-common.conf
.rw-r--r-- 1,1k root 13 d’oct. 14:10 steelseries-arctis-output-game-common.conf
.rw-r--r-- 1,3k root 13 d’oct. 14:10 usb-gaming-headset-input.conf
.rw-r--r-- 1,3k root 13 d’oct. 14:10 usb-gaming-headset-output-mono.conf
.rw-r--r-- 1,4k root 13 d’oct. 14:10 usb-gaming-headset-output-stereo.conf

In particular, I need to modify for each update the analog-output.conf.common adding before the [Element PCM] block the following:

[Element Master]
switch = mute
volume = 100

I can chattr +i but that would only show errors when updating with pacman and could introduce more errors in the future.

How can I manage this?

Offline

#2 2020-10-14 15:03:40

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,645

Re: alsa-card-profile overwrites existing configurations

Create a new file with your modification and then add a udev rule corresponding to your device that loads this additional configuration, look at the existing rules in /usr/lib/udev/rules.d/90-pulseaudio.rules for inspiration/explanation of how you can apply your custom profile for your particular device.

Offline

#3 2021-03-05 23:56:36

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 449

Re: alsa-card-profile overwrites existing configurations

V1del wrote:

Create a new file with your modification and then add a udev rule corresponding to your device that loads this additional configuration, look at the existing rules in /usr/lib/udev/rules.d/90-pulseaudio.rules for inspiration/explanation of how you can apply your custom profile for your particular device.

I know it's been a while, but I am missing one part of the puzzle: how would the new file look like? Because at the moment I am modifying the /usr/share/alsa-card-profile/mixer/paths/analog-output.conf.common and I'd be adding a file not ending with .common.
I see in, for example, /usr/share/alsa-card-profile/mixer/paths/analog-output.conf (not the .common) there is

[General]
priority = 99 

which invites to think that I need to put my modification with more priority than anything else. But I have no clue how it works.

I would appreciate some help!

Offline

#4 2021-03-06 00:36:47

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,645

Re: alsa-card-profile overwrites existing configurations

Copy the entire file (or .include it and only have your adjustment in your new file), add your modification. The priority here is for the priority of the outputs (e.g. analog ports have a general priority of 99 SPDIF have a lower priority has they are not often the default) which is for pulse to determine which port it should select if the user hasn't yet made an explicit choice.

It has no relation to how prioritized the file is. Everything uses analog-output.conf unless redirected to a different file via udev rule.

E.g.

[Element Master]
switch = mute
volume = 100

.include analog-output.conf.common

Last edited by V1del (2021-03-06 00:40:28)

Offline

Board footer

Powered by FluxBB