Driving a USB Rocket Launcher from Perl in
Driving a USB Rocket Launcher from Perl in User Space Mike Schilli, Yahoo! 06/23/2009 YAPC, Pittsburgh, PA
Goals • How can I use USB gadgets on Linux, even if they only come with a Windows driver?
USB: A versatile technology
USB: A versatile technology
USB: A versatile technology
USB: A versatile technology
Limited Fun on Windows
Unlimited Fun with Perl • Defend your Cubicle • Burglar Alarm with Web Cam and Rocket Launcher
USB Architecture
USB Hierarchy
USB Hierarchy
USB Hierarchy
Plug it in …
Plug it in …
Plug it in …
Plug it in …
USB Architecture
USB Architecture
USB Architecture
Plug it in …
Device Drivers • Often not available for Linux, just for Windows/Mac • Hard to write • Highly dependent on kernel version • Vendors don’t want to bother with niche markets
USB Architecture
libusb • Drivers in User Space • http: //libusb. sourceforge. net • Problem: How to find a device?
Plug it in …
USB Architecture
USB Architecture
Install Everything
USB Rules to set Permissions
Rocket. Baby
Plug it in …
Rocket. Baby
Rocket. Baby
USB Architecture • Control Transfers (config & control) • Bulk Transfers (large quantities of timesensitive data) • Interrupt Transfers (small amounts of timesensitive data) • Isochronous Transfers (real-time data at predictable rates)
Reverse Engineering Efforts • Rocket. Baby comes with Win XP driver – Protocol sniffed out with USBSniff –. DLL code investigated with IDA Pro Disassembler (see references) – Control Transfers for turn/raise/lower/fire – Bulk Transfers for reading status
Reverse Engineering Efforts • Control Transfers (config & control) • Bulk Transfers (large quantities of timesensitive data) • Interrupt Transfers (small amounts of timesensitive data) • Isochronous Transfers (real-time data at predictable rates)
Rocket. Baby Control Codes
Swivel/Raise Rocket Tower
Read Status
Demo
CPAN Module Device: : USB: : Missile. Launcher: : Rocket. Baby
CPAN Module Device: : USB: : Missile. Launcher: : Rocket. Baby
Demo • Attention in the splash zone! • Incoming rockets!
References • Video “The Great Office War” http: //www. youtube. com/watch? v=p. VKn. F 26 q. FFM • Alessandro Rubini, Linux Device Drivers: http: //lwn. net/images/pdf/LDD 3/ch 13. pdf • “Essential Linux Device Drivers”, Sreekrishnan Venkateswaren, Prentice Hall, 2007 • Rocket. Baby Reverse Engineering Efforts http: //dvlabs. tippingpoint. com/blog/2009/02/12/python-interfacing-ausb-missile-launcher
- Slides: 43