eBuddy USB device on Linux #hardware #programming
Quite a while ago I bought an "e-Buddy USB MSN/QQ Blinking and Flapping Audio Visual Message Angel" - just for fun. I thought it might be useful at work to indicate changes/status of various things.
When I got it, I plugged it into my Debian GNU/Linux machine and, as expected, nothing happened. As it only came with Windows-drivers and no low-level documentation, I left it in the windowsill, as it were, gathering dust.
The other day I brought the little angel to work and fired up Windows XP in VMware and used usbmon to capture the various commands sent while manipulating the Windows-program that the device came with. It turned out to be quite easy, the communication consisted of the computer sending 4 byte commands, CM00 to CM25, to the USB device.
I then set out reading about how to write a USB driver for Linux. A little searching turned up an article in Linux Journal by Greg Kroah-Hartman called "Writing a Simple USB Driver" (2004). Reading that, writing a driver seemed doable, but communicating with it via /sys/ sounded a little off for the purpose at hand - regardless of the lure of being able to email the Linux Kernel mailinglist a driver. Fortunately at the end of the article Greg Kroah-Hartman mentions another article solving the same problem, only using libusb in userland. Aha, that sounded interesting!
After some typing - mostly mimicking the article - and a little reading of the documentation for libusb to get the commands right, I managed to make the angel do something from Debian - success! I added a little man-page, a udev-rules-file, and a Makefile - check out my ebuddy repository.
Searching for the vendor id:product id of the device, 0c45:0011, didn't return much - basically the only reference I could find was a blog-entry, "Buddy Spencer", that mentioned that it was easy to talk to, but gave no examples or code (as far as I can tell via Google Translate, anyway). The vendor that has 0c45, Microdia, is mentioned in many places, mostly webcams, but the product id, 0011, not so much.
Also, 0c45:0011 = Microdia EBUDDY DRIVER wasn't listed in the USB ID Repository, so I have added the product id to the list.
Yesterday I hooked the program into our automatic test system at work, so every time our tests fail, the angel's head blinks red - and when our tests are all successful, the angel's head blinks green. I am not using any of the other functions yet, but both the blinking heart, the other colours and the flapping of wings/rotating the body could be assigned to something...
In 2022 I got inspired to rewrite the little C program in Haskell: ebuddy.hs.
- Adam Sjøgren 🕗︎ - 2023-02-08