usbhub

This driver allows controlling the per-port indicator LEDs on USB Hubs as GPIOs.

The control messages used to switch the LEDs on and off are defined in the USB2.0 Specification, Chapter 11, so all hubs implementing that standard should work with this driver.

Of course, normal operation of the hub is not disrupted (except the LEDs won't show the link state of a port any more), so you can keep using it normally.


First you'll need to find the Vendor/Product IDs for your Hub. The “lsusb” utility is quite usefull here:

# lsusb -t
Bus#  2
`-Dev#   1 Vendor 0x0000 Product 0x0000
  `-Dev#   3 Vendor 0x0409 Product 0x0058     <-- This is a hub
    |-Dev#  10 Vendor 0x059f Product 0x0351
    |-Dev#  11 Vendor 0x04b4 Product 0x6830
    |-Dev#   9 Vendor 0x067b Product 0x3507
    `-Dev#   8 Vendor 0x04b4 Product 0x6560   <-- This is a hub (all Ports unconnected)
Bus#  1
`-Dev#   1 Vendor 0x0000 Product 0x0000
  |-Dev#   3 Vendor 0x058f Product 0x9254     <-- This is a hub, too
  | |-Dev#  10 Vendor 0x0a12 Product 0x0001
  | |-Dev#  11 Vendor 0x05fe Product 0x0011
  | `-Dev#  21 Vendor 0x045e Product 0x0040
  `-Dev#   4 Vendor 0x058f Product 0x9360

I'll use the 0x4b4/0x6560 Hub for this example. First check if its suitable:

# lsusb -v -d 0x04b4:0x6560
...
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             4
  wHubCharacteristic 0x0089
    Per-port power switching
    Per-port overcurrent protection
    TT think time 8 FS bits
    Port indicators             <-- This means the hub has controllable port indicators. Good.
  bPwrOn2PwrGood       50 * 2 milli seconds
  bHubContrCurrent    100 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0x00
...

Now configure lcd4linux for it:


Display SitecomHUB {
    Driver 'USBHUB'
    Vendor '0x04b4'
    Product '0x6560'
}

Thats already all thats needed. The driver will detect the count of LEDs on the device automatically.

The driver will provide a GPO for each Port on the hub, which will accept the following values:

 0 : Automatic color (display link state etc) \\\
 1 : Amber \\\
 2 : Green \\\
 3 : Off \\\

If your hub doesn't have dual-color LEDs, setting “Amber” will most likely simply turn the LED off.

Here a simple example Widget+Layout config, making one port LED blink:

Widget GPO_Test300 {
    class 'GPO'
    expression 2+(1+test::onoff(1))/2
    update 300
}
Layout TestHUB {
   GPO3 'GPO_Test300'
}
Display 'TyphoonHUB'
Layout  'TestHUB'

using expressions based on the netdev or diskstats plugins, you can easily put HDD/Network activity LEDs right on your desk.


  • This driver doesn't handle USB disconnects gracefully. If you disconnect your HUB, you'll have to restart lcd4linux for it to detect your HUB again.
  • usbhub.txt
  • Last modified: 2020/07/17 18:33
  • (external edit)