How to set group of video and audio devices automatically

Derek Tattersall tatters at newsguy.com
Thu May 21 05:11:42 UTC 2009


Derek Tattersall wrote:
> Mikkel L. Ellertson wrote:
>> Derek Tattersall wrote:
>>  

 think I have the multiple sound cards more or less sorted out.

To sum up what I did, In order to get the 2 sound cards working for 
different users, I had to modify 4 different configuration files on my 
machine. They were:

/etc/security/console.perms.d/50-default.perms
/etc/udev/rules.d/90-alsa.rules
/etc/modprobe.d/modprobe.conf.dist,
$HOME/.asoundrc

>>> I found that adding this to
>>> /etc/security/console.perms.d/50-default.perms works:
>>>
>>> <video>=/dev/video*
>>> <audio>=/dev/snd/* /dev/mixer* /dev/dsp*
>>>
>>> <console>  0660 <video>      0660 root.pulse
>>> <console>  0660 <audio>      0660 root.pulse
>>>
>>> Then add any users who might want to use those devices to the pulse 
>>> group
>>>
>>> Unfortunately  this only applies to devices that are plugged in on boot
>>> up. Are devices that are plugged in after boot up handled by udev?
>>>
It tuns out that if I write my udev rules correctly (no typos) it does 
work the way I want it to.

udev rules:

# Webcam
SYSFS{idVendor}=="046d", SYSFS{idProduct}=="0990", MODE="660", GROUP="pulse"
# Usb audio card
SYSFS{idVendor}=="0c45", SYSFS{idProduct}=="1677", MODE="660", GROUP="pulse"

modules.conf entries:

# On board audio card
alias snd-card-0 snd-hda-intel
# HDTV tuner card
alias snd-card-1 cx88_alsa
# USB Audio card
alias snd-card-2 snd-usb-audio
# Webcam microphone
alias snd-card-3 snd-usb-audio

options snd-hda-intel index=0
options cx88_alsa index=1
options snd-usb-audio index=2,3 vid=0x0c45,0x46d pid=0x1677,0x990
###########

My local .asoundrc file. This sets up the default card for the console 
user. The mythtv user will set the Intel card to be default.

pcm.Intel { type hw; card Intel; }
ctl.Intel { type hw; card Intel; }
pcm.CX8801 { type hw; card CX8801; }
ctl.CX8801 { type hw; card CX8801; }
pcm.Audio { type hw; card Audio; }
ctl.Audio { type hw; card Audio; }
pcm.U0x46d0x990 { type hw; card U0x46d0x990; }
ctl.U0x46d0x990 { type hw; card U0x46d0x990; }
pcm.!default pcm.Audio
ctl.!default ctl.Audio

So after I modified /etc/security/console.perms.d/50-default.perms , 
/etc/udev/rules.d/90-alsa.rules, /etc/modprobe.d/modprobe.conf.dist, and 
my local .asoundrc it all just works.


>>>     
>> Have you tried it? I have not looked lately, but I know that udev
>> used to call console.perms when a device was hotplugged, so it could
>> set permissions if necessary.
>>
>> Mikkel
>>   
> Yes I did try it. When the device was plugged into the USB port on 
> boot up, the permissions were set as I wanted them to be.
>
> When the device (A USB audio card) was plugged in after boot up, the 
> permissions were not set properly.
>
> I may have to mess with the udev rules further. Maybe if I write some 
> kind of post-install script that manually sets the permissions.
>
> Derek Tattersall
>




More information about the fedora-list mailing list