I found two issues for lsusb for hub information.

Currently, the output is like this:
--------------------------------------------------------------
Hub Descriptor:
  bLength              11
  bDescriptorType      41
  nNbrPorts             8
  wHubCharacteristic 0x000a
    No power switching (usb 1.0)
    Per-port overcurrent protection
    TT think time 8 FS bits
  bPwrOn2PwrGood       10 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00 0x00
  PortPwrCtrlMask    0x00  0x00
--------------------------------------------------------------

I think that we have one more space for PortPwrCtrlMask, and the value
is wrong (in my case, true value is 0xff 0xff).

Here is a fix.

2006-01-17  NIIBE Yutaka  <[EMAIL PROTECTED]>

        * lsusb.c (dump_hub): Format string fix.
        (do_hub): Allocate enough space for the hub descriptor.
        Check return value in different way.

cvs diff: Diffing .
Index: lsusb.c
===================================================================
RCS file: /cvsroot/linux-usb/usbutils/lsusb.c,v
retrieving revision 1.21
diff -u -3 -p -r1.21 lsusb.c
--- lsusb.c     3 Nov 2005 16:03:43 -0000       1.21
+++ lsusb.c     17 Jan 2006 13:51:00 -0000
@@ -1652,7 +1652,7 @@ static void dump_hub(char *prefix, unsig
                printf(" 0x%02x", p[7+i]);
        printf("\n%s  PortPwrCtrlMask   ", prefix);
        for(j = 0; j < l; j++)
-               printf(" 0x%02x ", p[7+i+j]);
+               printf(" 0x%02x", p[7+i+j]);
        printf("\n");
 }

@@ -2141,7 +2141,7 @@ bad:

 static void do_hub(struct usb_dev_handle *fd, unsigned has_tt)
 {
-       unsigned char buf [7];
+       unsigned char buf [12];
        int i, ret;
        
        ret = usb_control_msg(fd,
@@ -2149,7 +2149,7 @@ static void do_hub(struct usb_dev_handle
                        USB_REQ_GET_DESCRIPTOR,
                        0x29 << 8, 0,
                        buf, sizeof buf, CTRL_TIMEOUT);
-       if (ret != sizeof buf) {
+       if (ret < 0) {
                /* Linux returns this for suspended devices */
                if (errno != EHOSTUNREACH)
                        perror ("can't get hub descriptor");


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to