Skip to contentSkip to conversation

S51 usb support

DISCUSSION Matti Picus 2 participants 6 messages Oct 3, 2010 – Oct 5, 2010

lore
Share & tools
lore
#0 lore raw

My X-FI Surround USB card is barely usable. pulseaudio will let me control the volume levels, alsa support cannot view any volume controls.

How can I contribute to better support for this card under alsa? I would like to get to the point where amixer can control the analog input/output volume levels.

I am a capable programmer, but know very little about alsa, where should I start?
Matti

#1 lore raw
Quoted 2 lines · Matti Picus

My X-FI Surround USB card is barely usable. pulseaudio will let me control the volume levels, alsa support cannot view any volume controls.

But audio streaming does work for you? I heard people reporting success with this kind of hardware.

Quoted 3 lines

How can I contribute to better support for this card under alsa? I would like to get to the point where amixer can control the analog input/output volume levels.

As for the volume controls, there are merely two ways how they can be implemented on USB soundcards. One is as feature unit control, and the other is a proprietary vendor specific USB request. You should start having a look at the USB descriptors the devices exports (by running "lsusb -v").

In case the card does not offer a standard way to control the volume levels, you need to trace how the Windows driver does it by sniffing the communication while performing this specific operation, either with an USB hardware analyzer, or with a piece of software. There are some projects aiming for this, but I can't give you any recommendation. Just try some of these, maybe:

http://www.google.com/search?q=windows+usb+traffic+sniffer

Once you found out how they do it in Windows, you can add device specific mixer handlers, as they exist for other hardware. Have a look at sound/usb/mixer_quirks.c.

Hope that helps,

Daniel

#2 lore raw
Quoted 8 lines · Daniel Mack
Quoted 3 lines · Matti Picus

My X-FI Surround USB card is barely usable. pulseaudio will let me control the volume levels, alsa support cannot view any volume controls.

But audio streaming does work for you? I heard people reporting success with this kind of hardware.

Yes, audio streaming works in aplay if I choose the hw:S51 device. I cannot find a convenient way to control the volume without firing up pavucontrol, "convenient" in this case means "for mpd run as root"

Quoted 11 lines
Quoted 4 lines

How can I contribute to better support for this card under alsa? I would like to get to the point where amixer can control the analog input/output volume levels.

As for the volume controls, there are merely two ways how they can be implemented on USB soundcards. One is as feature unit control, and the other is a proprietary vendor specific USB request. You should start having a look at the USB descriptors the devices exports (by running "lsusb -v").

OK, what should I be looking for? Here is a summary:

Quoted 1 line

lsusb -v -s 002:006 |grep '\(\<i[^I]\)\|\(bDescriptorSubtype\)\|\(PCM\)'

idVendor 0x041e Creative Technology, Ltd
idProduct 0x3042

   iManufacturer           1 Creative Technology
   iProduct                2 SB X-Fi Surround 5.1
   iSerial                 3 000008NV

iConfiguration 0
bDescriptorSubtype 1 (HEADER)
bDescriptorSubtype 2 (INPUT_TERMINAL)
iChannelNames 0
iTerminal 0
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
iTerminal 0
bDescriptorSubtype 2 (INPUT_TERMINAL)
iChannelNames 0
iTerminal 0
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
iTerminal 0
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
iTerminal 0
bDescriptorSubtype 1 (AS_GENERAL)
wFormatTag 1 PCM
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)
bDescriptorSubtype 1 (AS_GENERAL)
wFormatTag 1 PCM
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)
bDescriptorSubtype 1 (AS_GENERAL)
wFormatTag 1 PCM
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)
bDescriptorSubtype 1 (AS_GENERAL)
wFormatTag 1 PCM
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)
bDescriptorSubtype 1 (AS_GENERAL)
wFormatTag 1 PCM
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)
bDescriptorSubtype 1 (AS_GENERAL)
wFormatTag 1 PCM
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)
bDescriptorSubtype 1 (AS_GENERAL)
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)
bDescriptorSubtype 1 (AS_GENERAL)
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)
bDescriptorSubtype 1 (AS_GENERAL)
wFormatTag 1 PCM
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)
bDescriptorSubtype 1 (AS_GENERAL)
wFormatTag 1 PCM
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)
bDescriptorSubtype 1 (AS_GENERAL)
wFormatTag 1 PCM
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)
bDescriptorSubtype 1 (AS_GENERAL)
wFormatTag 1 PCM
bDescriptorSubtype 2 (FORMAT_TYPE)
bDescriptorSubtype 1 (EP_GENERAL)

