Documentation ¶
Index ¶
Constants ¶
const ( DI_TYPE_UNKNOWN = HandlerType(iota) DI_TYPE_STD_KBD // standard keyboard 6KRO mode DI_TYPE_NKRO_KBD // N-Key Rollover mode DI_TYPE_MULTIMEDIA // Multimedia events, e.g. next track, volume up DI_TYPE_SYSTEM // System events, e.g. sleep, power DI_TYPE_MOUSE DI_TYPE_JOYSTICK )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Device ¶
type Device struct { ID InputID Name string Uniq string // Phys is a common part of Handlers Phys // for example "usb-20980000.usb-1.4/input0" will be used as "usb-20980000.usb-1.4" Phys string DeviceType DeviceType Handlers []DeviceInfo AbsInfos map[string]map[evdev.EvCode]evdev.AbsInfo // map key: DeviceInfo.Event() }
Device is a representation of singular hardware device, it keeps all underlying DeviceInfo handlers
func Normalize ¶
func Normalize(deviceInfos []DeviceInfo) []Device
Normalize processes all DeviceInfo list and returns generic devices with its underlying DeviceInfo handlers
func (*Device) DeviceID ¶
DeviceID returns unique UUID for every device as much as possible, regardless of its connection source. Vast amount of devices (especially keyboards) doesn't provide unique identifiers, so often it is impossible to distinguish between two the vert same types of devices. Sometimes (eg. dualshock 4, steam controller) device provide such information, so handling of separate configurations for those should be possible
func (*Device) PhysicalUUID ¶
func (d *Device) PhysicalUUID() PhysicalID
func (*Device) ProcessEvents ¶
func (*Device) SupportsNKRO ¶
SupportsNKRO tells if device has N-Key rollover handler
type DeviceInfo ¶
type DeviceInfo struct { ID InputID // ID of the device Name string // name of the device Phys string // physical path to the device in the system hierarchy Sysfs string // sysfs path Uniq string // unique identification code for the device (if device has it) CapableTypes []evdev.EvType Properties []evdev.EvProp // contains filtered or unexported fields }
DeviceInfo contains information of every reported event device it is supposed to be created by unmarshal function only
func (*DeviceInfo) Event ¶
func (d *DeviceInfo) Event() string
Event returns event name, like "event0" for /dev/input/event0
func (*DeviceInfo) EventPath ¶
func (d *DeviceInfo) EventPath() string
EventPath returns a /dev/input/event filepath for button presses
func (*DeviceInfo) HandlerType ¶
func (d *DeviceInfo) HandlerType() HandlerType
func (*DeviceInfo) PhysicalUUID ¶
func (d *DeviceInfo) PhysicalUUID() PhysicalID
PhysicalUUID returns unique UUID based on connection of given USB port The main usage is to identify groups of handlers that represent one physical device
type DeviceType ¶
type DeviceType int
const ( UnknownDevice DeviceType = iota KeyboardDevice // keyboard, including keyboard with integrated mouse MouseDevice // mouse device only JoystickDevice // joystick device, may contain keyboard, mouse, sensors events )
Generic device types
func DetermineDeviceType ¶
func DetermineDeviceType(handlers []DeviceInfo) DeviceType
func (DeviceType) String ¶
func (e DeviceType) String() string
type HandlerType ¶
type HandlerType int
func (HandlerType) String ¶
func (ht HandlerType) String() string
type InputEvent ¶
type InputEvent struct { Source DeviceInfo Event evdev.InputEvent }
type PhysicalID ¶
type PhysicalID string