Category Archives: Raspbian

Adding custom action to a keycode in XBMC

There are some USB IR remotes out there specifically made to be used in media centers. I bought one of those to setup my parents Raspberry Pi.


It looked like everything worked out of the box with XBMC but then we noticed that the volume down button was not doing anything. So I had to check which keycode was being issued to bind it to the appropiate action in XBMC. You have to activate the debug on XBMC (Settings->System->Debugging) and then pressed the key a couple of times. Then look at the log file (temp/xbmc.log in your userdata directory, which in Linux is ~/.xbmc) for something like this:

18:25:59 T3034951680   DEBUG: OnKey: f14 (0xf09d) pressed, action is ...

You can use cat and grep for that:

$ cat ~/.xbmc/temp/xbmc.log | grep pressed

And there you have your keycode in hexadecimal format. Just convert it to decimal, which in this case is 65197, and then you need to know the name of the action you want to give to that keycode. The list can be found in ButtonTranslator.cpp:

        {"volumedown"        , ACTION_VOLUME_DOWN},

Finally add the key binding in keymaps/keyboard.xml file in your userdata directory:

      <key id="65197">volumedown</key>


Boost low volume in XBMC

AC3 encoded movies usually have very low volume. To fix this edit the /usr/share/xbmc/system/advancedsettings.xml file and add this inside the <advancedsettings>...</advancedsettings> tags:


Change the value until it fits the volume you want and beware because althougt the option says ac3downmixgain it boosts the volume for all codecs.



Fix no video problem in XBMC

Although is recommended using a dedicated media center distribution (raspbmc, openelec or xbian for example) because they come already configured, if you decide to install XBMC on your own in Raspbian you may have problems playing videos. If you don’t see video and it just plays the audio when opening a movie it may be caused because XBMC is trying to use hardware acceleration and you don’t have the MPEG-2 license in your Raspberry Pi.


To use software decoding follow those steps:

  • Go to System -> Settings and then select the “Video” tab.
  • Change the “Settings level” in the lower left corner to “Expert”. This will reveal the “Acceleration” menu option.
  • Now go to the “Acceleration” menu option and change “Decoding method” to “Software”.


You can see a video doing those steps here.

If this doesn’t fix the problem by itself try adding this option to /boot/config.txt:


This enables the use of “_x” firmware files (start_x.elf) and should allow software codecs to work.


Configure Raspberry Pi Composite Video Output for old TVs

Raspberry Pi comes with the composite video output configured to NTSC by default and older TVs aren’t able to detect that and change the format to PAL for example. In that case in a PAL TV youl’ll see the image in black and white:


You can reconfigure the output mode using the “sdtv_mode” option in /boot/config.txt. This are the available options:

  • 0: Normal NTSC
  • 1: Japanese version of NTSC – no pedestal
  • 2: Normal PAL
  • 3: Brazilian version of PAL – 525/60 rather than 625/50, different subcarrier

So for my TV I configured it to 2:


There are more configuration options for composite video in the official RPiconfig documentation.

New script to compile TP-Link TL-WN725N version 2 lwfinger driver in Raspbian

This script overrides the old “Compile and install driver for TP-Link TL-WN725N version 2 in Raspbian“.

I’ve tried it with 3.10.33+ and worked perfectly but it failed for 3.10.24+ (I got the usual “ERROR: could not insert '8188eu': Exec format error“). It would be nice if people could give me their results for different kernel versions.


# Get linux source code, prepare config files and create symlinks
VERSION=`uname -r | awk -F'.' '{print $1"."$2}'`
cd ~
wget${VERSION}.y -O rpi-${VERSION}.y.tar.gz
sudo tar zxf rpi-${VERSION}.y.tar.gz -C /usr/src/
cd /usr/src/linux-rpi-${VERSION}.y/
sudo bash -c "zcat /proc/config.gz > /usr/src/linux-rpi-${VERSION}.y/.config"
# In the next step you may be prompted questions about the configuration
# if your /proc/config.gz does not answer them (new features for example)
sudo make oldconfig
sudo make modules_prepare
sudo wget
sudo ln -s /usr/src/linux-rpi-${VERSION}.y /lib/modules/`uname -r`/source
sudo ln -s /usr/src/linux-rpi-${VERSION}.y /lib/modules/`uname -r`/build
# Optional
#sudo ln -s /usr/src/linux-rpi-${VERSION}.y /usr/src/linux-`uname -r`
#sudo ln -s /usr/src/linux-rpi-${VERSION}.y /usr/src/linux

# Get driver source, compile, install and load it
cd ~
git clone
cd rtl8188eu
# This wil take around 20 minutes
make all
sudo make install
# After this step you should have those new files installed:
# /lib/modules/`uname -r`/kernel/drivers/net/wireless/8188eu.ko
# /lib/firmware/rtlwifi/rtl8188eufw.bin
sudo modprobe 8188eu

# Remove driver and linux source code to recover some space (around 700MB)
# Leave those lines commented if you want to keep the code for future compilations
#sudo rm /lib/modules/`uname -r`/source
#sudo rm /lib/modules/`uname -r`/build
#sudo rm /usr/src/linux-`uname -r`
#sudo rm /usr/src/linux
#sudo rm -R /usr/src/linux-rpi-${VERSION}.y
#cd ~
#rm rpi-${VERSION}.y.tar.gz
#rm -R rtl8188eu

TP-Link TL-WN725N