Raspberry Pi HDMI output: configuring the correct resolution for a crappy TV


edit the /boot/config.txt file to disable EDID detection and force the correct HDMI group and mode. Namely, add these lines:

where ‘GROUP’ is the HDMI group number (1 or 2) and ‘MODE’ is the HDMI mode number, discussed below.

To force HDMI output if it isn’t detected correctly, and disable CEC (assuming your crappy TV doesn’t support it), also add:

For stability’s sake, I also turned off overclocking by setting these variables :


I’ve recently come back to playing with my Raspberry Pi (Model A). I had set it up a while ago as a home theatre PC using RaspBMC. It was OK, but I lost interest after a while due to other commitments. When I came across XBian a few days ago, I thought I’d give it a go.

XBian is wonderful.

The only problem was the resolution was defaulting to 1280×768 @ 60Hz. My television is a crappy AWA “720p” HDTV purchased from Big W years ago. It has served me well, but it has all of the quirks of a cheap TV. The main problem here, though, is that the native resolution is actually 1366×768 @ 60Hz. No matter what settings I changed within any of the XBian menus (within XBMC or the xbian-config startup script), the video output would break in some way when changes were made. In particular, when the 1280×768 resolution was used, there was a vertical band of corrupt video data displayed on the right of the screen – otherwise, everything looked great. The TV would even display an overlay telling me that it was using the 1366×768 @ 60Hz resolution, just to goad me.

How I changed the HDMI out resolution:

The Embedded Linux Wiki has a thorough entry on configuring the RPi, especially for video. After hours of searching and tweaking, the sentence that caught my attention was “hdmi_ignore_edid Enables the ignoring of EDID/display data if your display is a crappy Chinese one”.

To find your supported video modes, ssh (or directly login) into your RPi and execute the tvservice command.

tvservice -m CEA displays the HDMI CEA group (group 1)

tvservice -m DMT displays the HDMI DMT group (group 2)

My problem was that the native 1366×768 resoltion of my AWA TV wasn’t shown. WHAT!?! My TV was telling me that it was using it, but the RPi didn’t know about it. *sigh*

This turns out to be the EDID issue mentioned above. I forced EDID detection off by adding hdmi_ignore_edid=0xa5000080 to my /boot/config.txt file (as per the ELinux Wiki) and rebooted my RPi.

Running the tvservice commands again, the resolution I was after was listed in HDMI DMT mode (group 2) as mode 81. Note that this is different to a few of the 1360×768 resolution options, such as modes 39 and 40. I accidentally tried these first and they defaulted back to 640×480.

I then added this group and mode to config.txt so by adding these lines:


and the resolution worked on reboot! ^__^

I then noticed that if my TV wasn’t on and set to the HDMI input on boot, the HDMI output wouldn’t work; the TV wouldn’t see the signal. I guess this was due to the poor communication from the TV to the RPi, as for the EDID issue above. So, I forced HDMI output, regardless of whether the TV told the RPi that it could do it, and disabled any CEC support for good measure, by also adding these lines:


and the HDMI output worked even if the TV was off or set to a different input at the RPi boot time. Perfect!

I had also noticed some instability with my system – many different issues. To be sure it wasn’t the default XBian overclocking, I turned all overclocking off by also setting:


which seemed to maintain a more stable system (purely anecdotal evidence so far).

This left me with a final config.txt of:

initramfs initramfs.gz 0x00a00000

(Note: your config.txt may look different depending on other settings you require.)

These tricks should also work for any other RPi distro using the /boot/config.txt boot time configuration, such as Raspbian, RaspBMC, …

Hope that helps anyone having similar issues with achieving the correct HDMI resolution from a Raspberry Pi on a cheap TV.


Emacs: saving and loading desktop configurations with workgroups.el

I’ve been using Emacs for some time, using it mainly for document preparation (LaTeX), config file editing and plain text notes. So far, I’ve managed to get by with the default modes of Emacs 23. Wanting to port my Python scripting process over to Emacs, having used Eclipse for some time and not really liking it too much, I’ve found that I just can’t handle having to reconfigure my Emacs desktop/workspace on every session, especially where multiple frames are concerned.

Enter workgroups.el.

According to its github page, workgroups allows you to: store an unlimited number of window configs, save window configs to disk, load them from disk, kill and yank window configs, and provides animated window config morphing, frame reversing and window movement, a concept of “base” and “working” configs for maximum flexibility, and lots of other stuff.

When I first started using workgroups, I thought the saving and loading of configurations was broken. It’s turns out I just wasn’t using it properly.

