FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 05-11-2011, 01:24 PM
"owl700@gmail.com"
 
Default How to join forever an alsa device id to a particular USB port?

Hello, I bought 2 identic USB audio device that work correctly with
linux but when I restart linux or I keep the devices out and I put it
in again they take another id. I need that the id would be always the
same.


I tried a first script called "A working example":
http://alsa.opensrc.org/Udev but squeeze doesn't rename it...
Then I tried other kind of tries that I paste below (please don't
laugh about me I am not good with udev)



# KERNEL=="2-2", SUBSYSTEM=="usb", ACTION=="add", DRIVER=="usb", SYMLINK="test"
# KERNEL=="controlC[0-9]*", SUBSYSTEM=="usb", ACTION=="add",
SYMLINK="snd/controlC9"
# KERNEL=="2-2:1.0", SUBSYSTEM=="usb", ACTION=="add", DRIVER=="usb",
SYMLINK="snd/controlC9"
# KERNEL=="2-2:1.1", SUBSYSTEM=="usb", ACTION=="add", DRIVER=="usb",
SYMLINK="snd/pcmC9D0c"
# KERNEL=="2-2:1.2", SUBSYSTEM=="usb", ACTION=="add", DRIVER=="usb",
SYMLINK="snd/pcmC9D0p"
# KERNEL=="2-2:1.0", SUBSYSTEM=="usb", ACTION=="add", DRIVER=="usb",
SYMLINK="snd/controlC9"

KERNEL=="controlC0", ACTION=="add" DRIVERS=="snd", NAME="snd/controlC9"

As you can see it doesn't work...the only thing I could do was to
create a symling but that's not important to me, i couldn't rename the
devices that's what I need


What I precisely need is to join one or more particular USB gates to
the same device d alsa. I will decide which one doing it in
/proc/asound/devices


----


udevadm info --query all --path /sys/bus/usb/devices/2-2 --attribute-walk

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

looking at device '/devices/pci0000:00/0000:00:10.0/usb2/2-2':
KERNEL=="2-2"
SUBSYSTEM=="usb"
DRIVER=="usb"
ATTR{configuration}==""
ATTR{bNumInterfaces}==" 4"
ATTR{bConfigurationValue}=="1"
ATTR{bmAttributes}=="80"
ATTR{bMaxPower}=="100mA"
ATTR{urbnum}=="63"
ATTR{idVendor}=="08bb"
ATTR{idProduct}=="2902"
ATTR{bcdDevice}=="0100"
ATTR{bDeviceClass}=="00"
ATTR{bDeviceSubClass}=="00"
ATTR{bDeviceProtocol}=="00"
ATTR{bNumConfigurations}=="1"
ATTR{bMaxPacketSize0}=="8"
ATTR{speed}=="12"
ATTR{busnum}=="2"
ATTR{devnum}=="2"
ATTR{version}==" 1.10"
ATTR{maxchild}=="0"
ATTR{quirks}=="0x0"
ATTR{authorized}=="1"
ATTR{manufacturer}=="Burr-Brown from TI "
ATTR{product}=="USB Audio CODEC "

looking at parent device '/devices/pci0000:00/0000:00:10.0/usb2':
KERNELS=="usb2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{configuration}==""
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bMaxPower}==" 0mA"
ATTRS{urbnum}=="36"
ATTRS{idVendor}=="1d6b"
ATTRS{idProduct}=="0001"
ATTRS{bcdDevice}=="0206"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bNumConfigurations}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{speed}=="12"
ATTRS{busnum}=="2"
ATTRS{devnum}=="1"
ATTRS{version}==" 1.10"
ATTRS{maxchild}=="2"
ATTRS{quirks}=="0x0"
ATTRS{authorized}=="1"
ATTRS{manufacturer}=="Linux 2.6.32-5-686 uhci_hcd"
ATTRS{product}=="UHCI Host Controller"
ATTRS{serial}=="0000:00:10.0"
ATTRS{authorized_default}=="1"

