Re: Naming two identical USB devices (need help)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!
I thought about your problem again and I think I made a small progress!I was able to set the cards number to any number I want using a udevrule, so I could use that card with plughw:n,0 where n was the number ofmy choise. I didn't use a udev rule that makes a lot of sense, but I'msure that there is a possibility to create a rule that depends on theusb port your usb sound card is plugged in. Here is what I did:
I looked at the devices that where created before I did anything:
ingo@ingo-desktop:~$ls -l /dev/snd/insgesamt 0crw-rw---- 1 root audio 116, 11 2007-02-10 18:26 controlC0crw-rw---- 1 root audio 116,  3 2007-02-10 18:26 hwC0D0crw-rw---- 1 root audio 116, 13 2007-02-10 18:26 hwC0D2crw-rw---- 1 root audio 116,  4 2007-02-10 18:26 midiC0D0crw-rw---- 1 root audio 116, 14 2007-02-10 18:26 midiC0D1crw-rw---- 1 root audio 116, 15 2007-02-10 18:26 midiC0D2crw-rw---- 1 root audio 116, 10 2007-02-10 18:26 pcmC0D0ccrw-rw---- 1 root audio 116,  9 2007-02-10 18:26 pcmC0D0pcrw-rw---- 1 root audio 116,  8 2007-02-10 18:26 pcmC0D1ccrw-rw---- 1 root audio 116,  7 2007-02-10 18:26 pcmC0D2ccrw-rw---- 1 root audio 116,  6 2007-02-10 18:26 pcmC0D2pcrw-rw---- 1 root audio 116,  5 2007-02-10 18:26 pcmC0D3pcrw-rw---- 1 root audio 116, 12 2007-02-10 18:26 seqcrw-rw---- 1 root audio 116,  2 2007-02-10 18:26 timer
The I looked at the udev rules, that created these devices (in/etc/udev/rules.d/20-names.rules):
# Sound devices, group under /dev/sndKERNEL=="controlC[0-9]*",		NAME="snd/%k"KERNEL=="hwC[D0-9]*",			NAME="snd/%k"KERNEL=="midiC[D0-9]*",			NAME="snd/%k"KERNEL=="pcmC[D0-9cp]*",		NAME="snd/%k"KERNEL=="seq",				NAME="snd/%k"KERNEL=="timer",			NAME="snd/%k"
These rules only "move" the sound devices to the snd/ directory. Inorder to change the name of the created devices, I created a rule forevery device that has been created before, using its name from the firstls command, and changed the card number (still moving it to snd/), hereit is number 3.
KERNEL=="controlC0",		NAME="snd/controlC3"KERNEL=="hwC0D0",		NAME="snd/hwC3D0"KERNEL=="hwC0D2",		NAME="snd/hwC3D2"KERNEL=="midiC0D0",		NAME="snd/midiC3D0"KERNEL=="midiC0D1",		NAME="snd/midiC3D1"KERNEL=="midiC0D2",		NAME="snd/midiC3D2"KERNEL=="pcmC0D0c",		NAME="snd/pcmC3D0c"KERNEL=="pcmC0D0p",		NAME="snd/pcmC3D0p"KERNEL=="pcmC0D1c",		NAME="snd/pcmC3D1c"KERNEL=="pcmC0D2c",		NAME="snd/pcmC3D2c"KERNEL=="pcmC0D2p",		NAME="snd/pcmC3D2p"KERNEL=="pcmC0D3p",		NAME="snd/pcmC3D3p"
The result: My card was not card 0 anymore ("Karte 0"), but card 3("Karte 3") and I was able to use it with plughw:3,0.
ingo@ingo-desktop:~$aplay -l**** Liste von PLAYBACK Geräten ****Karte 3: Live [SBLive! Platinum [CT4760P]], Gerät 0: emu10k1 [ADCCapture/Standard PCM Playback]  Untergeordnete Geräte: 32/32  Untergeordnetes Gerät '0: subdevice #0  Untergeordnetes Gerät '1: subdevice #1  Untergeordnetes Gerät '2: subdevice #2  Untergeordnetes Gerät '3: subdevice #3...
That means that there is a way to influence the number of the card withudev! Now, everything you have to do is find a udev rule that matches acertain usb port. As you can run external programs with udev, there mustbe a way to do that.
I'm going to play with udev now, too, so if I find something, I'll tellyou. In return, it would be awesome if you could write down - even it isonly short - a howto about how to manage two identical devices, once wegot it working.
Regards, Ingo


Jean-Michel Pouré schrieb:> Hello,> > My need is very basic.> > I am using two Terratec Aureon USB MK2 devices.> But this could be any case where two devices are the same.> > My question is:> > Is there a way to make sure that each physical device always has the> same name: plughw:0,0 (first identical card) and plughw:1,0 (second> identical card). This would allow me to plug the cards and forget the> plugs. > > Presently, numbers change on every reboot or if I hotplug devices.> > I read on the wiki that it was possible to load modules in a precise> order. But it seems to be working in case of several ***different***> devices, not several identical devices:> http://alsa.opensrc.org/MultipleCards> > Any idea? Is there a way to use Udev?> > If it is not possible in the current state of Alsa, I will send back one> device to the retailer, in which case I need your kind advice quickly.> > Kind regards,> Jean-Michel Pouré

-------------------------------------------------------------------------Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier.Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642_______________________________________________Alsa-devel mailing listAlsa-devel@xxxxxxxxxxxxxxxxxxxxxxxxxx://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux