Notice: Array to string conversion in system/classes/theme.php line 93
IMakeThin.gs :: hacking the USB i-buddy

Notice: Array to string conversion in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
http://imakethin.gs/blog/hacking-the-usb-i-buddy" title="hacking the USB i-buddy">hacking the USB i-buddy

Notice: Array to string conversion in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
Notice: Object of class HabariDateTime could not be converted to int in system/classes/rewriterule.php line 112
http://imakethin.gs/blog/hacking-the-usb-i-buddy#comment-form" title="Comments on this post">

T'other day I bought one of these (it fits my gadget needs by having blinking lights AND being USB enabled) I-buddy msn notifier. It arrived yesterday and in fine Tom-Style I binned the instructions and plugged it in.

 After the usual cocking about with XP it started working, all emoticons in my msn chats were triggering it (annoyingly even the ones in peoples names :/ ). Half hour later I was bored with it.

 "hmm, wonder if i can get this working in my NSLU2.." he thinks.

So I fired up the ole' XP virtual machine that I use for this sort of thing and installed usbsnoop. 10 minutes of msn conversations seemed to generate enough usb packet data to do the trick :)

 The protocol is stupidly simple, its using the USB HID stuff but seems to respond to data packets without having all the HID stuff set up.

Heres how it works:

  1. Scan the usb busses for something with vendorid=0x1130 and prodid=0x0002 - thats the ibuddy
  2. The first thing to send to it is the setup packet -
    1. (0x22, 0x09, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00)


  3. the header for the data packet is
    1. (0x55, 0x53, 0x42, 0x43, 0x00, 0x40, 0x02)


  4. onto the header append another byte of the following format XBGRUDLR  where:
    1. X = heart LED (1 = on, 0 = off)

    2. B G R are the bits for the 3 leds in the head but inverted, i.e. 0 = on, 1 = off

    3. U D are the wing positions, toggle between them to flap

    4. L R are used to twitch it left and right, only enable 1 at a time


  5. Thats it! Things toggled on stay on until turned off. To clear it all send 0xff

This works wonderfully with libusb and python, thanks to Scott Weston for publishing the USB rocket launcher python scripts, from which I borrows the USBDevice classes and bastardized for my own use.

Example script is here, currently it flashes the head blue. Note it requires Python, pyusb and libusb to be installed first.

 I'm planning on using this to alert me when torrents are complete, email notifications etc.

Do with it what you will :)

Cuntography.com » Blog Archive » Wrist warmer photo viewer

[...] now installed in a wrist warmer, as some kind of interactive jewlery thing, I’ve posted it all on instructables of course Filed under: craft, hacks [...]

2007-12-19 3:24 am

Hacking the USB i-buddy » Developages - Development and Technology Blog

[...] Tom hacked the USB I-buddy to work on linux with libusb and python, details and more here - Link. [...]

2007-12-19 10:44 am

Hacking the USB i-buddy

[...] Tom hacked the USB I-buddy to work on linux with libusb and python, details and more here - Link. [...]

2007-12-19 11:52 am

Chuck LeDuc Díaz

The script is 404 -- would you mind reposting it?

2008-06-19 7:13 pm

tom

Certainly, the link is now fixed :)

2008-06-21 6:42 am

Slikkie

Thanks for your efforts!

I got this gadget for free and I think it's cute :) so I like to get it work

but it seems your script cannot find my ibuddy, it's output is just "Starting search..." and some dots on new lines. Do you know how to solve that?

thanks!

2008-06-26 4:14 am

tom

yup i think i know what that is, when you connect the iBuddy the usbhid driver claims it. To prevent that you need to unload the usbhid driver, start the script, then reload the usbhid driver

Bear in mind that the usbhid driver controls keyboards and mice, unloading it will kill them! You need to write a short script to do this. Something like

#!/bin/sh
rmmod usbhid
./ibuddy.py
insmod usbhid

Save that to a .sh file, chmod it to allow execution and run. Cant guarantee it will work though

2008-06-26 4:21 am

BoD

Hi!
You'll be happy (or indifferent) to know that I used the information you posted here to hack a Java library, available here:
http://www.jraf.org/static/maven/sites/jlibibuddy/
So I just wanted to thank you very much cause I couldn't have done it without your work finding the USB protocol! And now I'm having fun playing with the i-Buddy, making it blink, nudge and flap its wings in all sorts of ways;) So thank you!