Quoted 9 lines

In case the card does not offer a standard way to control the volume levels, you need to trace how the Windows driver does it by sniffing the communication while performing this specific operation, either with an USB hardware analyzer, or with a piece of software. There are some projects aiming for this, but I can't give you any recommendation. Just try some of these, maybe:

http://www.google.com/search?q=windows+usb+traffic+sniffer

Quoted 9 lines

Once you found out how they do it in Windows, you can add device specific mixer handlers, as they exist for other hardware. Have a look at sound/usb/mixer_quirks.c.

Hope that helps,

Daniel

The card must offer something close to a standard set of volume controls since pulseaudio can control the basic stereo volume sliders. I would be happy if amixer or even alsamixer would see just the analog stereo output and analog line-in input. Currently, pulseaudio can control the volume levels but alsa cannot, alsamixer simply shows no volume controls.

Any guidance you can give toward getting the volume controls recognized would be greatly appreciate.
Matti

#3 lore raw
Quoted 8 lines · Matti Picus
Quoted 6 lines · Daniel Mack

As for the volume controls, there are merely two ways how they can be implemented on USB soundcards. One is as feature unit control, and the other is a proprietary vendor specific USB request. You should start having a look at the USB descriptors the devices exports (by running "lsusb -v").

OK, what should I be looking for? Here is a summary:

Normally, the volume would be controlled by a feature unit. Just post the whole output of 'lsusb -v' to some pastebin website and post the link.

Quoted 3 lines

The card must offer something close to a standard set of volume controls since pulseaudio can control the basic stereo volume sliders.

No. PulseAudio will do the volume control in software if there are no hardware controls.

Quoted 4 lines

I would be happy if amixer or even alsamixer would see just the analog stereo output and analog line-in input. Currently, pulseaudio can control the volume levels but alsa cannot, alsamixer simply shows no volume controls.

Yes, because the driver doesn't know about any volume controls. If you manage to implement them, PA will also use them.

Quoted 2 lines

Any guidance you can give toward getting the volume controls recognized would be greatly appreciate.

The best way is to sniff the USB communication when Windows sets the volume, and add controls to the Linux driver and make it do the same thing.

Daniel

#4 lore raw
Quoted 6 lines · Daniel Mack

Normally, the volume would be controlled by a feature unit. Just post the whole output of 'lsusb -v' to some pastebin website and post the link.

http://pastebin.com/e8ZcX9TN

Quoted 8 lines
Quoted 5 lines

Any guidance you can give toward getting the volume controls recognized would be greatly appreciate.

The best way is to sniff the USB communication when Windows sets the volume

Is there an example in the alsa source tree of some of this? Matti

#5 lore raw
Quoted 7 lines · Matti Picus
Quoted 5 lines · Daniel Mack

Normally, the volume would be controlled by a feature unit. Just post the whole output of 'lsusb -v' to some pastebin website and post the link.

http://pastebin.com/e8ZcX9TN

Hmm, there is no feature unit in this dump, so the volume is most probably set with an vendor-specific USB request. Unless the Windows driver does something similar than PulseAudio and handles the volume level control in software (iow, modify each sample before sending it to the hardware) rather than setting any actual hardware volume level.

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Any guidance you can give toward getting the volume controls recognized would be greatly appreciate.

The best way is to sniff the USB communication when Windows sets the volume

Is there an example in the alsa source tree of some of this?

Of a sniff dump you mean? I doubt so, but once you manage to get one with any of the software tools around or with a hardware analyzer, the dump itself shouldn't be hard to understand. You just need to understand the packet layout and where they store the actual volume information.

Once you got this information, feel free to share it, so we can figure out a nice way of generating the same kind of messages from inside the kernel driver.

Daniel