looking at parent device '/devices/pci0000:00/0000:00:10.0':
KERNELS=="0000:00:10.0"
SUBSYSTEMS=="pci"
DRIVERS=="uhci_hcd"
ATTRS{vendor}=="0x1106"
ATTRS{device}=="0x3038"
ATTRS{subsystem_vendor}=="0x1043"
ATTRS{subsystem_device}=="0x3038"
ATTRS{class}=="0x0c0300"
ATTRS{irq}=="21"
ATTRS{local_cpus}=="ffffffff"
ATTRS{local_cpulist}=="0-31"
ATTRS{modalias}=="pci:v00001106d00003038sv00001043 sd00003038bc0Csc03i00"
ATTRS{enable}=="1"
ATTRS{broken_parity_status}=="0"
ATTRS{msi_bus}==""

looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""

----

/proc/asound# ls
card0 card1 card2 cards default default_1 devices hwdep modules oss
pcm seq timers V8237 version

----

/dev/snd# ls
by-id by-path controlC0 controlC1 controlC2 pcmC0D0c pcmC0D0p
pcmC0D1c pcmC0D1p pcmC1D0c pcmC1D0p pcmC2D0c pcmC2D0p seq timer

----

dmesg

[ 1.520541] usb usb4: New USB device found, idVendor=1d6b, idProduct=0001
[ 1.520545] usb usb4: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[ 1.520549] usb usb4: Product: UHCI Host Controller
[ 1.520552] usb usb4: Manufacturer: Linux 2.6.32-5-686 uhci_hcd
[ 1.520555] usb usb4: SerialNumber: 0000:00:10.2
[ 1.520909] usb usb4: configuration #1 chosen from 1 choice
[ 1.521101] hub 4-0:1.0: USB hub found
[ 1.521126] hub 4-0:1.0: 2 ports detected

[ 4285.848016] usb 2-1: new full speed USB device using uhci_hcd and address
3
[ 4286.169823] usb 2-1: New USB device found, idVendor=08bb, idProduct=2902
[ 4286.169830] usb 2-1: New USB device strings: Mfr=1, Product=2,
SerialNumber=0
[ 4286.169834] usb 2-1: Product: USB Audio CODEC
[ 4286.169837] usb 2-1: Manufacturer: Burr-Brown from TI
[ 4286.170060] usb 2-1: configuration #1 chosen from 1 choice
[ 4286.225195] input: Burr-Brown from TI USB Audio CODEC as
/devices/pci0000:00/0000:00:10.0/usb2/2-1/2-1:1.3/input/input5
[ 4286.225961] generic-usb 0003:08BB:2902.0002: input,hidraw1: USB HID v1.00
Device [Burr-Brown from TI USB Audio CODEC ] on
usb-0000:00:10.0-1/input3

----

Every help will be important to me thanks.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: BANLkTi=HKTi=Zb509hrUzoTBSU_d8-KOug@mail.gmail.com">http://lists.debian.org/BANLkTi=HKTi=Zb509hrUzoTBSU_d8-KOug@mail.gmail.com
 
Old 05-11-2011, 01:38 PM
Jimmy Johnson
 
Default How to join forever an alsa device id to a particular USB port?

owl700@gmail.com wrote:

Hello, I bought 2 identic USB audio device that work correctly with
linux but when I restart linux or I keep the devices out and I put it
in again they take another id. I need that the id would be always the
same.



Every help will be important to me thanks.



If you run 'blkid' in the console as root and can get a UUID from the
device then you can add it to fstab and it will always be mounted with
the name/ID you give it. Do this with all USB device and all will have
a static name.

--
Jimmy Johnson

Debian Sid - AMD64 - EXT4 - KDE 4.5.3 at sda14
Registered Linux User #380263


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4DCA916B.2070005@gmail.com">http://lists.debian.org/4DCA916B.2070005@gmail.com
 
