Figuring out USB devices

usbusb-audio

I have hardware to interact with that uses USB. It is a USB sound card The configuration file requires something like this:

devstr=1-1.3.1:1.0

lsusb looks like this:

Bus 001 Device 004: ID 0d8c:0012 C-Media Electronics, Inc.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I need this device Bus 001 Device 004: ID 0d8c:0012 C-Media Electronics, Inc. to to be referenced in the configuration file.

UPDATE
Here is /var/log/messages (after a reboot)

Nov 17 12:33:52 44249 kernel: [    3.658983] usb 1-1.2: New USB device found, idVendor=0d8c, idProduct=0012
Nov 17 12:33:52 44249 kernel: [    3.671869] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Nov 17 12:33:52 44249 kernel: [    3.685433] usb 1-1.2: Product: USB Audio Device
Nov 17 12:33:52 44249 kernel: [    3.694574] usb 1-1.2: Manufacturer: C-Media Electronics Inc.
Nov 17 12:33:52 44249 kernel: [    3.710586] input: C-Media Electronics Inc. USB Audio Device as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.3/0003:0D8C:0012.0001/input/input0
Nov 17 12:33:52 44249 kernel: [    3.790955] hid-generic 0003:0D8C:0012.0001: input,hidraw0: USB HID v1.00 Device [C-Media Electronics Inc. USB Audio Device] on usb-3f980000.usb-1.2/input3

END UPDATE

UPDATE 2 output of lsusb -vd 0d8c:0012

root@44249:~# lsusb -vd 0d8c:0012

Bus 001 Device 004: ID 0d8c:0012 C-Media Electronics, Inc. 
Device Descriptor:
bLength                18
bDescriptorType         1
bcdUSB               1.10
bDeviceClass            0 (Defined at Interface level)
bDeviceSubClass         0 
bDeviceProtocol         0 
bMaxPacketSize0         8
idVendor           0x0d8c C-Media Electronics, Inc.
idProduct          0x0012 
bcdDevice            1.00
iManufacturer           1 C-Media Electronics Inc.
iProduct                2 USB Audio Device
iSerial                 0 
bNumConfigurations      1
Configuration Descriptor:
bLength                 9
bDescriptorType         2
wTotalLength          253
bNumInterfaces          4
bConfigurationValue     1
iConfiguration          0 
bmAttributes         0x80
  (Bus Powered)
MaxPower              100mA
Interface Descriptor:
  bLength                 9
  bDescriptorType         4
  bInterfaceNumber        0
  bAlternateSetting       0
  bNumEndpoints           0
  bInterfaceClass         1 Audio
  bInterfaceSubClass      1 Control Device
  bInterfaceProtocol      0 
  iInterface              0 
  AudioControl Interface Descriptor:
    bLength                10
    bDescriptorType        36
    bDescriptorSubtype      1 (HEADER)
    bcdADC               1.00
    wTotalLength          100
    bInCollection           2
    baInterfaceNr( 0)       1
    baInterfaceNr( 1)       2
  AudioControl Interface Descriptor:
    bLength                12
    bDescriptorType        36
    bDescriptorSubtype      2 (INPUT_TERMINAL)
    bTerminalID             1
    wTerminalType      0x0101 USB Streaming
    bAssocTerminal          0
    bNrChannels             2
    wChannelConfig     0x0003
      Left Front (L)
      Right Front (R)
    iChannelNames           0 
    iTerminal               0 
  AudioControl Interface Descriptor:
    bLength                12
    bDescriptorType        36
    bDescriptorSubtype      2 (INPUT_TERMINAL)
    bTerminalID             2
    wTerminalType      0x0201 Microphone
    bAssocTerminal          0
    bNrChannels             1
    wChannelConfig     0x0001
      Left Front (L)
    iChannelNames           0 
    iTerminal               0 
  AudioControl Interface Descriptor:
    bLength                 9
    bDescriptorType        36
    bDescriptorSubtype      3 (OUTPUT_TERMINAL)
    bTerminalID             6
    wTerminalType      0x0301 Speaker
    bAssocTerminal          0
    bSourceID               9
    iTerminal               0 
  AudioControl Interface Descriptor:
    bLength                 9
    bDescriptorType        36
    bDescriptorSubtype      3 (OUTPUT_TERMINAL)
    bTerminalID             7
    wTerminalType      0x0101 USB Streaming
    bAssocTerminal          0
    bSourceID               8
    iTerminal               0 
  AudioControl Interface Descriptor:
    bLength                 7
    bDescriptorType        36
    bDescriptorSubtype      5 (SELECTOR_UNIT)
    bUnitID                 8
    bNrInPins               1
    baSource( 0)           10
    iSelector               0 
  AudioControl Interface Descriptor:
    bLength                10
    bDescriptorType        36
    bDescriptorSubtype      6 (FEATURE_UNIT)
    bUnitID                 9
    bSourceID              15
    bControlSize            1
    bmaControls( 0)      0x01
      Mute Control
    bmaControls( 1)      0x02
      Volume Control
    bmaControls( 2)      0x02
      Volume Control
    iFeature                0 
  AudioControl Interface Descriptor:
    bLength                 9
    bDescriptorType        36
    bDescriptorSubtype      6 (FEATURE_UNIT)
    bUnitID                10
    bSourceID               2
    bControlSize            1
    bmaControls( 0)      0x43
      Mute Control
      Volume Control
      Automatic Gain Control
    bmaControls( 1)      0x00
    iFeature                0 
  AudioControl Interface Descriptor:
    bLength                 9
    bDescriptorType        36
    bDescriptorSubtype      6 (FEATURE_UNIT)
    bUnitID                13
    bSourceID               2
    bControlSize            1
    bmaControls( 0)      0x03
      Mute Control
      Volume Control
    bmaControls( 1)      0x00
    iFeature                0 
  AudioControl Interface Descriptor:
    bLength                13
    bDescriptorType        36
    bDescriptorSubtype      4 (MIXER_UNIT)
    bUnitID                15
    bNrInPins               2
    baSourceID( 0)          1
    baSourceID( 1)         13
    bNrChannels             2
    wChannelConfig     0x0003
      Left Front (L)
      Right Front (R)
    iChannelNames           0 
    bmControls         0x00
    iMixer                  0 
