Open jamesecc opened 7 months ago
I can confirm this error on the RPI5 which has 2 display/camera ports.
Plugging into Display 1 creates 4-0045 and into Display 0 creates 6-0045 - The 10-0045 seems to be a Pi4 artifact which only has 1 display port.
My messy fix to rpi_backlight-2.6.0 init.py (Tested on Pi5 but not tested on Pi4 or Pi3 with earlier versions of Raspbian) is:
_BACKLIGHT_SYSFS_PATHS = { BoardType.RASPBERRY_PI: ( "/sys/class/backlight/4-0045/" if Path("/sys/class/backlight/4-0045/").exists() else "/sys/class/backlight/6-0045/" if Path("/sys/class/backlight/6-0045/").exists() else "/sys/class/backlight/10-0045/" if Path("/sys/class/backlight/10-0045/").exists() else "/sys/class/backlight/rpi_backlight/" ), BoardType.TINKER_BOARD: "/sys/devices/platform/ff150000.i2c/i2c-3/3-0045/", BoardType.TINKER_BOARD_2: "/sys/devices/platform/ff3e0000.i2c/i2c-8/8-0045/", BoardType.MICROSOFT_SURFACE_RT: "/sys/class/backlight/backlight/", }
This library will probably not work correctly if you plug in 2 displays.
Just ran into the same issue, and came to the same conclusions as the posters above.
If anyone wants to make a PR that would be most welcome :)
There already is dynamic detection of which base directory to use, this should be simple to add.
I've just installed my official raspberry pi touchscreen onto my new raspberry pi 5. I kept getting this error:
After some digging around a bit it looks like neither of these two folders exist on my rpi5:
/sys/class/backlight/rpi_backlight
/sys/class/backlight/10-0045
Instead, there is a folder called
/sys/class/backlight/4-0045
I was able to get it working when I changed the __init__.py files as follows:
Whilst this worked for me, I have no idea how to implement a general solution for all pi models.