Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

Adafruit_I2C does not parse the Pi Revision info properly #48

@wallywheely

Description

@wallywheely

There is a static method in Adafruit_I2C class that reads the 'revision' info from /proc/cpuinfo.

No matter if the board is at rev 1 (first model with 256 MB) OR rev 2 (second model with 512 MB), the method will return the same value ('1').

This will cause a problem in the class initialization for board rev 2.

I suggest to change this method (getPiRevision in Adafruit_I2C) from:

with open('/proc/cpuinfo', 'r') as f:
for line in f:
if line.startswith('Revision'):
return 1 if line.rstrip()[-1] in ['1', '2'] else 2

to:

with open('/proc/cpuinfo', 'r') as f:
for line in f:
if line.startswith('Revision'):
return line.rstrip()[-1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions