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: libwiringPi.so: cannot open shared object file: No such file or directory

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

    /lib/libarmmem.so (0xb6ef2000)
    libwiringPi.so => not found
    libwiringPiDev.so => not found
    libpthread.so.0 => /lib/libpthread.so.0 (0xb6ed2000)
    libm.so.6 => /lib/libm.so.6 (0xb6e5f000)
    libc.so.6 => /lib/libc.so.6 (0xb6d39000)
    /lib/ld-linux-armhf.so.3 (0xb6efc000)

So it needs to find libwiringPi.so and libwiringPiDev.so. the wiringPi compiled output has wiringPi/libwiringPi.so.2.0 and devLib/libwiringPiDev.so.2.0, 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/libwiringPi.so.2.0 /storage/lib/libwiringPi.so
    ln -s /storage/wiringPi/devLib/libwiringPiDev.so.2.0 /storage/lib/libwiringPiDev.so
    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!

4 Comments