The OCZ NIA and Linux.

  biofeedback drivers hacking hardware linux neural_interface notes ocz_nia raw_data software stats usb

As I mentioned a couple of weeks ago I recieved as a Yule gift an OCZ NIA, a hardware device aimed at gamers which acts as one part EEG and one part biofeedback monitor. The idea behind it, in short, is that the user trains eirself using the included software to generate specific patterns of electrical activity in the brain and facial muscles that the drivers use to trigger certain system events. There's just one thing: there are no Linux drivers.

I love a challenge.

For the record, I'm using Windbringer as my testbed, running Gentoo Linux 2008.0 and v2.6.28.7 of the Linux kernel.

After the cut lie notes and raw data. Proceed at your own risk.

First step: connecting the OCZ NIA without the dermatrodes attached.

Kernel message buffer:

usb 5-2: new full speed USB device using uhci_hcd and address 2
usb 5-2: configuration #1 chosen from 1 choice
generic-usb 0003:1234:0000.0001: claimed by neither input, hiddev nor hidraw
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver

UDEV creates the following device nodes:

crw-rw---- 1 root root   252,  14 Mar 11 21:03 usbdev5.2_ep81
crw-rw---- 1 root root   252,  15 Mar 11 21:03 usbdev5.2_ep01
crw-rw---- 1 root root   252,  16 Mar 11 21:03 usbdev5.2_ep00

Trying to cat or dd from thosse devices, however, gives the error message "dd: opening `/dev/usbdev5.2_ep0?': No such device or address" (where ? stands in for the number 0 or 1).

The output of lsusb -v | less:

Bus 005 Device 002: ID 1234:0000  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x1234 
  idProduct          0x0000 
  bcdDevice            0.01
  iManufacturer           1 Brain Actuated Technologies
  iProduct                2 Neural Impulse Actuator Prototype 1.0
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3 C1
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              200mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              4 C1 IO
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      96
         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     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)

I need to sit down and figure out what all of that means.

Looking at the blue LEDs along the bottom of the interface/microcontroller, the unit's definitely getting power.

I tried running USBmon against it, but didn't get any output. I don't think that I was running it properly, there are a few things that have to be done beforehand for it to capture information.

More research is required.