xbox 360 big button ir remote controlThis blog is more a story of why I will never manage to clean out storage.  When going through a box I found 4 Xbox ‘buzzers’ and what looked like an USB IR receiver.  After some Googling, I found out that they belong to the trivia game Scene It and while they are not super friendly (you can’t just plug it in), you can get the remotes working under Linux and program the keys to do virtually anything you want.  For testing, I used the big button as a panic that would text Alison and two of the little buttons as an on / off switch for a lamp in the room.  I should note that I used a Debian VM on my Windows 7 computer but you should not have a problem on other devices.  

How to get your Microsoft IR Remotes Working:

1. Download the driver: https://github.com/micolous/xbox360bb.  The developer gives pretty straightforward directions in his readme.  The key is having the proper Linux headers installed.  You can find out what kernel you are running with ‘uname -r’.  Special note for Raspberry Pi Raspbian users – getting the 3.6.11+ headers is a pain in comparison to straight Debian. This blog gives a great explanation of the problem and solution.

2. After make, make install and modprobe -v xbox360bb, you should be set.  If you look in your /dev/input/ directory you should have a bunch of js* and event* files.  How exciting, but now what?

3. To figure out what was going on, I installed a few packages with ‘apt-get install jstest-gtk joystick’.  Now under my system tools, I have a Joystick configuration utility.  When I open it up, I see the 4 big button remotes.  If you select one, you can start pushing the buttons and examine how they are mapped.  How exciting, but now what?

4. There are several ways you can interface your new joysticks.  Perl has SDL::Joystick with some sample code (same with c/python/every other language) but the Perl library was the only one I checked out before moving on from the idea of programming something myself.  That is when I stumbled upon TriggerHappy.  With TriggerHappy you can map the joystick buttons to Linux commands or scripts.

After building TriggerHappy, you can use the ‘–dump’ option like

thd --dump /dev/input/event*

to find out which controller button triggers which event.  Once you know this info, you can create the trigger config files to map that event to a command.  You can name your config file anything.conf as long as it is in the /etc/triggerhappy/triggers.d/ directory.

Here is an example of mine (I called it fun.conf):

BTN_THUMBR      1       php ~/somemagic.php
BTN_A   1       php ~/phplight.php
BTN_B   1       php ~/phplightoff.php

The third parameter can be replaced with basically anything – think open browsers, change volume, hit play, shut down, create a server, text your mom, turn on lights, etc.  Check out Twilio’s bash scripts and Open-Zwave socket servers.

The same thd command will run as a daemon with the following command (note that there is a typo on the TriggerHappy README):

thd --socket /var/run/triggerhappy.socket --triggers
/etc/triggerhappy/triggers.d/ /dev/input/event7

I had mapped event7 to my Xbox 360 Green Big Button IR remote. You can add multiple input devices to TriggerHappy as described in their readme.

Have fun!  I will leave you with another storage find:MS-DOS


Leave a Reply