libevdev
1.4
A wrapper library for evdev devices
|
Functions for querying multi-touch-related capabilities. More...
Functions | |
int | libevdev_get_slot_value (const struct libevdev *dev, unsigned int slot, unsigned int code) |
Return the current value of the code for the given slot. More... | |
int | libevdev_fetch_slot_value (const struct libevdev *dev, unsigned int slot, unsigned int code, int *value) |
Fetch the current value of the code for the given slot. More... | |
int | libevdev_get_num_slots (const struct libevdev *dev) |
Get the number of slots supported by this device. More... | |
int | libevdev_get_current_slot (const struct libevdev *dev) |
Get the currently active slot. More... | |
Functions for querying multi-touch-related capabilities.
MT devices following the kernel protocol B (using ABS_MT_SLOT) provide multiple touch points through so-called slots on the same axis. The slots are enumerated, a client reading from the device will first get an ABS_MT_SLOT event, then the values of axes changed in this slot. Multiple slots may be provided in before an EV_SYN event.
As with Querying device capabilities, the logical state of the device as seen by the library depends on the caller using libevdev_next_event().
The Linux kernel requires all axes on a device to have a semantic meaning, matching the axis names in linux/input.h. Some devices merely export a number of axes beyond the available axis list. For those devices, the multitouch information is invalid. Specfically, if a device provides the ABS_MT_SLOT axis AND also the (ABS_MT_SLOT - 1) axis, the device is not treated as multitouch device. No slot information is available and the ABS_MT axis range for these devices is treated as all other EV_ABS axes.
Note that because of limitations in the kernel API, such fake multitouch devices can not be reliably synched after a SYN_DROPPED event. libevdev ignores all ABS_MT axis values during the sync process and instead relies on the device to send the current axis value with the first event after SYN_DROPPED.
int libevdev_fetch_slot_value | ( | const struct libevdev * | dev, |
unsigned int | slot, | ||
unsigned int | code, | ||
int * | value | ||
) |
Fetch the current value of the code for the given slot.
This is a shortcut for
dev | The evdev device, already initialized with libevdev_set_fd() | |
slot | The numerical slot number, must be smaller than the total number of slots on this * device | |
[out] | value | The current value of this axis returned. |
code | The event code to query for, one of ABS_MT_POSITION_X, etc. |
int libevdev_get_current_slot | ( | const struct libevdev * | dev | ) |
Get the currently active slot.
This may differ from the value an ioctl may return at this time as events may have been read off the fd since changing the slot value but those events are still in the buffer waiting to be processed. The returned value is the value a caller would see if it were to process events manually one-by-one.
dev | The evdev device, already initialized with libevdev_set_fd() |
int libevdev_get_num_slots | ( | const struct libevdev * | dev | ) |
Get the number of slots supported by this device.
dev | The evdev device, already initialized with libevdev_set_fd() |
int libevdev_get_slot_value | ( | const struct libevdev * | dev, |
unsigned int | slot, | ||
unsigned int | code | ||
) |
Return the current value of the code for the given slot.
The return value is undefined for a slot exceeding the available slots on the device, for a code that is not in the permitted ABS_MT range or for a device that does not have slots.
dev | The evdev device, already initialized with libevdev_set_fd() |
slot | The numerical slot number, must be smaller than the total number of slots on this device |
code | The event code to query for, one of ABS_MT_POSITION_X, etc. |