Raspbian Stretch and GPIO Utility Fix

If any of you have installed the new “Stretch” version of Raspbian on the Raspberry Pi, you may have noticed a slight issue with the wiringPi GPIO utility.

gpio i2cd

will complain of a missing i2cdetect even though it is actually there

which i2cdetect

Well, here’s a fix:

The problem: When searching for i2c devices, you might use “gpio i2cd” which merely calls i2cdetect with the right parameters for the Raspberry Pi. Well, except it doesn’t. Apparently that has been the case since December 2016 – I was the first to report it and this will be fixed soon. In the meantime, if you have this problem, here’s the fix – and thanks due to Gordon Henderson (I did this as PI user in the PI directory):

Firstly – remove wiringPi

sudo apt-get purge wiringPi

Grab the source

cd
git clone git://git.drogon.net/wiringPi

compile it….

cd wiringPi
./build

Check

hash -r
gpio -v

and assuming all is ok, fix the bug:

cd gpio
nano gpio.c

Around line 59 you should see this:

#define I2CDETECT "/usr/sbin/i2cdetect"

change it to:

#define I2CDETECT "/i2cdetect"

Recompile and install

make
sudo make install

and test

gpio i2cd

All done!

Facebooktwitterpinterestlinkedin

12 thoughts on “Raspbian Stretch and GPIO Utility Fix

  1. Make a symbolic link at /usr/sbin/i2cdetect pointed at the real executable at /i2cdetect:

    ln -s /i2cdetect /usr/sbin/i2cdetect

    …and the unmodified “gpio” code should now be able to find it.

    More information about symlinks:

    https://kb.iu.edu/d/abbe

  2. there are now 3 different “fashions” of raspbian, from the smaller to the fully featured one… so now you can have a desktop setup without all the clutter of the previous versions…:
    Raspbian Stretch Lite
    Raspbian Stretch with desktop
    Raspbian Stretch with desktop and recommended software

      1. i ALWAYS use lite as i don’t want graphics AT ALL 🙂
        yes, it has all we need for your script, of course

        but the real deal here is the new intermediate gui version, so you don’t need to remove all those *office, games, wolfram, etc, while still having a graphical environment…

            1. I removed all the big unwanted crap with the script and tuned off the desktop – ages ago. I use 16GB uSDs so loads of space one WolfRam and Office are gone. I didn’t use is elite for fear it was missing utils. Thiswas all some time ago – I’ve been cloning ever since.

Comments are closed.