Skip to contentSkip to conversation

USB HID output events

DISCUSSION Hector Martin [LKML] 1 participant 1 message Jul 14, 2006

lore
Share & tools
lore
#0 lore raw

I'm building and writing the firmware for a homebrew USB HID device. Currently it just behaves like a HID gamepad, with a set of buttons. The device has four lights associated with four of the buttons, which by default light up when the buttons are pressed. However, the host should be able to set the device in an override mode and take control of the lights independently.

I'll be writing the userland interface software too (it will really just be a patch to a game), for linux. Does linux have a mechanism where a userland process can send events to a USB HID device? I am quite new to USB (this is my first project with it, although I managed to figure out how to implement a HID device based on some device-side driver code I found), and I'm not sure how I should go about implementing this, both device-side and host-side. The host-side process must be able to run non-root and still be able to access the lights.

There should be two modes: automatic lights, and overriden lights. This can be implemented both in host-side and device-side (as controlled by a user configuration on the device). Ideally, both would be: if the host wishes to control the lights, and the user set the device to allow it, then the device will listen to the host's information. Otherwise (if the host is unwilling to control the lights at this time, or the device is set by the user to ignore the host's information, or both), then the device will revert to controlling the lights itself. This will allow for the user to control the setting on the device without having to mess around on the host software (which on its current implementation makes making this configuration change annoying, as it requires a reset to the main menu), and also allows the device to control the lights when the PC doesn't want to do it.

I of course can set the device to do pretty much anything I want with USB. I'd need to make it allow receiving USB HID events (it already does, but currently ignores them). I'm not sure how I should implement this in USB descriptor format, though, or how the data should be formatted.

Any help, pointers, or other information would be very appreciated.

Sincerely,

Signature · 2 lines
Hector Martin ([email protected])
Public Key: http://www.marcansoft.com/hector.asc