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

  • It seems like your question was cut off halfway. I recommend editing this post. Mar 31, 2013 at 16:06
  • It seems that the bus is selected through the /etc/modprobe.d/raspi-blacklist.conf file. I assume that you could check which one was commented out? Apr 1, 2013 at 4:22

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.