Old 05-11-2011, 02:36 PM
"owl700@gmail.com"
 
Default How to join forever an alsa device id to a particular USB port?

Hi Jimmy, are you sure an USB audio device has an UUID?

2011/5/11 Jimmy Johnson <field.engineer@gmail.com>:
> owl700@gmail.com wrote:
>>
>> Hello, I bought 2 identic USB audio device that work correctly with
>> linux but when I restart linux or I keep the devices out and I put it
>> in again they take another id. I need that the id would be always the
>> same.
>
>> Every help will be important to me thanks.
>
>
> If you run 'blkid' in the console as root and can get a UUID from the device
> then you can add it to fstab and it will always be mounted with the name/ID
> you give it. *Do this with all USB device and all will have a static name.
> --
> Jimmy Johnson
>
> Debian Sid - AMD64 - EXT4 - KDE 4.5.3 at sda14
> Registered Linux User #380263
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject
> of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: http://lists.debian.org/4DCA916B.2070005@gmail.com
>
>


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: BANLkTimen03uLM2xO7vPtw6SkeMzn4Ef1A@mail.gmail.com ">http://lists.debian.org/BANLkTimen03uLM2xO7vPtw6SkeMzn4Ef1A@mail.gmail.com
 
Old 05-11-2011, 07:37 PM
Jimmy Johnson
 
Default How to join forever an alsa device id to a particular USB port?

owl700@gmail.com wrote:

Hi Jimmy, are you sure an USB audio device has an UUID?



No, but if I have your device I can find out in less time than it takes
me to make this post. ;-)

--
Jimmy Johnson

Debian Sid - AMD64 - EXT4 - KDE 4.5.3 at sda14
Registered Linux User #380263


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4DCAE565.4040503@gmail.com">http://lists.debian.org/4DCAE565.4040503@gmail.com
 
Old 05-12-2011, 01:38 AM
Ron Johnson
 
Default How to join forever an alsa device id to a particular USB port?

On 05/11/2011 08:38 AM, Jimmy Johnson wrote:

owl700@gmail.com wrote:

Hello, I bought 2 identic USB audio device that work correctly with
linux but when I restart linux or I keep the devices out and I put it
in again they take another id. I need that the id would be always the
same.



Every help will be important to me thanks.



If you run 'blkid' in the console as root and can get a UUID from the
device then you can add it to fstab and it will always be mounted with
the name/ID you give it. Do this with all USB device and all will have a
static name.


I'm gonna bet that audio "stuff" are char not block devices.

--
"Neither the wisest constitution nor the wisest laws will secure
the liberty and happiness of a people whose manners are universally
corrupt."
Samuel Adams, essay in The Public Advertiser, 1749


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4DCB3A01.1030607@cox.net">http://lists.debian.org/4DCB3A01.1030607@cox.net
 
Old 05-12-2011, 02:02 AM
 
Default How to join forever an alsa device id to a particular USB port?

On Wed, 11 May 2011 15:24:51 +0200
"owl700@gmail.com" <owl700@gmail.com> wrote:

