- Go 100%
|
|
||
|---|---|---|
| go.mod | initial import | |
| go.sum | initial import | |
| main.go | Add escape key support, unclutter Usage output | |
| README.md | README tweaks | |
evfwd is a simple tool to forward evdev events to a new virtual device.
evfwd can run in client or server mode and typically it is used by piping the client's output into a server running on another host.
In client mode evfwd reads events from one or more evdev devices and serializes them to stdout using Go's gob format. On the server side it reads these serialized events from stdin and injects them into /dev/uinput virtual devices. During the initial handshake the client passes on the evdev device descriptions and the server uses this information to clone the devices. evfwd tries to filter capabilities that would require two way communication but other than that it doesn't know anything about specific device types (keyboard, mouse etc) it simply forwards all events.
Example use to tunnel events through ssh to a remote machine:
evfwd /dev/input/somedevice | ssh somehost evfwd -s
You can list multiple devices in which case all of them will be watched.
Normally in client mode evfwd doesn't grab the device so the input continues to arrive to local programs too. To avoid this you can use the -g (grab) flag.
In client mode evfwd will watch for an event type and code combination that causes it to exit. By default the escape event type is 1 (EV_KEY) and the event code is 88 (F12 key). This means that pressing the F12 key on one of the watched devices will cause evfwd to exit. This is particularly important when grabbing your main keyboard device since otherwise you might not have an easy way to release the keyboard. The event type and code can be overridden using the -t and -e flags. You can find the event types and codes using the evtest utility.
The -l flag lists available input devices.
The client requires read permission to the input devices and the server side requires write permission to /dev/uinput.