Difference between revisions of "USB human interface devices with Linux"

From Organic Design wiki
(add in chuck test code)
(add link to driver page)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
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.
+
I want to use a [http://www.coolestgizmo.com/audio-gadgets/the-usb-drum-kit-for-music-nerds/ 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.
 +
 
 +
==User space driver==
 +
*[[USB Roll-up drum kit user-space driver for linux]]
  
 
==Device connection==
 
==Device connection==
Line 85: Line 88:
 
</pre>
 
</pre>
  
Using the code [*[http://wiki.cs.princeton.edu/index.php/Chuck_hid_example_code Chuck hid example code] from here.]
+
Using the code [http://wiki.cs.princeton.edu/index.php/Chuck_hid_example_code Chuck hid example code from here.]
 
  # chuck hdi.ck /dev/usb/hiddev0
 
  # chuck hdi.ck /dev/usb/hiddev0
 
  [hiddev0]:line(1).char(1): illegal token
 
  [hiddev0]:line(1).char(1): illegal token
Line 91: Line 94:
 
  [hiddev0]:line(1).char(3): illegal token
 
  [hiddev0]:line(1).char(3): illegal token
 
  ....
 
  ....
 +
 +
==Useful commands==
 +
sudo apt-get -y install joystick joy2key
 +
dpkg -L joystick | grep bin
 +
dpkg -L joy2key | grep bin
  
 
==See also==
 
==See also==
 +
*[http://mips42.altervista.org/jackdrum/jackdrum-1.0a.tar.gz Userspace driver for JACK MIDI]
 +
*[http://www.linuxjournal.com/article/10194 Linux Journal article about joysticks]
 
*[http://wiki.cs.princeton.edu/index.php/Chuck_hid_example_code Chuck hid example code]
 
*[http://wiki.cs.princeton.edu/index.php/Chuck_hid_example_code Chuck hid example code]
 
*[http://www.hydrogen-music.org/forum/?p=show&action=show_thread&thread=806&fid=5&page=last forum post]
 
*[http://www.hydrogen-music.org/forum/?p=show&action=show_thread&thread=806&fid=5&page=last forum post]
 +
*[http://ftp.debian.org/debian/pool/main/j/joystick/joystick_20051019-1_i386.deb joystick debian package] - perhaps the same as the main one?
  
  
 
[[Category:Rob]]
 
[[Category:Rob]]

Latest revision as of 00:37, 21 January 2009

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.

User space driver

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
....

Useful commands

sudo apt-get -y install joystick joy2key
dpkg -L joystick | grep bin
dpkg -L joy2key | grep bin

See also