usb-host: rewrite usb_linux_update_endp_table
commit96dd9aac37d30f3425088f81523942e67b2d03ac
authorGerd Hoffmann <kraxel@redhat.com>
Thu, 29 Mar 2012 14:06:28 +0000 (29 16:06 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 17 Apr 2012 08:23:28 +0000 (17 10:23 +0200)
treeb418b8fe0461afceb2f9dcc93cc0d047959189ac
parente36a20d329b4cf52ce3b269345527e7ebcc00885
usb-host: rewrite usb_linux_update_endp_table

This patch carries a complete rewrite of the usb descriptor parser.
Changes / improvements:

 * We are using the USBDescriptor struct instead of hard-coded offsets
   now to access descriptor data.
 * (debug) printfs are all gone, tracepoints have been added instead.
 * We don't try (and fail) to skip over unneeded descriptors.  We parse
   them all one by one.  We keep track of which configuration, interface
   and altsetting we are looking at and use this information to figure
   which desciptors are in use and which we can ignore.
 * On parse errors we clear all endpoint information, which will
   disallow any communication with the device, except control endpoint
   messages.  This makes sure we don't end up with a silly device state
   where half of the endpoints got enabled and the other half was left
   disabled.
 * Some sanity checks have been added.

The new parser is more robust and also leaves complete device
information in the trace log if you enable the ush_host_parse_*
tracepoints.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/host-linux.c
trace-events