Interface Descriptor:
  bLength                 9
  bDescriptorType         4
  bInterfaceNumber        1
  bAlternateSetting       0
  bNumEndpoints           0
  bInterfaceClass         1 Audio
  bInterfaceSubClass      2 Streaming
  bInterfaceProtocol      0 
  iInterface              0 
Interface Descriptor:
  bLength                 9
  bDescriptorType         4
  bInterfaceNumber        1
  bAlternateSetting       1
  bNumEndpoints           1
  bInterfaceClass         1 Audio
  bInterfaceSubClass      2 Streaming
  bInterfaceProtocol      0 
  iInterface              0 
  AudioStreaming Interface Descriptor:
    bLength                 7
    bDescriptorType        36
    bDescriptorSubtype      1 (AS_GENERAL)
    bTerminalLink           1
    bDelay                  1 frames
    wFormatTag              1 PCM
  AudioStreaming Interface Descriptor:
    bLength                14
    bDescriptorType        36
    bDescriptorSubtype      2 (FORMAT_TYPE)
    bFormatType             1 (FORMAT_TYPE_I)
    bNrChannels             2
    bSubframeSize           2
    bBitResolution         16
    bSamFreqType            2 Discrete
    tSamFreq[ 0]        48000
    tSamFreq[ 1]        44100
  Endpoint Descriptor:
    bLength                 9
    bDescriptorType         5
    bEndpointAddress     0x01  EP 1 OUT
    bmAttributes            9
      Transfer Type            Isochronous
      Synch Type               Adaptive
      Usage Type               Data
    wMaxPacketSize     0x00c8  1x 200 bytes
    bInterval               1
    bRefresh                0
    bSynchAddress           0
    AudioControl Endpoint Descriptor:
      bLength                 7
      bDescriptorType        37
      bDescriptorSubtype      1 (EP_GENERAL)
      bmAttributes         0x01
        Sampling Frequency
      bLockDelayUnits         1 Milliseconds
      wLockDelay              1 Milliseconds
Interface Descriptor:
  bLength                 9
  bDescriptorType         4
  bInterfaceNumber        2
  bAlternateSetting       0
  bNumEndpoints           0
  bInterfaceClass         1 Audio
  bInterfaceSubClass      2 Streaming
  bInterfaceProtocol      0 
  iInterface              0 
Interface Descriptor:
  bLength                 9
  bDescriptorType         4

