Skip to content

installing wiringPi on openelec

I’ve been having fun with Raspberry Pis recently. I’ve got one setup with openelec that I bring on camping trips, with some movies on a USB hard drive. By default, the pi doesn’t provide enough power on it’s USB ports, so I had to use an external USB hub. This meant two AC adapters, and lot more cabling. After some research, I found it’s possible to increase the power output on the USB ports (lock in auxillary power?) from 600mA to 1.2A. Testing & Setting the USB current limiter on the Raspberry Pi B+ has the details; you can use gpio to temporary bump the power, and then edit config.txt to retain that setting on reboot.

gpio is part of wiringPi, which has a pretty straightforward “git clone then build” installation story, but openelec is pretty locked down; no apt-get. To get a working copy of gpio, I followed the install instructions on another pi, then copied the compiled output over. But gpio relies on some shared C libraries, and didn’t run for me:

    ./gpio: error while loading shared libraries: cannot open shared object file: No such file or directory

To see which shared libraries gpio needs, we can run ldd:

    /lib/ (0xb6ef2000) => not found => not found => /lib/ (0xb6ed2000) => /lib/ (0xb6e5f000) => /lib/ (0xb6d39000)
    /lib/ (0xb6efc000)

So it needs to find and the wiringPi compiled output has wiringPi/ and devLib/, so we make a directory with those symlinked in, and then tell C to look for shared libraries there.

    mkdir /storage/lib
    ln -s /storage/wiringPi/wiringPi/ /storage/lib/
    ln -s /storage/wiringPi/devLib/ /storage/lib/
    export LD_LIBRARY_PATH=/storage/lib:$LD_LIBRARY_PATH

Now gpio can find it’s libraries. I was able to test my usb hard drive, and it works with 1.2A!