evdev
is a libevdev
inspired Go package for working with Linux input
devices. evdev
works by making ioctl
system calls for the Linux
input
and uinput
subsystems. Because evdev
is written in pure
Go, it can be used without CGO.
evdev
is used to poll events from, and send events to /dev/input/event*
devices. Additionally, evdev
provides the ability to create virtual uinput
devices that can be used similarly.
evdev
is a rewrite of the github.com/jteeuwen/evdev
package. Most of
the credit for this package goes to jteeuwen
for the original (and amazing!)
work done.
evdev
can be installed in the usual Go fashion:
$ go get -u github.com/kenshaw/evdev
Please see the examples
directory for more examples.
Reading events from input devices or creating virtual uinput
devices requires
$USER
to have the appropriate system-level permissions. This can be accomplished
by adding $USER
to a group with read/write access to /dev/input/event*
and
uinput
block devices.
Please refer to your relevant Linux distribution's documentation on adding
$USER
to the appropriate system group, or otherwise allowing read/write
access to /dev/input/event*
and uinput
devices.
Note: if adding a group to the current $USER
, it will be necessary to log
out and log back in before the system recognizes the group membership.
On Ubuntu/Debian systems, the current $USER
can be added to the input
group:
$ sudo adduser $USER input