We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0eb6058 + 797bbbe commit a174e7cCopy full SHA for a174e7c
adafruit_platformdetect/board.py
@@ -116,7 +116,21 @@ def _pi_rev_code(self):
116
if self.detector.chip.id != chips.BCM2XXX:
117
# Something else, not a Pi.
118
return None
119
- return self.detector.get_cpuinfo_field('Revision')
+ rev = self.detector.get_cpuinfo_field('Revision')
120
+
121
+ if rev is not None:
122
+ return rev
123
+ else:
124
+ try:
125
+ with open("/proc/device-tree/system/linux,revision", "rb") as revision:
126
+ rev_bytes = revision.read()
127
128
+ if rev_bytes[:1] == b'\x00':
129
+ rev_bytes = rev_bytes[1:]
130
131
+ return rev_bytes.hex()
132
+ except FileNotFoundError:
133
+ return None
134
135
# pylint: disable=no-self-use
136
def _beaglebone_id(self):
0 commit comments