2008-09-07 1:43 pm

Andy

So I've tried and tried and tried a bajillion things (including different distros [FC4 and then Ubuntu 8.04]) and the best I can get is:
"usb.USBError: error sending control message: Broken pipe"
Anyone have any ideas on this?
I also decided I might try to sniff it in "normal" operations on Windows using SnoopyPro and MSN Chat, but SnoopyPro refused to log anything beyond the initial bus scan. Any ideas anyone?

2008-09-09 2:29 pm

Andy

OK, so I've gotten it working. There were some pretty big differences with my i-Buddy:
1) After getting a USB sniffer working, I found out that the "value" in the control message for mine needed to be set to 200. Additionally, I found that the "setup" control message is unnecessary for mine. You can just send the data messages directly.
2) What's really strange is that the order and "polarity" of the bits for the data byte are totally different.
Mine is XGBRDURL. For all the LEDs (including the heart) on = 0 and off = 1. But, for the movements, on = 1 and off = 0

I've also managed to get a basic Perl version working, but it has some minor issues still. If I get around to fixing it, perhaps I'll post it here.

2008-09-11 10:49 am

dreyercito

Thank you for all the work done! :) It was really easy to set up my own version of the software with your example and all information given. To Tom and slikkie: In the given example there is already a way to detach the HID controller, it's in the commented lines (detachKernelDriver).

2008-10-29 1:43 pm

Dyocma

Chouette !
Merci pour les informations, je cherche le code en C.
Merci

Cool!
Thank you for the information, I seek the code in C.
Thank you

2008-11-14 9:13 am

dyocma

./ibuddy.py: 1: import: not found
./ibuddy.py: 2: import: not found
./ibuddy.py: 5: class: not found
./ibuddy.py: 6: Syntax error: "(" unexpected

Pyhton Ok, Libusb Ok et Pyusb Ok !!

2008-11-14 10:22 am

pybuddy: hacking ambient devices (for fun & profit) « 2E5E

[...] algo, si alguien no lo ha hecho ya. Una semana más tarde, teníamos un juguete nuevo cada uno y un código del que partir. El fruto del cacharreo se llama pybuddy: un demonio escrito en python que atiende a comandos [...]

2008-11-21 4:22 am

dyocma

Gracias.
Encontré este sitio http://code.google.com/p/pybuddy/ , pero no descargar fuentes!

2008-11-23 4:23 am

dyocma

oups, j'avais pas vu le lien dans le titre. merci http://2e5e.wordpress.com/2008/11/21/pybuddy-hacking-ambient-devices/

Vaya, yo no había visto vínculo en el título

2008-11-23 4:25 am

mastermaster

Yuhuu. This is great tool to do some status meter with simple python scripts, thanks for that...

Some points:
I noticed that my buddy had a product id 0001 not 0002.
To run with normal user I had to make udev rule:
SYSFS{idProduct}=="0001", SYSFS{idVendor}=="1130", MODE="666", OWNER="root", GROUP="root"

2009-06-18 5:53 am

petur

I recently got a cheap imitation of this from DX (called e-buddy), and started working on this. I have hit a brick wall now as self.dev.handle.controlMsg(0x21, 0x09, self.SETUP, 0x200, 0x01) seems to generate an exception although the device is found fine and enumerates as it should. They also use the control interface (checked with sniffer) but I don't manage to write to it.

Would appreciate it if you'd get in touch with me ;)

2010-01-10 5:08 pm

petur

Nevermind, got it working.
For people with an ebuddy (DX copy), see http://code.google.com/p/pybuddy-dx/

2010-01-18 6:12 am

tom

Hi Petur, Sorry I didnt get back to you, i've been recovering from a broken arm and its been a right pain to type things! Glad you got it working though

I fixed the problem with detaching the iBuddy from the kernel driver, use the quirks parameter when loading the usbhid module to blacklist the device. Works a treat!

2010-01-21 12:18 pm

Vik

anyone know if it (i-buddy or e-buddy dx) works on mac osx?

Thanks

2010-05-18 5:53 am

Notice: Array to string conversion in system/classes/theme.php line 93