Re: [PATCH v1 3/8] lsusb: Add code to dump descriptor data using descriptor definition.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 05/12/17 16:38, Greg KH wrote:
On Tue, Dec 05, 2017 at 04:14:26PM +0000, Michael Drake wrote:
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.
---
  desc-dump.c | 550 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  desc-dump.h |  64 +++++++
  2 files changed, 614 insertions(+)
  create mode 100644 desc-dump.c
  create mode 100644 desc-dump.h

Same meta-comments as on patch 2 apply here :)

Removed the #ifdef around #include "config.h", and removed the
instances of 2 consecutive blanks.

--
Michael Drake                              http://www.codethink.co.uk/
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux