You are not logged in.
Hi.
I have another newbie question!
This time my problem is about sound.
Every time I plug in my USB sound card, alsamixer forgets its previous volume and sets it to 0.
I tried "alsactl -f /var/lib/alsa/asound.state store" as said in the wiki for storing the settings, even tried to delete the file before doing so.
I even tried simply "alsactl store" or something like that.
No matter how many times I set it to 100, alsa just forgets it. In pavucontrol I see the volume meter showing that the sound is okay (I guess I mean the sound stream?), but I have to start alsamixer every time I want to use my USB sound card. And because it's a notebook, I usually plug/unplug it like 5 times a day, so keeping it plugged in is not an option.
Just because of curiosity I tried it on a Fedora 15 live and it was working like a charm so I know there is a solution, I just can't find it.
What should I do?
Thanks in advance!
Last edited by fema (2011-06-20 13:06:55)
Offline
What I would do is: Add a udev rule containing e.g.:
RUN+="/root/alsa-usb.sh"
And in /root/alsa-usb.sh, run your amixer commands to set up the soundcard volume.
Offline
Thanks. I made a file "usbsound.rules" in /etc/udev/rules.d/, but I think I miss something like when this rule should run. I don't want to be rude, but I honestly don't have time to read the whole manual on http://www.reactivated.net/writing_udev_rules.html (link from Arch Wiki), so if you would be so kind to tell me what else I have to do, I'd appreciate it.
In the .rules file I have:
RUN+="/root/alsa-usb.sh"
In that sh file I have:
amixer -c 1 sset Speaker 100
Do I have to write a coditional or something else into the rule file?
Offline
Some hints:
Insert your USB card, then run this, to hopefully show it as the last entry:
ls -ltr /dev
# Immediate debugging:
# udevadm control --log-priority=debug (from "man udev")
You could take a look at Fedora's udev rules, on its livecd.
Edit: Changed incorrect trying-to-be-too-clever ls command
Last edited by brebs (2011-06-18 18:49:18)
Offline
Sorry, but I failed.
First, I tried "ls -ltr /dev/$(find /dev -type f)", output:
[martin@faye ~]$ ls -ltr /dev/$(find /dev -type f)
ls: cannot access /dev//dev/shm/pulse-shm-1778335859: No such file or directory
-r-------- 1 martin users 67108904 Jun 18 21:10 /dev/shm/pulse-shm-1367368951
-r-------- 1 martin users 67108904 Jun 18 21:11 /dev/shm/pulse-shm-1888875678
-r-------- 1 martin users 67108904 Jun 18 21:11 /dev/shm/pulse-shm-4171981922
-r-------- 1 martin users 67108904 Jun 18 21:11 /dev/shm/pulse-shm-926606275
-r-------- 1 martin users 67108904 Jun 18 21:11 /dev/shm/pulse-shm-84854996
-r-------- 1 martin users 67108904 Jun 18 21:44 /dev/shm/pulse-shm-2211428343
The first line seems to be wrong, so the command modified to this: "ls -ltr $(find /dev -type f)", output changed to this:
[martin@faye ~]$ ls -ltr $(find /dev -type f)
-r-------- 1 martin users 67108904 Jun 18 21:10 /dev/shm/pulse-shm-1367368951
-r-------- 1 martin users 67108904 Jun 18 21:11 /dev/shm/pulse-shm-1888875678
-r-------- 1 martin users 67108904 Jun 18 21:11 /dev/shm/pulse-shm-4171981922
-r-------- 1 martin users 67108904 Jun 18 21:11 /dev/shm/pulse-shm-926606275
-r-------- 1 martin users 67108904 Jun 18 21:11 /dev/shm/pulse-shm-84854996
-r-------- 1 martin users 67108904 Jun 18 21:26 /dev/shm/pulse-shm-1778335859
-r-------- 1 martin users 67108904 Jun 18 21:44 /dev/shm/pulse-shm-2211428343
To be honest, I don't even know what I should see here... :S
Typing "udevadm control --log-priority=debug" haven't told me anything, so I don't know if it was okay or not.
Afterwards I started Fedora live, went to the udev rules, the only suspicious file was "90-alsa-tools-firmware.rules", but it was about loading some firmware for some specific sound cards.
After reading that, I tried this rule:
SUBSYSTEM=="usb", RUN+="/root/alsa-usb.sh"
- It was a failure.
After searching in the above mentioned link and the Arch udev Wiki I tried this:
KERNEL=="sd*", SUBSYSTEM=="usb", RUN+="/root/alsa-usb.sh"
- Failure as well. Kernel "sd*" because I don't know what else.
Then I google'd some more and the closest I could find was the following:
KERNEL=="audio1", SUBSYSTEM=="sound", RUN+="/root/alsa-usb.sh"
- Failure.
At this point I don't know what to do. (Strange, eh?)
I guess my udev rule is incorrect in 2 points: kernel and subsystem. How could I check those? I tried lspci, because I've heard about it somewhere, but I don't think it is useful for me.
Offline
Oops, I was trying to be too clever with that "find" bit in the ls command.
You really need to do the reading, before messing with udev. "sd*" are your hard disks etc.
Offline
After reading the manual and Writing udev rules page, my last attempt was: SUBSYSTEM=="sound", RUN+="/home/martin/alsa-usb.sh".
It should run the .sh file whenever a device with the "sound" subsystem is plugged in. According to the data I got from udevadm info export, my sound card (controlC1) is in the sound subsystem and I got many other things beside that, none working. I used "udevadm control --reload-rules" after each try. In the end I restarted my pc. No success. Theoretically (AFAIK), it should work. In fact, it doesn't.
Any idea?
Offline
I don't know if anyone still reads it, but I found the following in a Fedora document and it says the following: "PA will save and restore the volume of each device possibly overwriting what ALSA itself saves and restores." (PA refers to PulseAudio)
After reading this I think what I need is not a udev rule, but I missed to set something in PulseAudio. And again, I don't know where to look for the solution.
Does anybody know how to set this thing?
Thanks again.
EDIT: I reinstalled Arch and now it workes. If I had to guess, I'd say it was because I used ALSA before I installed Pulse, but am not sure.
Thanks for your help, brebs.
Last edited by fema (2011-06-20 13:06:21)
Offline