Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UAC2: lsusb -v only show first string descriptor when there are several ones #144

Open
nodens opened this issue Mar 31, 2022 · 6 comments
Open

Comments

@nodens
Copy link

nodens commented Mar 31, 2022

Hi,

trying to implement an alsa UCM2 profile for my USB audio interface (Arturia Minifuse 2), I noticed that when using lsusb -v, I can only see the first channel description in iChannelNames attribute from a cluster.

e.g:

    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol     32 
      iInterface              4 MiniFuse 2 
      AudioStreaming Interface Descriptor:
        bLength                16
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           2
        bmControls           0x00
        bFormatType             1
        bmFormats          0x00000001
          PCM
        bNrChannels             4
        bmChannelConfig    0x00000000
        iChannelNames          13 Output Left

Dumping the usb data under windows, I see all the iChannelNames, there is one per channel (so 4 here). In this case, it should show
Output Left, Output Right, Loopback Left, Loopback Right or something similar.

I suppose the issue is only the first string descriptor (array[0]) is shown, where it should iterate on bNrChannels to get array[1-3] descriptors as well.

Sadly, I'm not fluent enough in C to see where in the code it could be fixed ;)

Thanks!

@nodens
Copy link
Author

nodens commented Mar 31, 2022

digging into it a bit, it seems channel names for UAC are hardcoded in desc-defs.c ?

@gregkh
Copy link
Owner

gregkh commented May 18, 2022

iChannelNames is just an index to the string descriptor for that channel. bNrChannels is the "number of logical channels in this cluster" it is not a list of different channels and their names that I can determine.

See 3.7.2.3 Audio Channel Cluster Format in the USB Audio specification for more details about this (it can be found on the usb.org site), but I think lsusb is writing these out correctly.

I have a USB device here with 8 bNrChannels and it shows this as:

        bLength                17
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID            10
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bCSourceID              4
        bNrChannels             8
        bmChannelConfig    0x000000ff
          Front Left (FL)
          Front Right (FR)
          Front Center (FC)
          Low Frequency Effects (LFE)
          Back Left (BL)
          Back Right (BR)
          Front Left of Center (FLC)
          Front Right of Center (FRC)
          iChannelNames           0

but it does not have a string descriptor here. You should only have one per channel configuration like this. It's showing up for you as Output Left which is correct, right?

What version of lsusb are you using that doesn't show all the names?

@nodens
Copy link
Author

nodens commented May 23, 2022

Hi!

I use usbutils / lsusb 014 (from Debian unstable).

The problem is I see only one descriptor per output (first), instead of all the strings per channel, which would be useful to handle alsa configuration (use-case manager, etc).
So here I see Output Left, which is one channel, but I'd like to know the 3 other channels are Output Right, Loopback Left, Loopback Right.

I see no way to get this info with lsusb currently.

To get all the channel descriptors, I had to run a windows VM and dump the data there:
Win10_DescriptorDump_MiniFuse_2.txt
.
complete lsusb -v for the same device (as root): lsusb_minifuse2.txt

Note: This windows dump shows the index of descriptor. With another tool (usblyzer, but it was a trial version and I can't export it anymore now), I saw it neatly organized per AudioControl descriptor.

@nodens
Copy link
Author

nodens commented Jun 5, 2022

Dumping the usb data under windows

Are you using USB Device Tree Viewer, which is actually on par with usbutils on windows?

Well, now I am, thanks for the hint!
Here is the dump.
Win10_usbdtreeviewDump_Minifuse_2.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@gregkh @nodens and others