I'm writing a small application that could run on version one Pi ( mine ) or a version two ( co-workers ) that uses the I2C bus.
Since the I2C bus is different depending on the version, I was wondering how I programmatically detect which is which so neither of us have to mess with changing any settings when we
1 Answer 1
Gordon Henderson's wiringPi project includes a function piBoardRev
which does what you want; looking at the code, it checks /proc/cpuinfo
for a "Revision" line and works on that, so you might find it easier to do the same yourself.
There's a discussion on the Raspberry Pi Forum.
/etc/modprobe.d/raspi-blacklist.conf
file. I assume that you could check which one was commented out?