Went to Staples the other day to grab some assorted accessories for work and I saw they had some Brookstone USB Desktop Missile Launchers in the clearence section, so I grabbed one.
What fun, I thought. Plugged it into my work desktop (running LinuxMint Debian Edition) only to find there were no linux drivers for this particular device.
This turned into a nice little weekend project
Digging under the hood I ran
lsusb which gave me this:
Bus 002 Device 008: ID 2123:1010
There is a goofy project called Retaliation that uses this model in conjunction with the Jenkins continuous integration server to punish the person who broke a build. It was very useful in seeing how to manipulate the device with PyUSB, as it was really the only thing I could find that interfaces wih the device in Linux.
Additionally USB Snoopy was useful for reverse engineering USB messages the device was using that I couldn’t grok from Retaliation.
It is not so very complex, but there are a few points to note:
python-usbpackage installs PyUSB 0.4 and this project uses 1.0, so you’ll need to install it manually.
- You’ll need to run it as root (or via sudo) unless you want to dick around with udev rules.
One final note for others attempting to do something similar with a USB device in Linux that caused me to waste a few hours and receede my hairline a bit: You need to detach the kernel driver or you cannot claim the device.
Setup the device as normal using the ID numbers from
dev = usb.core.find(idVendor=0x2123, idProduct=0x1010)
Detach the kernel driver if it is active:
if dev.is_kernel_driver_active(0) is True: dev.detach_kernel_driver(0)
This will free you up so you can get to work.
So there you have it. I fear for the sanity of my co-workers who walk up behind me to ask questions: *pew* *pew* *pew*
Download the code here.