File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 11"""Detect boards."""
2+ import os
23import adafruit_platformdetect .chip as ap_chip
34
45# Allow for aligned constant definitions:
@@ -175,6 +176,12 @@ def __init__(self, detector):
175176 @property
176177 def id (self ):
177178 """Return a unique id for the detected board, if any."""
179+ # There are some times we want to trick the platform detection
180+ # say if a raspberry pi doesn't have the right ID, or for testing
181+ try :
182+ return os .environ ['BLINKA_FORCEBOARD' ]
183+ except KeyError : # no forced board, continue with testing!
184+ pass
178185
179186 chip_id = self .detector .chip .id
180187 board_id = None
Original file line number Diff line number Diff line change @@ -19,9 +19,15 @@ def __init__(self, detector):
1919 self .detector = detector
2020
2121 @property
22- # pylint: disable=invalid-name
23- def id (self ):
22+ def id (self ): # pylint: disable=invalid-name,too-many-branches,too-many-return-statements
2423 """Return a unique id for the detected chip, if any."""
24+ # There are some times we want to trick the platform detection
25+ # say if a raspberry pi doesn't have the right ID, or for testing
26+ try :
27+ return os .environ ['BLINKA_FORCECHIP' ]
28+ except KeyError : # no forced chip, continue with testing!
29+ pass
30+
2531 platform = sys .platform
2632 if platform == "linux" :
2733 return self ._linux_id ()
You can’t perform that action at this time.
0 commit comments