Commit Graph

3 Commits

Author SHA1 Message Date
Michael Drake
969054759a lsusb: Squash Wpointer-compare warning.
This squashes "warning: comparison between pointer and zero character"

This was an empty string check that was checking the pointer rather
than the first character.  The check was done correctly before the
string was used, so here we yank the correct check up, to the upper
level, replacing the ineffectual/broken one.

Signed-off-by: Michael Drake <michael.drake@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-07 18:15:29 +01:00
Michael Drake
5696933b47 lsusb: Add descriptor definitions for UAC3.
These descriptor definitions descibe how raw descriptor data
should be interpreted.

Signed-off-by: Michael Drake <michael.drake@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-07 15:53:28 +01:00
Michael Drake
7e9defbdb6 lsusb: Add code to dump descriptor data using descriptor definition.
This adds a new way of dumping descriptors.  It takes the descriptor
data to be dumped, and a descriptor definition as input.

The descriptor definition takes the form of a NULL terminated array
of descriptor field definitions.

These definitions describe how the raw descriptor data buffer should
be interpreted.

Thus the knowledge of how to interpret a descriptor buffer is separate
from the shared code that renders the descriptor dump.  This has two
advantages:

1. 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.

2. It is easy to add support for new descriptors, since they are now
   simple definitions that resemble the tables in the USB specifications.

Signed-off-by: Michael Drake <michael.drake@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-07 15:52:48 +01:00