Upstream, there are plans to change the user's GPIO chip device to gpiochip0 by default (and allow some customization generally). This a Good Thing (tm) but will necessarily break the lazy method by which rpi-lgpio (and, for that matter, gpiozero) derive the gpiochip device.
To preserve compatibility with any kernels still using gpiochip4, but also to account for customization in the future, we should do something a bit more intelligent here (the following is a refinement of my vague thoughts from 2AM on the other bug):
If a gpiochip is specified explicitly, use it. If it fails, die with exception (don't second-guess explicit requests)
If a gpiochip is not specified explicitly, find first gpiochip with a driver in the set {rpi1-gpio, bcm2835-gpio, bcm2711-gpio} and use that
If none can be found, use gpiochip0
If that fails, die with exception
That should be simple (and quick) enough for now. If we need something more complex, the search case can be iterated on (if, for example, there are multiple GPIO devices with the requisite driver), but let's not go down that road unless we have to.
Marking as a bug because, although this doesn't break yet, it's evidently going to once this change lands in the upstream kernel.
Upstream, there are plans to change the user's GPIO chip device to gpiochip0 by default (and allow some customization generally). This a Good Thing (tm) but will necessarily break the lazy method by which rpi-lgpio (and, for that matter, gpiozero) derive the gpiochip device.
To preserve compatibility with any kernels still using gpiochip4, but also to account for customization in the future, we should do something a bit more intelligent here (the following is a refinement of my vague thoughts from 2AM on the other bug):
That should be simple (and quick) enough for now. If we need something more complex, the search case can be iterated on (if, for example, there are multiple GPIO devices with the requisite driver), but let's not go down that road unless we have to.
Marking as a bug because, although this doesn't break yet, it's evidently going to once this change lands in the upstream kernel.