On Thu, Dec 07, 2017 at 04:01:23PM +0100, Greg KH wrote:
> On Thu, Dec 07, 2017 at 04:00:36PM +0100, Greg KH wrote:
> > On Thu, Dec 07, 2017 at 10:26:21AM +0000, Michael Drake wrote:
> > > This adds a new way of dumping descriptors, which splits the knowledge
> > > of how to interpret descriptor data from the actual dumping. This has
> > > two advantages:
> > >
> > > 1. It is easy to add support for new descriptors, since they are now
> > > simple definitions that resemble the tables in the USB specifications.
> > >
> > > 2. The code for dumping descriptors is common, so the output is easy to
> > > keep consistent. It is also consistent and thorough in its handling
> > > of insufficient descriptor data buffer, and junk data at the end of
> > > a descriptor.
> > >
> > > UAC1 and UAC2 are converted to use the new mechanism, initial support
> > > for UAC3 is added. Finally, support for the USB3 BOS Configuration
> > > Summary Descriptor is added.
> > >
> > > This was previously opened as a github pull request here:
> > >
> > > https://github.com/gregkh/usbutils/pull/61
> >
> > Thanks for this, all of the patches are now applied.
> >
> > There were some intermediate build warnings, but future patches in the
> > series fixed that up, next time be more careful, each patch should be
> > "clean".
> >
> > However the build now gets the following warnings:
> >
> > CC lsusb-lsusb.o
> > lsusb.c:220:12: warning: ‘get_audioterminal_string’ defined but not used
> > [-Wunused-function]
> > static int get_audioterminal_string(char *buf, size_t size, u_int16_t
> > termt)
> > ^~~~~~~~~~~~~~~~~~~~~~~~
> > CC lsusb-lsusb-t.o
> > CC lsusb-desc-defs.o
> > CC lsusb-desc-dump.o
> > desc-dump.c: In function ‘desc_bmcontrol_dump’:
> > desc-dump.c:67:18: warning: comparison between pointer and zero character
> > constant [-Wpointer-compare]
> > if (strings[0] != '\0') {
> > ^~
> > desc-dump.c:67:7: note: did you mean to dereference the pointer?
> > if (strings[0] != '\0') {
> > ^
> > CC lsusb-names.o
> >
> >
> > Can you fix this up and send a patch for them?
>
> 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?
And it's crashing on my USB audio device. Here's the output of it from
the "old" lsusb output.
Bus 001 Device 018: ID 0d8c:1066 C-Media Electronics, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0d8c C-Media Electronics, Inc.
idProduct 0x1066
bcdDevice 1.03
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 214
bNumInterfaces 3
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 2
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 40
bInCollection 1
baInterfaceNr( 0) 1
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 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 7
wTerminalType 0x0301 Speaker
bAssocTerminal 0
bSourceID 13
iTerminal 0
AudioControl Interface Descriptor:
bLength 10
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 13
bSourceID 1
bControlSize 1
bmaControls( 0) 0x01
Mute Control
bmaControls( 1) 0x00
bmaControls( 2) 0x00
iFeature 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 4
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 2
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 20
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 2
bSubframeSize 2
bBitResolution 16
bSamFreqType 4 Discrete
tSamFreq[ 0] 44100
tSamFreq[ 1] 48000
tSamFreq[ 2] 88200
tSamFreq[ 3] 96000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x05 EP 5 OUT
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0188 1x 392 bytes
bInterval 4
bRefresh 0
bSynchAddress 133
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0 Undefined
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x85 EP 5 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0003 1x 3 bytes
bInterval 4
bRefresh 5
bSynchAddress 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 2
bNumEndpoints 2
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 20
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 2
bSubframeSize 3
bBitResolution 24
bSamFreqType 4 Discrete
tSamFreq[ 0] 44100
tSamFreq[ 1] 48000
tSamFreq[ 2] 88200
tSamFreq[ 3] 96000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x05 EP 5 OUT
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x024c 1x 588 bytes
bInterval 4
bRefresh 0
bSynchAddress 133
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0 Undefined
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x85 EP 5 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0003 1x 3 bytes
bInterval 4
bRefresh 5
bSynchAddress 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.00
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 24
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html