File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
src/adafruit_blinka/microcontroller/generic_linux Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -15,14 +15,15 @@ def _get_gpiochip():
15
15
used for userspace GPIO access.
16
16
"""
17
17
for dev in Path ("/sys/bus/gpio/devices" ).glob ("gpiochip*" ):
18
- drivers = set ((dev / "of_node/compatible" ).read_text ().split ("\0 " ))
19
- # check if driver names are intended for userspace control
20
- if drivers & {
21
- "raspberrypi,rp1-gpio" ,
22
- "raspberrypi,bcm2835-gpio" ,
23
- "raspberrypi,bcm2711-gpio" ,
24
- }:
25
- return lgpio .gpiochip_open (int (dev .name [- 1 ]))
18
+ if Path (dev / "of_node/compatible" ).is_file ():
19
+ drivers = set ((dev / "of_node/compatible" ).read_text ().split ("\0 " ))
20
+ # check if driver names are intended for userspace control
21
+ if drivers & {
22
+ "raspberrypi,rp1-gpio" ,
23
+ "raspberrypi,bcm2835-gpio" ,
24
+ "raspberrypi,bcm2711-gpio" ,
25
+ }:
26
+ return lgpio .gpiochip_open (int (dev .name [- 1 ]))
26
27
# return chip0 as a fallback
27
28
return lgpio .gpiochip_open (0 )
28
29
You can’t perform that action at this time.
0 commit comments