David Brownell wrote:
Olaf Hering wrote:

missing arguments.

In both cases, "indent".


... looks like the gcc config in that package needs updating too,
it forgot "-Wall".  Clearly I didn't test this with a CDC-ACM
device -- just several CDC Ethernet(ish) devices.

And nobody had built "lsusb" with "-Wall" in some time. Or maybe there are caches of vendor patches to the 0.11 release ... when I used "CFLAGS="-Wall -Os ./configure", some other issues came up. (I guess I'd expect configure.in to turn on warnings.)

Thomas, this goes on top of the other patch.  It fixes several
other lint warnings/bugs in lsusb; it was the only file with
those problems.  How correct is that HID parsing?  :)

- Dave


--- usbutils.new/lsusb.c        2003-08-31 17:22:54.000000000 -0700
+++ usbutils-0.11/lsusb.c       2003-09-14 19:44:27.000000000 -0700
@@ -121,7 +121,6 @@
 static int get_string(int fd, char *buf, size_t size, u_int8_t id, u_int16_t lang)
 {
        unsigned char b[256];
-       wchar_t w[128];
        unsigned int i;
        int ret;
 
@@ -374,7 +373,7 @@
        static const char *typeattr[] = { "Control", "Isochronous", "Bulk", 
"Interrupt" };
        static const char *syncattr[] = { "none", "Asynchronous", "Adaptive", 
"Synchronous" };
        static const char *usage[] = { "Data", "Feedback", "Implicit feedback Data", 
"(reserved)" };
-       static const char *hb[] = { "once", "twice", "three times", "(??)" };
+       static const char *hb[] = { "once", "twice", "three times", "(?)" };
        unsigned wMaxPacket = buf[4] | (buf[5] << 8);
 
        if (buf[1] != USB_DT_ENDPOINT)
@@ -1075,7 +1074,7 @@
 
 static void dump_report_desc(unsigned char *b, int l)
 {
-        unsigned int t, j, bsize, btag, btype, data, hut;
+        unsigned int t, j, bsize, btag, btype, data = 1000, hut = 1000;
        int i;
        char *types[4] = { "Main", "Global", "Local", "reserved" };
        char indent[] = "                            ";
@@ -1219,9 +1218,9 @@
                        indent,
                        indent, buf[3]);
                if (buf[3] & 0x01)
-                       printf( "%s    call management\n");
+                       printf( "%s    call management\n", indent);
                if (buf[3] & 0x02)
-                       printf( "%s    use DataInterface\n");
+                       printf( "%s    use DataInterface\n", indent);
                printf("%s  bDataInterface        %d\n", indent, buf[4]);
                break;
        case 0x02:              /* acm functional desc */
@@ -1265,7 +1264,7 @@
                        "%s  iMacAddress             %d %s\n"
                        "%s  bmEthernetStatistics    0x%08x\n",
                        indent,
-                       indent, buf[3], (buf[3] && *str) ? str : "(??)",
+                       indent, buf[3], (buf[3] && *str) ? str : "(?)",
                        indent, tmp);
                /* FIXME dissect ALL 28 bits */
                printf( "%s  wMaxSegmentSize         %d\n"
@@ -1290,8 +1289,7 @@
 static void do_config(int fd, unsigned int nr, u_int16_t lang)
 {
        unsigned char buf[1024],*p, *err;
-       unsigned int sz,curinterface;
-       int l;
+       unsigned int sz,curinterface = 1000;
        u_int8_t curclass = 0xff, cursubclass = 0xff;
 
        if (usb_control_msg(fd, USB_DIR_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_CONFIG << 
8) | nr,
@@ -1699,7 +1697,7 @@
                exit(1);
        }
        if ((err = names_init("./usb.ids")) != 0)
-               if(err = names_init(USBIDS_FILE)) {
+               if((err = names_init(USBIDS_FILE)) != 0) {
                        printf("Error, cannot open USBIDS File \"%s\", %s\n", 
USBIDS_FILE, strerror(err));
                        exit(1);
        }

Reply via email to