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. – xxmbabanexx Mar 31 '13 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? – xxmbabanexx Apr 1 '13 at 4:22

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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