waveform80 / rpi-lgpio

A compatibility shim for lgpio emulating the RPi.GPIO API
https://rpi-lgpio.readthedocs.io/
Other
13 stars 8 forks source link

Small bug in _get_gpiochip_num() #20

Open Pako2 opened 3 months ago

Pako2 commented 3 months ago

Your library is great. For example, for projects that use the luma.core library (for SPI displays it depends on RPi.GPIO). I've been experimenting with it now and I've come across a small bug. In the routine "_get_gpiochip_num()" is this snippet:

 user_gpio_drivers = frozenset((
 'raspberrypi,rp1-gpio',
 'raspberrypi,bcm2835-gpio',
 'raspberrypi,bcm2711-gpio',
 ))

I found out that in my case (RPi4, bookworm) none of the frozenset items correspond (I have the value 'brcm,bcm2711-gpio' for gpiochip0). In the end it doesn't matter because it returns 0 anyway. However, I tried adding 'brcm,bcm2711-gpio' entry to frozenset and it works fine.