30 November 2009

Fix bricked XOs automatically

I've been getting increasing numbers of requests from donors in the first OLPC Give 1 Get 1, many of whom are just getting around to opening their XOs, to have their laptops repaired. As is now widely known, due to a manufacturing glitch the first few batches of OLPC XO-1s that were shipped to consumers had a faulty motherboard battery holder. This alone wouldn't be a problem, if only two other things hadn't happened at the same time:

  • The XO-1s were shipped with Open Firmware's security enabled. This caused them to have the same anti-theft protection as laptops deployed in the third world, without any of the benefits of a remote killswitch or tracking

  • The XO-1s had a version of OFW which would fail to boot when the clock was below a certain value


The above two issues combined with the manufacturing fault was a recipe for disaster. Owners who discovered this in the first 30 days were able to get a RMA and a working laptop, but OLPC lacked the resources to support those outside of this minimal warranty. I've been running an OLPC repair center, OLPC DC Repair, (charging only minimal fees for labor and shipping) since mid-2008, and have handled dozens of these "unbricking" problems.

The procedure for repairing the above is straightforward and well documented. However, it can be tedious, especially for those who are unfamiliar with the tools involved. Since I needed the programming practice anyway, I decided to write a rudimentary Python script to automate the process.


Thus enters d6.py. d6.py makes it (hopefully) amazingly simple to unbrick your XO, so that you can get up and running as soon as possible. You can clone the git repo, or download it directly (permalink). To download and run in a single command:
python -c "import urllib2; exec urllib2.urlopen('http://dev.laptop.org/git/activities/olpc-contrib/tree/d6.py').read();

Plug in your OLPC Serial Adapter (or one of the compatible alternatives), and run the script as a user which has access to /dev/ttyUSB0 (or as root, not recommended) or change the path inside the script to something suitable to your system. This script is in the alpha state, is poorly documented, and may not handle all edge cases (read: other people's systems) well. I'm not responsible if it kills your cat, lights your XO on fire, or makes your wife leave you, but hopefully it'll be of some use. Expect a GUI shortly.

Limitations:

  • Does not handle all error conditions

  • No command line params

  • Hard-coded path to serial adapter


Therefore, the code does not run on other platforms other than Linux. You might also encounter problems if you're running it on a system with brltty installed, removing it should fix the conflict.

Feedback is more than welcome in the comments.
I've been running an OLPC repair center