golang-evdev
golang-evdev copied to clipboard
Writing to device?
Would be awesome if this library supported writing to the devices :-)
Just for future reference: you can easily write to any device using the constants and structs provided in the library
func input_event(typ uint16, code uint16, value int32) ev.InputEvent {
return ev.InputEvent{
Time: syscall.Timeval{
Sec: time.Now().Unix(),
Usec: time.Now().UnixNano() / 1000 % 1000,
},
Type: typ,
Code: code,
Value: value,
}
}
and
binary.Write(f, binary.LittleEndian, input_event(ev.EV_KEY, ev.KEY_LEFTCTRL, 1))