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!
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
Never installed lite.. does it still have all the command line utils?
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…
Magic, thanks for the feedback – that will help others. Desktop version with no fluff is probably good though I never use the deskstop now, since rpi-clone.
If you don’t use desktop why not using Lite? 😬
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.
Possible problems, in case we need to address these in script…
http://madlab5.blogspot.it/2017/08/raspbian-stretch-renames-network.html
Thanks Mike – that would likely also do…. the utility will be fixed soon anyway now the author knows there’s a bug.
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
can’t understand why on earth a binary should be in main / directory…
Wouldn’t a symlink solve this too?
More specific Mike please, I’m not a Linux expert.