Share keyboard across computers
I wrote this program to feed input to my Raspberry Pi using my laptop's keyboard over LAN. However, it can be used to provide input to any Linux device using keyboard connected to any Linux device over any network.
- This program is intended to be used on a trusted network. Keyboard keys are transported over plain TCP sockets and thus can be messed up with.
- Further, the program relies on
/dev/input/by-path/{kbd-device}to read keyboard keys and/dev/uinput(user level input subsystem) to emulate keyboard events. Make sure they exist on your devices.
- Clone.
- On Remote (where keyboard input needs to be provided):
- cd into
/remote gcc *.csudo ./a.out &ctrl-cto stop.- On Host (where Keyboard is connected):
- cd into
/host. gcc *.csudo ./a.out {IP address of remote} {/dev/input/by-path/name of keyboard file}- optional: preceed above command by
stty -echoto prevent terminal from echoing back; executestty echoto return to original behavior. ctrl-cto stop.
- Make key combinations to enable and disable sending key codes.
- Ignore
siginton host, or have a way around. - Try to make it work on Android. (Android has
/dev/uinput). - Write keyboard reader for OS X.
- Share mouse similarly (?).