How can I detect simultaneous key presses in python running in a headless session, i.e. with no display attached?
My goal is to control two motors in a car by pressing keys on the keyboard. E.g. motor 1 runs while 'a' is pressed. Motor 2 runs while 's' is pressed. If both keys are pressed, both motors run. As soon as a key is released, the respective motor stops. The Raspberrypi is not connected to a display and runs headless, i.e. I'm connecting from a Mac via SSH.
I have found several methods, but non of them works for my case where I need to detect simultaneous presses and no display is attached.
Curses and tty cannot detect simultaneous presses (example). pygame can detect simultaneous presses but does not work in a headless session (ref)