usbutils problems and solution

I just wanted a tool to easily monitor my usb devices, and that should be lsusb . In Gentoo it’s inside usbutils package, but when I tried to emerge it I got a ton of errors like that:

In file included from /usr/include/linux/usb.h:4,
from access.c:34:
/usr/include/linux/mod_devicetable.h:18: error: syntax error before "__u32"
/usr/include/linux/mod_devicetable.h:20: error: syntax error before "class"
/usr/include/linux/mod_devicetable.h:21: error: syntax error before "driver_data"
/usr/include/linux/mod_devicetable.h:31: error: syntax error before "__u32"
/usr/include/linux/mod_devicetable.h:33: error: syntax error before "model_id"
/usr/include/linux/mod_devicetable.h:34: error: syntax error before "specifier_id"
/usr/include/linux/mod_devicetable.h:35: error: syntax error before "version"
/usr/include/linux/mod_devicetable.h:36: error: syntax error before "driver_data"
/usr/include/linux/mod_devicetable.h:99: error: syntax error before "__u16"
/usr/include/linux/mod_devicetable.h:103: error: syntax error before "idProduct"
/usr/include/linux/mod_devicetable.h:104: error: syntax error before "bcdDevice_lo"
/usr/include/linux/mod_devicetable.h:105: error: syntax error before "bcdDevice_hi"
/usr/include/linux/mod_devicetable.h:108: error: syntax error before "bDeviceClass"
/usr/include/linux/mod_devicetable.h:109: error: syntax error before "bDeviceSubClass"
/usr/include/linux/mod_devicetable.h:110: error: syntax error before "bDeviceProtocol"
/usr/include/linux/mod_devicetable.h:113: error: syntax error before "bInterfaceClass"
/usr/include/linux/mod_devicetable.h:114: error: syntax error before "bInterfaceSubClass"
/usr/include/linux/mod_devicetable.h:115: error: syntax error before "bInterfaceProtocol"
/usr/include/linux/mod_devicetable.h:118: error: syntax error before "driver_info"
/usr/include/linux/mod_devicetable.h:135: error: syntax error before "__u16"
/usr/include/linux/mod_devicetable.h:138: error: syntax error before "dev_type"
/usr/include/linux/mod_devicetable.h:139: error: syntax error before "cu_model"
/usr/include/linux/mod_devicetable.h:140: error: syntax error before "dev_model"
/usr/include/linux/mod_devicetable.h:142: error: syntax error before "driver_info"
/usr/include/linux/mod_devicetable.h:155: error: syntax error before "__u8"
/usr/include/linux/mod_devicetable.h:160: error: syntax error before "__u8"
/usr/include/linux/mod_devicetable.h:163: error: syntax error before "__u8"
/usr/include/linux/mod_devicetable.h:165: error: syntax error before '}' token

The solution was to edit /usr/src/linux/include/linux/usb.h and comment out lines 4 and 5:

4 /*#include 5 #include */

Then I emerged usbutils just fine…uncommented the previous lines…and everything is working properly:

# lsusb
Unknown line at line 1809
Duplicate HUT Usage Spec at line 2650
Bus 004 Device 004: ID 058f:9254 Alcor Micro, Inc. Hub
Bus 004 Device 001: ID 0000:0000 Virtual Hub
Bus 003 Device 001: ID 0000:0000 Virtual Hub
Bus 002 Device 001: ID 0000:0000 Virtual Hub
Bus 001 Device 002: ID 05e3:0702 Genesys Logic, Inc.
Bus 001 Device 001: ID 0000:0000 Virtual Hub

2 Responses to “usbutils problems and solution”

  1. January 5th, 2006 | 20:49
    Using Mozilla Firefox Mozilla Firefox 1.5 on Linux Linux

    The (usb.h) file which needs to be included is not the
    one distributed with the kernel () but
    the one which ships with libusb. One must first compile/install
    libusb: http://libusb.sourceforge.net/index.html
    and copy usb.h from the source directory of that package
    to /usr/include/usb.h
    Then usbutils will compile properly.
    I don’t recommend modifying the linux kernel headers as
    above even if IWFM.

  2. site admin
    January 5th, 2006 | 21:47
    UsingUnknown browser

    I did revert back the changes after compiling usbutils, so there’s no harm done to the kernel headers. But libusb should better change the name of their header files so it does not conflict with the kernel ones.

    For the record, I had installed libusb, but the configure/make thingie first found kernel’s usb.h and so it completely ignored usb.h from libusb. That’s not my fault…

    I hate struggling to find out what’s wrong everytime I want to compile a small utility.

Leave a reply