You are not logged in.
It seems that udev rules to trigger alsactl restore when a sound device is connected are bugged. The soundcard state is not restored correctly.
I manage work around it by removing the device number parameter to alsactl restore in the rules file.
From this
phas@Hyperion /u/l/u/rules.d> cat 90-alsa-restore.rules
ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST=="/usr/bin", TEST=="/usr/share/alsa", GOTO="alsa_restore_go"
GOTO="alsa_restore_end"
LABEL="alsa_restore_go"
TEST!="/etc/alsa/state-daemon.conf", RUN+="/usr/bin/alsactl restore $attr{device/number}"
TEST=="/etc/alsa/state-daemon.conf", RUN+="/usr/bin/alsactl nrestore $attr{device/number}"
LABEL="alsa_restore_end"
to this
phas@Hyperion /u/l/u/rules.d> cat 90-alsa-restore.rules
ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", TEST=="/usr/bin", TEST=="/usr/share/alsa", GOTO="alsa_restore_go"
GOTO="alsa_restore_end"
LABEL="alsa_restore_go"
TEST!="/etc/alsa/state-daemon.conf", RUN+="/usr/bin/alsactl restore"
TEST=="/etc/alsa/state-daemon.conf", RUN+="/usr/bin/alsactl nrestore"
LABEL="alsa_restore_end"
This works, yes, but it means that if I connect a usb audio card after I did modify other audio settings of other audio cards, the modifications will be reset. Which is not really acceptable me thinks.
Offline
Well yes, if you remove the device number restore will restore every single device. What you can do is to try and properly fix this by identifying which attribute should be mentioned there instead if device/number is incorrect.
But is it really? what do you get for
udevadm monitor
when connecting a card? What are you using to actually check the before and after state?
Offline
What you can do is to try and properly fix this by identifying which attribute should be mentioned there instead if device/number is incorrect.
If I can, gladly.
But is it really?
Dunno, but if it were, it would work I guess.
What can I tell you is that I'm having this issue both with a xonar USB card and the HDMI audio of an Intel NUC
(which apparently gets initialized later in the boot process and not restored by the systemd serve despite not being
an external device).
I've a bunch of USB audio cards and mixers in my warehouse if further testing is needed.
But now is holiday time here.
what do you get for
udevadm monitor
when connecting a card?
KERNEL[391.381284] add /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb)
KERNEL[391.387822] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb)
KERNEL[391.464924] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2 (sound)
KERNEL[391.464987] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2/pcmC2D0p (sound)
KERNEL[391.465024] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2/pcmC2D0c (sound)
KERNEL[391.465059] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2/pcmC2D1p (sound)
KERNEL[391.465137] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2/pcmC2D2p (sound)
KERNEL[391.465172] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2/controlC2 (sound)
KERNEL[391.465239] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb)
KERNEL[391.465849] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.1 (usb)
KERNEL[391.465904] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.1 (usb)
KERNEL[391.466773] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.2 (usb)
KERNEL[391.466841] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.2 (usb)
KERNEL[391.467492] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.3 (usb)
KERNEL[391.467562] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.3 (usb)
KERNEL[391.467612] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4 (usb)
KERNEL[391.469075] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4/0003:0B05:17F5.0006 (hid)
KERNEL[391.469229] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4/0003:0B05:17F5.0006/input/input19 (input)
KERNEL[391.525791] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4/0003:0B05:17F5.0006/input/input19/event12 (input)
KERNEL[391.525854] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4/0003:0B05:17F5.0006/hidraw/hidraw0 (hidraw)
KERNEL[391.525912] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4/0003:0B05:17F5.0006 (hid)
KERNEL[391.525968] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4 (usb)
KERNEL[391.526032] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb)
UDEV [391.546144] add /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb)
UDEV [391.551886] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb)
UDEV [391.552867] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.1 (usb)
UDEV [391.554218] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.2 (usb)
UDEV [391.555753] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4 (usb)
UDEV [391.558440] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.3 (usb)
UDEV [391.560536] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.2 (usb)
UDEV [391.560576] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2 (sound)
UDEV [391.560934] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.1 (usb)
UDEV [391.561642] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.3 (usb)
UDEV [391.562070] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4/0003:0B05:17F5.0006 (hid)
KERNEL[391.564335] change /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2 (sound)
UDEV [391.567916] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2/pcmC2D2p (sound)
UDEV [391.568538] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4/0003:0B05:17F5.0006/hidraw/hidraw0 (hidraw)
UDEV [391.569414] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4/0003:0B05:17F5.0006/input/input19 (input)
UDEV [391.570626] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2/pcmC2D0c (sound)
UDEV [391.571271] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2/pcmC2D1p (sound)
UDEV [391.571883] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2/pcmC2D0p (sound)
UDEV [391.587256] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2/controlC2 (sound)
UDEV [391.591340] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb)
UDEV [391.613337] add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4/0003:0B05:17F5.0006/input/input19/event12 (input)
UDEV [391.617509] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4/0003:0B05:17F5.0006 (hid)
UDEV [391.623498] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.4 (usb)
UDEV [391.631120] bind /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb)
UDEV [391.636424] change /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2 (sound)
This is a xonar usb card.
What are you using to actually check the before and after state?
alsamixer
Alsa, i mean also, my two cents: the alsactl man page says that alsactl can take the dev as a parameter.
Offline
AH, this is odd.
udevadm info --name=/dev/snd/by-id/usb-ASUSTeK_ASUS_XONAR_U5-00 --attribute-walk
[...[
looking at device '/devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2/controlC2':
KERNEL=="controlC2"
SUBSYSTEM=="sound"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/sound/card2':
KERNELS=="card2"
SUBSYSTEMS=="sound"
DRIVERS==""
ATTRS{id}=="U5"
ATTRS{number}=="2"
[...]
And
sudo alsactl restore 2
just works. so it should be ok. Can it be because the attribute is on the parent device?
Last edited by riccardocagnasso (2019-08-17 13:31:19)
Offline