Vibrate on key presses (haptic feedback)
I'm not sure that's something we want since I noticed my Android phone doesn't do it, but regardless…
I managed to make the Librem 5's vibrator vibrate:
For that we have to write to /dev/input/by-path/platform-vibrator-event
which isn't possible for the user, so we will likely need a priviledged service to handle vibrations.
Here is the Python 3 script I used to make it vibrate: vibrate.py, run it via sudo python3 vibrate.py
.
Here is how to implement it in C: https://gitlab.gnome.org/aplazas/libmanette/blob/master/src/manette-device.c#L830
I have the impression the vibrator makes no difference between to strong and weak strengths, so I'd send the same value to both. From my tests, a force of 10% (the range is a uint16, so 0 to 0xFFFF) for 10 milliseconds could work pretty well for a key press.