Closed Johennes closed 3 years ago
We are thinking about designed generic drivers that includes low level embedded drivers (SPI, I2C displays and touch panels) and desktop libs (libinput, SDL, fbdev, etc) too.
Your updates on the current drivers add a very meaningful hint about what the capabilities the new driver architecture should have. So keep it up! :+1:
What I've learned so far:
<driver>_init
instead of exposing only a read or flush callback<driver>_init
prototype that works for SPI based display and desktop drivers too. So the init function should be similar but not the same. We are thinking about designed generic drivers that includes low level embedded drivers (SPI, I2C displays and touch panels) and desktop libs (libinput, SDL, fbdev, etc) too.
Your updates on the current drivers add a very meaningful hint about what the capabilities the new driver architecture should have. So keep it up! +1
Oh nice! Happy to hear I'm helping and not just stealing your time. :slightly_smiling_face:
not just stealing your time.
Definitely not. :slightly_smiling_face:
Merging, thank you!
This change bundles all of the previously file-global device-specific state in libinput.c and xkb.c into new driver state structs with a default value. All of the existing public functions are retained and operate on the default struct values. To allow the use of multiple devices, a second set of public functions is introduced that also take the specific driver state as an argument. It is left up to the caller where to store the driver state and how to retrieve it when reading input events.
The diff makes this look like a huge change but almost all of it just moves existing code around or renames variables.
Here is an example of how to use the new functions to connect multiple keyboards:
I'm hoping that this is a good compromise. The existing API interface is retained and merely extended with a second set of functions that perform the same operations but on a specific driver state. No assumptions are being made about where the driver state is stored and the overhead on the calling site to store and retrieve the state is minimal.
Closes: #151