The following is what I’ve learned about using the basics of workgroups, especially with saving and loading configurations…

The first workgroup can be created from the current session using <prefix> c, where the current window configuration will be saved to the workgroup name you supply.

Subsequent workgroups can be created using<prefix> c in the same way, but will reset the session to display only one frame containing the scratch buffer. I didn’t appreciate this for the first few times I used it, assuming that the current configuration I could see would be saved to the new workgroup name I supplied, just as for the first configuration. Not so. A fresh workgroup is created, ready to be configured from scratch.

Saving a set of workgroups to a file for later restoration requires you to update the base configuration via <prefix> U. The base configuration is what is loaded from the workgroup save file, not the working configuration. See the definitions of these configs.

After this, the base configuration can be saved to a file via <prefix> Ctrl+s and loaded manually via <prefix> Ctrl+l. Saving and loading can be automated within the .emacs file, say, as per the documentation.

Once I figured out the way new workgroups are created and the way the base configuration was saved, I found workgroups a joy to use. As is often the case, it was a case of RTFM. Thankfully, the documentation for workgroups is tight.

CUPS print server administration in CrunchBang/Debian Linux

In trying to reconfigure my printer configuration in CrunchBang Statler, I had to change the default printer within the CUPS print server configuration. This is because I’m using a custom print command to print from acroread. In acroread, under Printer -> Name, I’ve chosen custom, with this command as input:

lp -o sides=two-sided-long-edge

which ensures I can print duplex to my particular printer, a networked Lexmark E260dn, which incidentally has relatively good linux compatibility.

Somewhere along the line, something broke and I had to re-check that this printer was both in the list of printers known to CUPS and that it was set as the default.

The problem arose when opening the CUPS web GUI (found by pointing your browser to the default address: localhost:631) and trying to do administrative tasks, e.g., Printers -> Manage Printers; it would ask for authentication details (I used my local user details) and then deny me.

It turns out that the problem is due to my user not being added to the lpadmin group. To add a user to this printer group, as superuser, execute:

adduser your_username lpadmin

Reloading the CUPS web GUI then allows the user to make admin changes, such as finding printers and setting them as defaults. Solved.

Install Darktable on Debian Squeeze

There are a range of articles about the place describing how to install Darktable on Debian Squeeze. The problem arises when you find that Darktable is too new to have been incorporated into the Debian stable repository. Some articles suggest installing from source, such as the official Darktable site, but often others suggest using the Ubuntu PPA repositories. If you aren’t 100% sure about what the PPA install is doing to your system, it is likely a poor choice: Ubuntu and Debian have deviated quite a bit when it comes to the way in which packages are installed, where their configuration files are kept, the default paths used, etc. If you want to install from source, you’ll have to manage the dependencies manually. I’m not a big fan of that.

So… how do you install Darktable in the easiest and possible safest way under Debian Squeeze?

Answer: Debian Backports

Backports are programs that have been compiled from source using dependencies from the stable release; this is not always possible, but it is for Darktable!

The page for the Debain Squeeze backport for Darktable can be found here, although you don’t need it.

As per the official backports instructions, you simply have to add the backports repos to your sources.list. I did this:

sudo nano /etc/apt/sources.list

Added line to end of file:

deb squeeze-backports main

Update apt sources:

sudo apt-get update

Installed Darktable!

sudo apt-get install darktable

That was all it took for me to install a working Darktable to my Debian Squeeze install 😀

Aside: In order to force a package to install from backports, you can use:

sudo apt-get -t squeeze-backports *package-name*

Amaysim UNLIMITED on an iPhone 4

My previous (expensive) mobile contract recently came to an end. I took this opportunity to sign up with Amaysim. Their plans are cheap, non-committal, convenient and allow you to easily transfer your existing number. I chose to go with their UNLIMITED plan because of the excellent value… and because the plan’s name is in capital letters; that kind of marketing just can’t lose. For AU$39.90 per month, the Amaysim UNLIMITED plan gives you unlimited standard calls and SMS (including mobile calls) and 4GB of data (more than I could ever use in a month). Not only that, but Amaysim also offer iPhone tethering for free, and by default with new plans. The Amaysim sevices use the Optus 3G network. With all that, I think it’s excellent value.

After activating the service and paying my first lot of credit (pre-paid – there is a post-pay option), I was up and running in a couple of days. The only hitch was getting the 3G data connection to work on my iPhone 4…

