Greg, ping? On Thu, Nov 08, 2012 at 01:57:04PM -0800, Sarah Sharp wrote: > The math in the link status reporting is wrong. The link state is in > bits 8:5 of the hub port status word, which is split across a char > array. Currently, if the link state is 0xb (Loopback mode), the status > char array will look something like this: > > status[0] = 0110 0000 > status[1] = 0000 0001 > > The current math will mask and shift those bits like so: > > (status[0] & 0xe0) >> 5 = 0000 0011 > (status[1] & 0x1) << 4 = 0001 0000 > > This sets link_state to 0x13, which is not correct (it should be 0xb). > This bug will cause valid link states greater than seven (Recovery, Hot > Reset, Compliance Mode, and Loopback Mode) to not be printed. > > It's important to correctly report Compliance Mode, since some TI USB > 3.0 host controllers can get "stuck" in Compliance Mode. > > Fix this by left shifting status[1] by 3, not 4. > > Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx> > --- > lsusb.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/lsusb.c b/lsusb.c > index 106dd33..5f0df11 100644 > --- a/lsusb.c > +++ b/lsusb.c > @@ -3276,7 +3276,7 @@ static void do_hub(libusb_device_handle *fd, unsigned tt_type, unsigned speed) > (status[0] & 0x01) ? " connect" : ""); > } else { > link_state = ((status[0] & 0xe0) >> 5) + > - ((status[1] & 0x1) << 4); > + ((status[1] & 0x1) << 3); > printf("%s%s%s%s%s%s", > (status[2] & 0x80) ? " C_CONFIG_ERROR" : "", > (status[2] & 0x40) ? " C_LINK_STATE" : "", > -- > 1.7.9 > > -- > 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 -- 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