Cheap remote with rpi

I bought a Raspberry Pi ( with the intention on of installing XBMC ( on it.

Raspbmc was straightforward to install.  The issue I had was with the remote control.  I have a cheapo MCE remote with a USB IR receiver and I was hoping it would work straight out of the box, but alas it didn’t.

Edit: Here’s the remote:

At first I thought it was the weird mouse pointer/arrow mode blue button, but after some trial and error, I realized that wasn’t it.

After a little digging, I found a solution for Linux:

I verified the solution on my Ubuntu box by cloning the git repository locally (, rebuilding the module, installing it, and executing those modprobe commands.

I figured it would be just as easy on raspbmc, but unfortunately, the headers for the rpi kernel (3.1.9+) aren’t published in the regular repository.  I think raspbmc is based on rasbian (  It didn’t make sense to try and mix-and-match headers, so I decided to rebuild the kernel from scratch.

I had never rebuilt a kernel from scrach, or used that fancy “make menuconfig”, or chroot so I thought I’d give it a shot.  The rpi is made for tinkering, right?

Luckily, the entire process is fairly well documented on the raspbmc site ( but I just wanted to share my step-by-step process.

1. Start with a regular Ubuntu box

The kernel build procedure for raspbmc uses a cross-compiler so it builds a lot faster than building it on the rpi itself.  I didn’t time the full compilation process, but I think it’s on the order of 10’s of minutes, not hours.

I don’t remember if I had to install any extra packages before building, but just in case, I would suggest at least this:

sudo apt-get install build-essential

2. Get the build filesystem

The instructions are here:

My ubuntu commands were something like:

cd ~
mkdir target
cd target
sudo tar -xzf ../buildfs-bcm_rootfs-raspbmc*
cd ..
sudo cp /etc/network/interfaces target/etc/network/interfaces
sudo cp /etc/resolv.conf target/etc/resolv.conf
sudo mount proc -t proc target/proc
sudo chroot target/

3. Get the kernel source and build … all in one go!

A script exists to do all this at once.

# At this point, you should be in the new root file system, as root
sh 4

This downloads the latest kernel source, applies the raspbmc specific patches, and rebuilds. I got a bunch of these errors at the end, but I think they can be ignored:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_COLLATE = "C",
        LC_NUMERIC = "C",
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

If this works, congrats, you’ve built a Linux kernel.  Nice.

To be continued … (get module source, create menconfig entry, change usbhid from built-in to module, add new module, rebuild, upgrade pi, edit rc.local to rmmod and then modprobe)


Option to change HTTP server port. You can change the port used by the Stoker HTTP server by using a menu option on the front panel, under “Main -> System Info -> Port”.

The range of valid ports is 1 – 65535. This is fairly large range so just hold down the + or – buttons and it should jump from 10’s to 100’s to 1000’s.

The default port is 80.


IP address issues

There have been some issues found for the new 2.7.0.x releases. These have been removed temporarily.

The issues result in the Stoker ceasing to be operational immediately after upgrade. If you have upgraded and the Stoker is working, then this warning can be ignored.

Update: The problem seems to be that the Stoker sometimes fails to acquire an IP address after an update. Everything else is functioning.


Fix blower disassociation on web page

Option for outputting the version number of firmware from JSON. Example:

The output:

        { "stoker" : {
            "version" : "",
            "sensors" :
                    { "id" : id, "name" : name, "al" : al, "ta" : ta, "th" : th, "tl" : tl, "tc" : tc, "blower" : blower_id },

            "blowers" :
                    { "id" : id, "name" : name, "on": on },

This is compatible with JSONP so this is also valid:



A few minor updates for speed.

New favicon.ico

JSONP support. The firwmare will now allow the JSON GET request to specify a callback parameter. Example:

The Stoker will send back the JSON response wrapped in parseResponse.



Twitter and static IP addresses

When using the Twitter functionality with a static IP address on the Stoker, please make sure all the IP-related fields are filled in properly. The four fields are:

  • IP address
  • Subnet mask
  • Gateway
  • DNS server

These settings can be found on a Windows machine using the command ipconfig /all at the command prompt. The /alloption is necessary to show the DNS server. This should be run on the same physical network the Stoker is on.


Update Twitter capabilities to handle’s retirement of Basic Authentication in favor of OAuth.

Twitter is migrating to a new authentication method called OAuth. This is a clever algorithm that allows bits of user data (pictures, videos, tweets, etc) to be shared between sites and applications without having to share usernames and passwords.

Unfortunately, this is all a bit too much for the stoker. The big roadblock is implementing the SSL support used by the algorithm. SSL is the technology used to make sure all your online purchases are secure.

The solution I’ve found is to use a service provided by called MyAuth API Proxy. This acts as a middle man between the Stoker and Twitter.

So previously, basic authentication was used by the Stoker to send tweets:

Now twitter is requiring OAuth. The fat arrow is an attempt to show a more robust connection between the client and twitter.

The solution is the middleman

A quick how-to

  • Go to and logon with your Stoker only account (you are using your dedicated stoker account, right?). Keep the tab open.
  • In a new tab, go to click on “Sign in with Twitter”
  • This will redirect you to and you will be presented with a Deny/Allow page. Allow.
  • This will then redirect you back to Click on “Activate”.
  • Choose a new password. DO NOT USE YOUR TWITTER PASSWORD!
    • Although the Stoker is dependent on for OAuth, one of the main ideas for OAuth is never having to give other sites your password. In the spirit of that idea, you should choose a separate password for this
  • Open up the twitter page on the stoker (http://the_stoker_ip_address/twitter.html)
  • Enter the new password into the password field. Click Save Changes.
  • Done.


  • Disable twitter on the Stoker
  • AND/OR Disable the account on by clicking “Make Inactive”
  • AND/OR Disable the authorization on by going to “Settings” and then “Connections” and then “Revoke Access” for MyAuth API Proxy

A couple of notes

During this whole process, you should have only used your true twitter password once to log onto This is the whole point. So now, not even the Stoker knows the twitter password. The system works.

The one gotcha is that we are now dependent on to honor our privacy and not do anything malicious with the regular temperature updates. Sounds stupid, I know. I mean, it’s all public anyway. But just something to consider.