USB human interface devices with Linux
From Organic Design wiki
I want to use a plastic drum pad to trigger sounds on the computer. It is connected by USB. It is not supported by Mac OS X by default. It is not a MIDI device.
Device connection
The following appears in /var/log/messages
Dec 4 21:11:13 colourbox kernel: usb 1-2: new low speed USB device using uhci_hcd and address 3 Dec 4 21:11:13 colourbox kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 4 21:11:13 colourbox kernel: usbcore: registered new driver hiddev Dec 4 21:11:13 colourbox kernel: hiddev96: USB HID v1.00 Device [HID 1941:8021] on usb-0000:00:14.2-2 Dec 4 21:11:13 colourbox kernel: usbcore: registered new driver usbhid Dec 4 21:11:13 colourbox kernel: drivers/usb/input/hid-core.c: v2.6:USB HID core driver
The following device node appears
# ls -al /dev/usb/hiddev0 crw-rw---- 1 root root 180, 96 2008-12-04 21:53 /dev/usb/hiddev0
# lsusb Bus 001 Device 004: ID 1941:8021 Bus 001 Device 001: ID 0000:0000
# lsusb -D /proc/bus/usb/001/004 Device: ID 1941:8021 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x1941 idProduct 0x8021 bcdDevice 1.00 iManufacturer 0 iProduct 0 iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 34 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 3 Human Interface Devices bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.00 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 52 Report Descriptors: ** UNAVAILABLE ** Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0008 1x 8 bytes bInterval 10 Device Status: 0x0000 (Bus Powered)
Using the code Chuck hid example code from here.
# chuck hdi.ck /dev/usb/hiddev0 [hiddev0]:line(1).char(1): illegal token [hiddev0]:line(1).char(2): illegal token [hiddev0]:line(1).char(3): illegal token ....