github.com/holoplot/go-evdev@v0.0.0-20220721205823-d31c64b9d636/README.md (about) 1 # Go support for the Linux evdev interface 2 3 This is a pure Go package for the Linux evdev interface, without cgo dependencies. 4 5 The Linux evdev interface is the userspace interface to interact with input devices such as 6 keyboard, mice, joysticks, touchscreens, rotary encoders etc. 7 8 The implementation in this package has the following features: 9 10 * Query device information such as the name, the physical location, the unique ID, 11 the vendor/product/bus/version IDs 12 * Query supported event types, codes and device properties 13 * Query the current status of bit-field based input types (such as keyboard, switches etc) 14 as well as information on absolute types (`ABS_X`, ...) including their min/max values and 15 current state 16 * Grab/Ungrab/Revoke support for exclusive claiming of devices 17 * Auto-generated `const` definitions and maps for types and codes from the kernel include headers 18 19 # Install 20 21 ``` 22 go get github.com/holoplot/go-evdev 23 ``` 24 25 And then use it in your source code. 26 27 ``` 28 import "github.com/holoplot/go-evdev" 29 ``` 30 31 # Re-generating codes.go 32 33 To re-generate `codes.go` from the latest kernel headers, use the following command. 34 35 ``` 36 go run build/gen-codes/main.go 37 gofmt codes.go 38 ``` 39 40 You can optionally validate generated string mappings with `go run build/gen-codes-validate/main.go` 41 42 # Example 43 44 See the code in `cmd/evtest` for an example. 45 46 # MIT License 47 48 See file `LICENSE` for details.