140 likes | 251 Views
Ruby USB. Michael Hewner rubyusb.technofetish.net rubyusb ‘at’ hewner.com. What’s Cool About USB?. Everywhere & well specified You can build your own (but not in ruby) Self-describing (especially HID devices). USB Human Interface Devices. For the complete HID spec details check out
E N D
Ruby USB Michael Hewner rubyusb.technofetish.net rubyusb ‘at’ hewner.com
What’s Cool About USB? • Everywhere & well specified • You can build your own (but not in ruby) • Self-describing (especially HID devices)
USB Human Interface Devices For the complete HID spec details check out Device Class Definition for HID 1.11 http://www.usb.org/developers/devclass_docs/HID1_11.pdf
The Goal: Annotated Data 10000000011111011 Distinct but logically grouped Annotated with the string “security stuff” Measures in °C Minimum Value -36 Implicitly *10^3 Left mouse button
A Partial Mouse HID Descriptor 3 1 Bit “Button” Fields 1 5 Bit Empty Space
How Does it Work? Part 1 of 3: libUSB C Structs & Raw USB Descriptions LibUSB Cross -Platform C USB Library • Provides basic C access to all key USB fuctionality • Supposedly cross-platform (OS X and BSD) but I’ve only tested on Linux • The version in the Debian package repository doesn’t work – you need to get the latest from CVS • You must disconnect devices from the kernel
How Does it Work? Part 2 of 3: HIDParser Report Descriptor Objects HIDParser C++ OO Parser For HID Reports • Parses the HID into “Report Descriptor Objects” that describe a particular kind of communication • Vast majority of HID constructs are supported • Suite of unit tests • Needs more testing on interesting HID devices
How Does it Work? Part 3 of 3: RubyUSB RubyUSB Handy Documented USB Library • Tries to implictly do the right thing • Produces annotated Objects • Needs more work for Output and some other stuff
Simple Commands The Big Picture AVR USB USB Your Rock’n USB C Device LibUSB Cross- Platform C USB Library Your Rock’n App HIDParse C++ OO Parser For HID Reports RubyUSB Handy Documented USB Library Raw USB Descriptions Report Descriptor Objects Fancy Report Objects Raw USB Reports
AVRUSB: So Very Cool So easy to build your own custom USB devices anybody can do it. As long as anybody has a soldering iron and an avr microcontroller programmer. http://www.obdev.at/products/avrusb/hidkeys.html
Future Stuff • Improved packaging building and installation • Improved ruby objects • More testing with a variety of usb devices • Evdev for even easier but less cool fun