Skip to contentSkip to conversation

lsusb: Add initial support for USB Audio Class 3

PATCH Superseded Michael Drake 1 participant 1 message Dec 8, 2017 USB

lore
Share & tools
lore
#0 lore raw

v2 cover lsusb: Add initial support for USB Audio Class 3

Quoted 26 lines · Greg KH
Quoted 17 lines · Michael Drake
Quoted 16 lines · Greg KH
Quoted 15 lines · Michael Drake
Quoted 6 lines · Greg KH
Quoted 5 lines · Greg KH

Oops, I should have tested the code, it now crashes for me with the following error:
Floating point exception (core dumped)

Do you see this as well?

No, I don't see that.

Quoted 2 lines

And it's crashing on my USB audio device. Here's the output of it from the "old" lsusb output.

[snip]

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Does it still crash with the warning fixes I posted? If so I'll look in detail tomorrow.

I will check when I get home tonight, I don't have the USB device on me at the moment.

Thank you. I believe I've guessed the problem and sent a patch.

Quoted 8 lines

Ok, that now works.

But there is a difference in the "old" and "new" outputs, here's a diff of a full -v output of my laptop and a bunch of USB devices plugged in, showing the fields that now look different.

The big one is the change from "streaming" to "control", is that correct?

Replied inline below.

lsusb-v.new line 1113

Quoted 13 lines

thanks,

greg k-h

lsusb-v.new renamed from lsusb-v.orig +1 -1
@@ -1110,9 +1110,9 @@
          bDescriptorType        36
          bDescriptorSubtype      1 (HEADER)
          bcdADC               1.00
-        wTotalLength       0x0028
+        wTotalLength           40

I was a bit confused by this diff at first, because the "-" lines are my version and the "+" lines are the old version.

Anyway, this is expected. For NUMBER type fields, my code uses the heuristic that 1 byte fields are shown as decimal and >1 byte is shown as full hexadecimal, with leading zeros shown. This is consistent with the way the old lsusb behaved in most cases, although it was slightly inconsistent about it, and this is an example of that inconsistency.

Anyway, since it's a 2 byte field the hex representation is expected here, and the actual value is the same.

lsusb-v.new line 1115

Quoted 3 lines
lsusb-v.new renamed from lsusb-v.orig +1 -1
          bInCollection           1
-        baInterfaceNr(0)        1
+        baInterfaceNr( 0)       1

Just a whitespace change. My version's not using a fixed width for the array index, and only uses what's needed for the largest index to be represented.

Quoted 4 lines
lsusb-v.new renamed from lsusb-v.orig +0 -0
        AudioControl Interface Descriptor:
          bLength                12
          bDescriptorType        36

lsusb-v.new line 1148

Quoted 10 lines
lsusb-v.new renamed from lsusb-v.orig +3 -3
@@ -1142,10 +1142,10 @@
          bUnitID                13
          bSourceID               1
          bControlSize            1
-        bmaControls(0)       0x01
+        bmaControls( 0)      0x01
            Mute Control
-        bmaControls(1)       0x00
-        bmaControls(2)       0x00
+        bmaControls( 1)      0x00
+        bmaControls( 2)      0x00

Ditto for these.

lsusb-v.new line 1176

Quoted 9 lines
lsusb-v.new renamed from lsusb-v.orig +1 -1
          iFeature                0
      Interface Descriptor:
        bLength                 9
@@ -1173,7 +1173,7 @@
          bDescriptorSubtype      1 (AS_GENERAL)
          bTerminalLink           1
          bDelay                  1 frames
-        wFormatTag         0x0001 PCM
+        wFormatTag              1 PCM

This is the >1 byte shown as hexadecimal thing.

lsusb-v.new line 1202

Quoted 9 lines
lsusb-v.new renamed from lsusb-v.orig +1 -1
        AudioStreaming Interface Descriptor:
          bLength                20
          bDescriptorType        36
@@ -1199,14 +1199,14 @@
          bInterval               4
          bRefresh                0
          bSynchAddress         133
-        AudioStreaming Endpoint Descriptor:
+        AudioControl Endpoint Descriptor:

This is from the dump_audiostreaming_endpoint() function. The "AudioStreaming" string is correct. Looks like a typo in the old lsusb output.

lsusb-v.new line 1209

Quoted 8 lines
lsusb-v.new renamed from lsusb-v.orig +1 -1
            bLength                 7
            bDescriptorType        37
            bDescriptorSubtype      1 (EP_GENERAL)
            bmAttributes         0x01
              Sampling Frequency
            bLockDelayUnits         0 Undefined
-          wLockDelay         0x0000
+          wLockDelay              0 Undefined

This and the remaining entries are similar to the above ones.

Quoted 20 lines
lsusb-v.new renamed from lsusb-v.orig +2 -2
        Endpoint Descriptor:
          bLength                 9
          bDescriptorType         5
@@ -1235,7 +1235,7 @@
          bDescriptorSubtype      1 (AS_GENERAL)
          bTerminalLink           1
          bDelay                  1 frames
-        wFormatTag         0x0001 PCM
+        wFormatTag              1 PCM
        AudioStreaming Interface Descriptor:
          bLength                20
          bDescriptorType        36
@@ -1261,14 +1261,14 @@
          bInterval               4
          bRefresh                0
          bSynchAddress         133
-        AudioStreaming Endpoint Descriptor:
+        AudioControl Endpoint Descriptor:
            bLength                 7

lsusb-v.new line 1274

Quoted 10 lines
lsusb-v.new renamed from lsusb-v.orig +1 -1
            bDescriptorType        37
            bDescriptorSubtype      1 (EP_GENERAL)
            bmAttributes         0x01
              Sampling Frequency
            bLockDelayUnits         0 Undefined
-          wLockDelay         0x0000
+          wLockDelay              0 Undefined
        Endpoint Descriptor:
          bLength                 9
          bDescriptorType         5

Cheers,