> Hello, I bought 2 identic USB audio device that work correctly with
> linux but when I restart linux or I keep the devices out and I put it
> in again they take another id. I need that the id would be always the
> same.
>
>
> I tried a first script called "A working example":
> http://alsa.opensrc.org/Udev but squeeze doesn't rename it...
> Then I tried other kind of tries that I paste below (please don't
> laugh about me I am not good with udev)
>
>
>
> # KERNEL=="2-2", SUBSYSTEM=="usb", ACTION=="add", DRIVER=="usb", SYMLINK="test"
> # KERNEL=="controlC[0-9]*", SUBSYSTEM=="usb", ACTION=="add",
> SYMLINK="snd/controlC9"
> # KERNEL=="2-2:1.0", SUBSYSTEM=="usb", ACTION=="add", DRIVER=="usb",
> SYMLINK="snd/controlC9"
> # KERNEL=="2-2:1.1", SUBSYSTEM=="usb", ACTION=="add", DRIVER=="usb",
> SYMLINK="snd/pcmC9D0c"
> # KERNEL=="2-2:1.2", SUBSYSTEM=="usb", ACTION=="add", DRIVER=="usb",
> SYMLINK="snd/pcmC9D0p"
> # KERNEL=="2-2:1.0", SUBSYSTEM=="usb", ACTION=="add", DRIVER=="usb",
> SYMLINK="snd/controlC9"
>
> KERNEL=="controlC0", ACTION=="add" DRIVERS=="snd", NAME="snd/controlC9"
>
> As you can see it doesn't work...the only thing I could do was to
> create a symling but that's not important to me, i couldn't rename the
> devices that's what I need
>
>
> What I precisely need is to join one or more particular USB gates to
> the same device d alsa. I will decide which one doing it in
> /proc/asound/devices
>
>
> ----
>
>
> udevadm info --query all --path /sys/bus/usb/devices/2-2 --attribute-walk
>
> Udevadm info starts with the device specified by the devpath and then
> walks up the chain of parent devices. It prints for every device
> found, all possible attributes in the udev rules key format.
> A rule to match, can be composed by the attributes of the device
> and the attributes from one single parent device.
>
> looking at device '/devices/pci0000:00/0000:00:10.0/usb2/2-2':
> KERNEL=="2-2"
> SUBSYSTEM=="usb"
> DRIVER=="usb"
> ATTR{configuration}==""
> ATTR{bNumInterfaces}==" 4"
> ATTR{bConfigurationValue}=="1"
> ATTR{bmAttributes}=="80"
> ATTR{bMaxPower}=="100mA"
> ATTR{urbnum}=="63"
> ATTR{idVendor}=="08bb"
> ATTR{idProduct}=="2902"
> ATTR{bcdDevice}=="0100"
> ATTR{bDeviceClass}=="00"
> ATTR{bDeviceSubClass}=="00"
> ATTR{bDeviceProtocol}=="00"
> ATTR{bNumConfigurations}=="1"
> ATTR{bMaxPacketSize0}=="8"
> ATTR{speed}=="12"
> ATTR{busnum}=="2"
> ATTR{devnum}=="2"
> ATTR{version}==" 1.10"
> ATTR{maxchild}=="0"
> ATTR{quirks}=="0x0"
> ATTR{authorized}=="1"
> ATTR{manufacturer}=="Burr-Brown from TI "
> ATTR{product}=="USB Audio CODEC "
>
> looking at parent device '/devices/pci0000:00/0000:00:10.0/usb2':
> KERNELS=="usb2"
> SUBSYSTEMS=="usb"
> DRIVERS=="usb"
> ATTRS{configuration}==""
> ATTRS{bNumInterfaces}==" 1"
> ATTRS{bConfigurationValue}=="1"
> ATTRS{bmAttributes}=="e0"
> ATTRS{bMaxPower}==" 0mA"
> ATTRS{urbnum}=="36"
> ATTRS{idVendor}=="1d6b"
> ATTRS{idProduct}=="0001"
> ATTRS{bcdDevice}=="0206"
> ATTRS{bDeviceClass}=="09"
> ATTRS{bDeviceSubClass}=="00"
> ATTRS{bDeviceProtocol}=="00"
> ATTRS{bNumConfigurations}=="1"
> ATTRS{bMaxPacketSize0}=="64"
> ATTRS{speed}=="12"
> ATTRS{busnum}=="2"
> ATTRS{devnum}=="1"
> ATTRS{version}==" 1.10"
> ATTRS{maxchild}=="2"
> ATTRS{quirks}=="0x0"
> ATTRS{authorized}=="1"
> ATTRS{manufacturer}=="Linux 2.6.32-5-686 uhci_hcd"
> ATTRS{product}=="UHCI Host Controller"
> ATTRS{serial}=="0000:00:10.0"
> ATTRS{authorized_default}=="1"
>
> looking at parent device '/devices/pci0000:00/0000:00:10.0':
> KERNELS=="0000:00:10.0"
> SUBSYSTEMS=="pci"
> DRIVERS=="uhci_hcd"
> ATTRS{vendor}=="0x1106"
> ATTRS{device}=="0x3038"
> ATTRS{subsystem_vendor}=="0x1043"
> ATTRS{subsystem_device}=="0x3038"
> ATTRS{class}=="0x0c0300"
> ATTRS{irq}=="21"
> ATTRS{local_cpus}=="ffffffff"
> ATTRS{local_cpulist}=="0-31"
> ATTRS{modalias}=="pci:v00001106d00003038sv00001043 sd00003038bc0Csc03i00"
> ATTRS{enable}=="1"
> ATTRS{broken_parity_status}=="0"
> ATTRS{msi_bus}==""
>
> looking at parent device '/devices/pci0000:00':
> KERNELS=="pci0000:00"
> SUBSYSTEMS==""
> DRIVERS==""
>
> ----
>
> /proc/asound# ls
> card0 card1 card2 cards default default_1 devices hwdep modules oss
> pcm seq timers V8237 version
>
> ----
>
> /dev/snd# ls
> by-id by-path controlC0 controlC1 controlC2 pcmC0D0c pcmC0D0p
> pcmC0D1c pcmC0D1p pcmC1D0c pcmC1D0p pcmC2D0c pcmC2D0p seq timer
>
> ----
>
> dmesg
>
> [ 1.520541] usb usb4: New USB device found, idVendor=1d6b, idProduct=0001
> [ 1.520545] usb usb4: New USB device strings: Mfr=3, Product=2,
> SerialNumber=1
> [ 1.520549] usb usb4: Product: UHCI Host Controller
> [ 1.520552] usb usb4: Manufacturer: Linux 2.6.32-5-686 uhci_hcd
> [ 1.520555] usb usb4: SerialNumber: 0000:00:10.2
> [ 1.520909] usb usb4: configuration #1 chosen from 1 choice
> [ 1.521101] hub 4-0:1.0: USB hub found
> [ 1.521126] hub 4-0:1.0: 2 ports detected
>
> [ 4285.848016] usb 2-1: new full speed USB device using uhci_hcd and address
> 3
> [ 4286.169823] usb 2-1: New USB device found, idVendor=08bb, idProduct=2902
> [ 4286.169830] usb 2-1: New USB device strings: Mfr=1, Product=2,
> SerialNumber=0
> [ 4286.169834] usb 2-1: Product: USB Audio CODEC
> [ 4286.169837] usb 2-1: Manufacturer: Burr-Brown from TI
> [ 4286.170060] usb 2-1: configuration #1 chosen from 1 choice
> [ 4286.225195] input: Burr-Brown from TI USB Audio CODEC as
> /devices/pci0000:00/0000:00:10.0/usb2/2-1/2-1:1.3/input/input5
> [ 4286.225961] generic-usb 0003:08BB:2902.0002: input,hidraw1: USB HID v1.00
> Device [Burr-Brown from TI USB Audio CODEC ] on
> usb-0000:00:10.0-1/input3
>
> ----
>
> Every help will be important to me thanks.
>
>

What you need to do is add manufacturer, configuration, serial # etc... to your lookup, e.g.

# Epson Perfection 2450 aka GT-9700

KERNEL=="sg[0-9]*", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", ATTRS{model}
=="GT-9700", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"
10-local.rules

I have a file in /etc/udev/rules.d/10-local.rules where I put all of that local stuff.

the real trick is how to figure out what those fields are:

udevadm info --name=$1 --attribute-walk

you might need to sudo the above command or execute as root.

HTH.

Brian


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110511190234.0f9cc200@windy.deldotd.com">http://lists.debian.org/20110511190234.0f9cc200@windy.deldotd.com
 

Thread Tools




All times are GMT. The time now is 07:30 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org