A few years ago, I used to use an original Xbox as an XBMC box, it recently occurred to me that there was a perfectly good 500GB hard drive sitting in there doing nothing, so I bought a hard drive caddy and decided to salvage it.
It’s not just a case of pulling the old drive out and putting it into the hard drive enclosure, which I found out the hard way. You first have to unlock the Xbox drive, as for some reason, Microsoft decided that they would lock Xbox hard drives using ATA passwords.
This usually means just booting the Xbox, selecting unlock hard drive from the settings menu of your Xbox dashboard and you’re done. However, I didn’t have a controller, or DVD remote to control the menus (both lost somewhere), though my Xbox does still have the DVD IR receiver plugged into the front. I had the IR receiver, but no remote to control it with. No problem.
I took my Arduino Uno, and built a simple circuit with an IR LED and a resistor. Then I installed the excellent IR library for Arduino written by Ken Shirriff, I’ve used this library in a few projects and it’s fantastic.
Now, how to interface with the Xbox? As people with universal remotes will know, you need the IR codes specific to the device you want to control, the LIRC project maintains a database of IR remote codes, so I found their entry for the Xbox here.
The sendRaw function of the IR library takes an unsigned int array of the length of times for the LED to flash on and off, how can we work out what values to put in this array based on the LIRC file?
Ken published an excellent breakdown of the how LIRC files work here, which helped me construct the arrays needed to work some simple commands.
Basically the HEX number in the LIRC file corresponds to a binary string, and at the top of the file it tells what pattern of IR flashes a ‘1’ corresponds to, and what pattern a ‘0’ corresponds to. Start with the ‘header’ values, add the values for the ones and zeros, and finish with the ptrail value. Note that the values in the file seem oddly specific. This is because they’re measured from real remotes, and real IR recievers aren’t ideal. I just rounded the values for easiness sake.
Pretty soon I had a simple Arduino sketch that takes values from the serial monitor and in turn sends the proper code to the LED. It’s not pretty, but it does the trick.
In the very, very off-chance that someone else needs to do something like this, or wants to create a remote control for their Xbox, I’ve added the code below, it only implements Up, Down, Left, Right, Select, Play and Back, but if you need extra buttons, they should be easy to work out based on what’s there already and the LIRC file.
Eventually, after updating my Xboxes ‘dashboard’ software (UnleashX) to the ‘latest’ version (released about 5 years ago) I was able to unlock the hard drive, put it in my new enclosure and reformat it, and done. Brand new old hard drive.