The answer for this is the same as for getting any alien data service working on a smart phone: change the access point name (APN) profile. Amaysim actually provide instructions for changing your APN:
It seems, then, that updating the APN is easy on configurable phones, e.g., HTC. The iPhone, however, is always more tricky… more closed.

The Amaysim troubleshooting page suggests updating the phone via iTunes in order to get the latest APN for the inserted SIM. I hate iTunes and avoid it whenever I can. A quick and easy alternative is to open the iPhone’s Safari browser and point it to: This site can automatically generate an APN for you based on the SIM’s service provider.

I found that, for this Amaysim plan, these setting worked:
– Go to in Safari.
– Go to Custom APN
– Profile name “internet”
Name: “Amaysim”
– Leave the password blank
Carrier: “AU – Optus”
– Select Create profile
– Select Install
– Select Install Now

That’s it! The APN should install and open up the Optus 3G connection for the Amaysim SIM card.

When I first did this, I received an error message: The UUID for the profile “APN carrier settings” is not unique. This is easily fixed by removing any existing APN profiles by:
– Settings
– General
– Profile (APN Carrier Settings)
– Remove
– Follow steps above to install custom APN

Good luck!

Fake Microsoft XBox 360 wireless controller adapter in Windows 7 64-bit

I recently bought an XBox 360 wireless control adapter on eBay. It seems the only way to buy an official Microsoft adapter is via an official retailer and I couldn’t find any on eBay. The adapter I ended up purchasing was, and I knew it was, a cheap(ish) Chinese knock-off. I had read around enough to know that it should work, but hadn’t realised how varied people’s experiences had been.

The adapter I bought was from the eBay store Console Mate (a popular Australian, NSW, power seller) and was listed as “WIRELESS GAMING RECEIVER – Xbox 360 Controller on PC”. the store was easy to deal with and the device arrived in under a couple of days via express post.

A genuine wireless adapter will have “Microsoft” written on the top of the adapter itself. These knock-offs (at least mine) say only “XBox 360” with no branding, copyright, etc. Otherwise, they look like the real deal.

My issues began when trying to install the adapter in an install of Windows 7 64-bit. I tried using the software bundled with the device, but had the same experience with the official software (which I ended up getting to work). Using the driver on the CD that came with the adapter, I kept getting the error message:
Windows found driver software for your device but encountered an error while attempting to install it. PC Wireless Gaming Receiver. The system cannot find the file specified.
I then turned to the official drivers. After installing the official Microsoft software ( I then plugged the device into a USB port. My install of Windows 7 64-bit couldn’t install the device; ultimately, the adapter always ended up being listed as “Unknown Device”.

Googling will bring up a few solutions for this issue, but I found only one works. These are the steps I took to install the drivers for the device:
– Install the official software:
– Start -> Search for “Device Manager” -> Open it
– Find the “Unknown Device” -> right click -> properties
– Driver -> Update driver -> Browse my computer -> Let me pick from a list of device drivers on my computer
– Double click “All devices” -> Search for “Microsoft” in the left pane and select it -> Search for “XBox 360 Wireless Receiver for Windows Version: 2.1xxx”
– Choose “Next” and complete the install

The “Unknown Device” should then disappear from the devices list. I was then able to sync my existing wireless XBox 360 controller (which came with my XBox 360 console) with the adapter by pressing the large “X” button on the controller to wake it (it should start blinking), then pressing the button on the adapter (its light should start blinking), then pressing the receiver sync button on the controller (a small button in between the left shoulder button and the central top port of the controller). After a few seconds, the controller and adapter lights stopped blinking, leaving the top left light of the controller lit (the Player 1 state). Viola! Done.

These links helped me:

I also highly recommend XPadder:
It allows you to fully customise the way the controller interacts with the OS and applications.

Acroread printing in Crunchbang #! Linux: “The print process returned error.”

I’m currently using the excellent Crunchbang (#!) Linux (ver. Statler), trying to print a document via acroread (GUI) with little luck. After a couple of hours trying to figure out why acroread was throwing me the error:
The print process returned error. Please check whether the printer is connected to the machine.
I finally figured out it was because acroread is configured by default to use the lpr command which, at least for my #! Statler install, is not installed and configured for CUPS control by default. Instead, #! Statler uses the lp command for CUPS printing from the command line. You can force acroread to use lp by default by creating a custom print command:
File -> Print -> Name -> Custom
and simply type lp into the custom command field. Extra commands can be fed to lp via tags and arguments as you would in the command line.

Of course this is an issue with acroread and not Crunchbang 🙂