Documentation
¶
Overview ¶
Package evdev holds the Linux input event ABI that Planck's host injector, virtual gamepads and gamepad reader share: event types and codes, the input_event record, and ioctl request numbers.
Index ¶
- Constants
- Variables
- func EVIOCGABS(abs int) uintptr
- func EVIOCGBIT(ev, n int) uintptr
- func EVIOCGKEY(n int) uintptr
- func EVIOCGNAME(n int) uintptr
- func Encode(dst []byte, evs ...Event) []byte
- func IO(typ, nr uint32) uintptr
- func IOR(typ, nr, size uint32) uintptr
- func IOW(typ, nr, size uint32) uintptr
- func IOWR(typ, nr, size uint32) uintptr
- func Ioctl(fd int, req uintptr, arg unsafe.Pointer) error
- func IoctlInt(fd int, req, arg uintptr) error
- func TestBit(bm []byte, n int) bool
- type Event
Constants ¶
const ( EvSyn = 0x00 EvKey = 0x01 EvRel = 0x02 EvAbs = 0x03 EvMsc = 0x04 EvFF = 0x15 EvUinput = 0x0101 SynReport = 0 SynDrop = 3 )
const ( RelX = 0x00 RelY = 0x01 RelHWheel = 0x06 RelWheel = 0x08 RelWheelHiRes = 0x0B RelHWheelHiRes = 0x0C )
const ( AbsX = 0x00 AbsY = 0x01 AbsZ = 0x02 AbsRX = 0x03 AbsRY = 0x04 AbsRZ = 0x05 AbsHat0X = 0x10 AbsHat0Y = 0x11 AbsHat3Y = 0x17 AbsMax = 0x3F )
const ( BtnJoystick = 0x120 BtnLeft = 0x110 BtnRight = 0x111 BtnMiddle = 0x112 BtnSide = 0x113 BtnExtra = 0x114 BtnSouth = 0x130 BtnEast = 0x131 BtnNorth = 0x133 BtnWest = 0x134 BtnTL = 0x136 BtnTR = 0x137 BtnTL2 = 0x138 BtnTR2 = 0x139 BtnSelect = 0x13A BtnStart = 0x13B BtnMode = 0x13C BtnThumbL = 0x13D BtnThumbR = 0x13E BtnDPadUp = 0x220 BtnDPadDown = 0x221 BtnDPadLeft = 0x222 BtnDPadRight = 0x223 BtnTouch = 0x14A BtnToolFinger = 0x145 KeyMax = 0x2FF )
const ( FFRumble = 0x50 FFGain = 0x60 )
const ( BusUSB = 0x03 BusBluetooth = 0x05 BusVirtual = 0x06 )
const ( InputIDSize = 8 AbsInfoSize = 24 )
const EventSize = 2*(bits.UintSize/8) + 8
EventSize is sizeof(struct input_event): a timeval, then type, code and value.
const FFEffectSize = ffUnionOffset + ffUnionSize
FFEffectSize is sizeof(struct ff_effect): fourteen bytes of header padded to the union, whose largest member (ff_periodic_effect) ends in a pointer.
const FFRumbleOffset = ffUnionOffset
FFRumbleOffset is where struct ff_effect keeps its rumble magnitudes (strong, then weak, 16 bits each).
Variables ¶
var EVIOCGID = IOR(evdevIoctlTyp, 0x02, InputIDSize)
EVIOCGID reads struct input_id.
var EVIOCRMFF = IOW(evdevIoctlTyp, 0x81, 4)
EVIOCRMFF erases a force-feedback effect by id.
var EVIOCSFF = IOW(evdevIoctlTyp, 0x80, FFEffectSize)
EVIOCSFF uploads a force-feedback effect.
Functions ¶
func EVIOCGBIT ¶
EVIOCGBIT reads the bitmap of codes of event type ev (0 for the types themselves) into a buffer of n bytes.
func EVIOCGNAME ¶
EVIOCGNAME reads the device name into a buffer of n bytes.
Types ¶
type Event ¶
Event is one input_event.
func ParseEvent ¶
ParseEvent reads the event at the start of b, which must hold EventSize bytes.