Bus 001 Device 004: ID 0d8c:0012 C-Media Electronics, Inc.
Device Descriptor:
bLength                18
bDescriptorType         1
bcdUSB               1.10
bDeviceClass            0 (Defined at Interface level)
bDeviceSubClass         0
bDeviceProtocol         0
bMaxPacketSize0         8
idVendor           0x0d8c C-Media Electronics, Inc.
idProduct          0x0012
bcdDevice            1.00
iManufacturer           1 C-Media Electronics Inc.
iProduct                2 USB Audio Device
iSerial                 0
bNumConfigurations      1
Configuration Descriptor:
bLength                 9
bDescriptorType         2
wTotalLength          253
bNumInterfaces          4
bConfigurationValue     1
iConfiguration          0
bmAttributes         0x80
  (Bus Powered)
MaxPower              100mA
Interface Descriptor:
  bLength                 9
  bDescriptorType         4
  bInterfaceNumber        0
  bAlternateSetting       0
  bNumEndpoints           0
  bInterfaceClass         1 Audio
  bInterfaceSubClass      1 Control Device
  bInterfaceProtocol      0
  iInterface              0
  AudioControl Interface Descriptor:
    bLength                10
    bDescriptorType        36
    bDescriptorSubtype      1 (HEADER)
    bcdADC               1.00
    wTotalLength          100
    bInCollection           2
    baInterfaceNr( 0)       1
    baInterfaceNr( 1)       2
  AudioControl Interface Descriptor:
    bLength                12
    bDescriptorType        36
    bDescriptorSubtype      2 (INPUT_TERMINAL)
    bTerminalID             1
    wTerminalType      0x0101 USB Streaming
    bAssocTerminal          0
    bNrChannels             2
    wChannelConfig     0x0003
      Left Front (L)
      Right Front (R)
    iChannelNames           0
    iTerminal               0
  AudioControl Interface Descriptor:
    bLength                12
    bDescriptorType        36
    bDescriptorSubtype      2 (INPUT_TERMINAL)
    bTerminalID             2
    wTerminalType      0x0201 Microphone
    bAssocTerminal          0
    bNrChannels             1
    wChannelConfig     0x0001
      Left Front (L)
    iChannelNames           0
    iTerminal               0
  AudioControl Interface Descriptor:
    bLength                 9
    bDescriptorType        36
    bDescriptorSubtype      3 (OUTPUT_TERMINAL)
    bTerminalID             6
    wTerminalType      0x0301 Speaker
    bAssocTerminal          0
    bSourceID               9

END UPDATE

Any pointers?

Thank you

Danny

Best Answer

1) USB audio devices are handled by the ALSA kernel drivers, and those react automatically to the vendor:product identifier of the USB device (or the generic interface). None of the drivers you'd normally use would use a devstr. You don't say why you need this string, but you are probably doing it wrong.

2) The example contents of your devstr are the USB path as shown in /sys/bus/usb/devices. It's impossible to derive it from your information, but you can derive it from lsusb -t if you can't find the device directly.

3) Please edit question with output of dmesg that appears after you plugin the device.

4) Very likely you are missing the correct ALSA drivers. If you haven't, update your kernel to the newest version.

Edit

What should happen is that the module snd-usb-audio is loaded based on the class of the USB device. What instead happens according your dmesg is that the device is recognized as a Human Interface Device, which is odd, unless it has buttons or similar that it represents in this way in addition to the sound function.

Please edit question with output of lsusb -vd 0d8c:0012, so we can see if it has a descriptor with an audio class. Also, verify that your kernel includes the module snd-usb-audio, and modinfo snd-usb-audio includes these two

alias:          usb:v*p*d*dc*dsc*dp*ic01isc01ip*in*
alias:          usb:v*p*d*dc*dsc*dp*ic01isc03ip*in*

lines.

Edit

Assuming the duplicate lines at the end of your output are a copy&paste error: This looks like a standard USB soundcard, and should be automatically handled by snd-usb-audio. I just double checked with my USB soundcard, it looks like this driver doesn't produce messages on successful initialization. Please edit question with output of cat /proc/asound/cards/ to see if it was picked up.

If it wasn't, the only guess I have is that you somehow messed up your module dependencies, though I don't know what you did, and you didnt' say (but "(I have an unnamed software where) the configuration while requires ..." sounds somewhat ominous). If that should be the case, you can try a manual modprobe snd-usb-audio; you can try to fix it with depmod, or you can re-install (or upgrade, while you are at it) your kernel.

If that doesn't help, I'm out of ideas.

Related Question