Abstraction functions to handle device capabilities, specifically device properties such as the name of the device and the bits representing the events supported by this device.
More...
|
const char * | libevdev_get_name (const struct libevdev *dev) |
|
const char * | libevdev_get_phys (const struct libevdev *dev) |
|
const char * | libevdev_get_uniq (const struct libevdev *dev) |
|
int | libevdev_get_id_product (const struct libevdev *dev) |
|
int | libevdev_get_id_vendor (const struct libevdev *dev) |
|
int | libevdev_get_id_bustype (const struct libevdev *dev) |
|
int | libevdev_get_id_version (const struct libevdev *dev) |
|
int | libevdev_get_driver_version (const struct libevdev *dev) |
|
int | libevdev_has_property (const struct libevdev *dev, unsigned int prop) |
|
int | libevdev_has_event_type (const struct libevdev *dev, unsigned int type) |
|
int | libevdev_has_event_code (const struct libevdev *dev, unsigned int type, unsigned int code) |
|
int | libevdev_get_abs_minimum (const struct libevdev *dev, unsigned int code) |
|
int | libevdev_get_abs_maximum (const struct libevdev *dev, unsigned int code) |
|
int | libevdev_get_abs_fuzz (const struct libevdev *dev, unsigned int code) |
|
int | libevdev_get_abs_flat (const struct libevdev *dev, unsigned int code) |
|
int | libevdev_get_abs_resolution (const struct libevdev *dev, unsigned int code) |
|
const struct input_absinfo * | libevdev_get_abs_info (const struct libevdev *dev, unsigned int code) |
|
int | libevdev_get_event_value (const struct libevdev *dev, unsigned int type, unsigned int code) |
|
int | libevdev_fetch_event_value (const struct libevdev *dev, unsigned int type, unsigned int code, int *value) |
|
int | libevdev_get_repeat (const struct libevdev *dev, int *delay, int *period) |
|
Abstraction functions to handle device capabilities, specifically device properties such as the name of the device and the bits representing the events supported by this device.
The logical state returned may lag behind the physical state of the device. libevdev queries the device state on libevdev_set_fd() and then relies on the caller to parse events through libevdev_next_event(). If a caller does not use libevdev_next_event(), libevdev will not update the internal state of the device and thus returns outdated values.
◆ libevdev_fetch_event_value()
int libevdev_fetch_event_value |
( |
const struct libevdev * |
dev, |
|
|
unsigned int |
type, |
|
|
unsigned int |
code, |
|
|
int * |
value |
|
) |
| |
Fetch the current value of the event type. This is a shortcut for
- Parameters
-
| dev | The evdev device, already initialized with libevdev_set_fd() |
| type | The event type for the code to query (EV_SYN, EV_REL, etc.) |
| code | The event code to query for, one of ABS_X, REL_X, etc. |
[out] | value | The current value of this axis returned. |
- Returns
- If the device supports this event type and code, the return value is non-zero and value is set to the current value of this axis. Otherwise, 0 is returned and value is unmodified.
- Note
- This function is signal-safe.
-
The value for ABS_MT_ events is undefined, use libevdev_fetch_slot_value() instead
- See also
- libevdev_fetch_slot_value
◆ libevdev_get_abs_flat()
int libevdev_get_abs_flat |
( |
const struct libevdev * |
dev, |
|
|
unsigned int |
code |
|
) |
| |
Get the axis flat for the given axis, as advertised by the kernel.
- Parameters
-
dev | The evdev device, already initialized with libevdev_set_fd() |
code | The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc. |
- Returns
- axis flat for the given axis or 0 if the axis is invalid
- Note
- This function is signal-safe.
◆ libevdev_get_abs_fuzz()
int libevdev_get_abs_fuzz |
( |
const struct libevdev * |
dev, |
|
|
unsigned int |
code |
|
) |
| |
Get the axis fuzz for the given axis, as advertised by the kernel.
- Parameters
-
dev | The evdev device, already initialized with libevdev_set_fd() |
code | The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc. |
- Returns
- axis fuzz for the given axis or 0 if the axis is invalid
- Note
- This function is signal-safe.
◆ libevdev_get_abs_info()
const struct input_absinfo* libevdev_get_abs_info |
( |
const struct libevdev * |
dev, |
|
|
unsigned int |
code |
|
) |
| |
Get the axis info for the given axis, as advertised by the kernel.
- Parameters
-
dev | The evdev device, already initialized with libevdev_set_fd() |
code | The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc. |
- Returns
- The input_absinfo for the given code, or NULL if the device does not support this event code.
- Note
- This function is signal-safe.
◆ libevdev_get_abs_maximum()
int libevdev_get_abs_maximum |
( |
const struct libevdev * |
dev, |
|
|
unsigned int |
code |
|
) |
| |
Get the maximum axis value for the given axis, as advertised by the kernel.
- Parameters
-
dev | The evdev device, already initialized with libevdev_set_fd() |
code | The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc. |
- Returns
- axis maximum for the given axis or 0 if the axis is invalid
- Note
- This function is signal-safe.
◆ libevdev_get_abs_minimum()
int libevdev_get_abs_minimum |
( |
const struct libevdev * |
dev, |
|
|
unsigned int |
code |
|
) |
| |
Get the minimum axis value for the given axis, as advertised by the kernel.
- Parameters
-
dev | The evdev device, already initialized with libevdev_set_fd() |
code | The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc. |
- Returns
- axis minimum for the given axis or 0 if the axis is invalid
- Note
- This function is signal-safe.
◆ libevdev_get_abs_resolution()
int libevdev_get_abs_resolution |
( |
const struct libevdev * |
dev, |
|
|
unsigned int |
code |
|
) |
| |
Get the axis resolution for the given axis, as advertised by the kernel.
- Parameters
-
dev | The evdev device, already initialized with libevdev_set_fd() |
code | The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc. |
- Returns
- axis resolution for the given axis or 0 if the axis is invalid
- Note
- This function is signal-safe.
◆ libevdev_get_driver_version()
int libevdev_get_driver_version |
( |
const struct libevdev * |
dev | ) |
|
- Parameters
-
- Returns
- The driver version for this device
- Note
- This function is signal-safe.
◆ libevdev_get_event_value()
int libevdev_get_event_value |
( |
const struct libevdev * |
dev, |
|
|
unsigned int |
type, |
|
|
unsigned int |
code |
|
) |
| |
Behaviour of this function is undefined if the device does not provide the event.
If the device supports ABS_MT_SLOT, the value returned for any ABS_MT_* event code is the value of the currently active slot. You should use libevdev_get_slot_value() instead.
- Parameters
-
dev | The evdev device, already initialized with libevdev_set_fd() |
type | The event type for the code to query (EV_SYN, EV_REL, etc.) |
code | The event code to query for, one of ABS_X, REL_X, etc. |
- Returns
- The current value of the event.
- Note
- This function is signal-safe.
-
The value for ABS_MT_ events is undefined, use libevdev_get_slot_value() instead
- See also
- libevdev_get_slot_value
◆ libevdev_get_id_bustype()
int libevdev_get_id_bustype |
( |
const struct libevdev * |
dev | ) |
|
- Parameters
-
- Returns
- The device's bus type
- Note
- This function is signal-safe.
◆ libevdev_get_id_product()
int libevdev_get_id_product |
( |
const struct libevdev * |
dev | ) |
|
- Parameters
-
- Returns
- The device's product ID
- Note
- This function is signal-safe.
◆ libevdev_get_id_vendor()
int libevdev_get_id_vendor |
( |
const struct libevdev * |
dev | ) |
|
- Parameters
-
- Returns
- The device's vendor ID
- Note
- This function is signal-safe.
◆ libevdev_get_id_version()
int libevdev_get_id_version |
( |
const struct libevdev * |
dev | ) |
|
- Parameters
-
- Returns
- The device's firmware version
- Note
- This function is signal-safe.
◆ libevdev_get_name()
const char* libevdev_get_name |
( |
const struct libevdev * |
dev | ) |
|
Retrieve the device's name, either as set by the caller or as read from the kernel. The string returned is valid until libevdev_free() or until libevdev_set_name(), whichever comes earlier.
- Parameters
-
- Returns
- The device name as read off the kernel device. The name is never NULL but it may be the empty string.
- Note
- This function is signal-safe.
◆ libevdev_get_phys()
const char* libevdev_get_phys |
( |
const struct libevdev * |
dev | ) |
|
Retrieve the device's physical location, either as set by the caller or as read from the kernel. The string returned is valid until libevdev_free() or until libevdev_set_phys(), whichever comes earlier.
Virtual devices such as uinput devices have no phys location.
- Parameters
-
- Returns
- The physical location of this device, or NULL if there is none
- Note
- This function is signal safe.
◆ libevdev_get_repeat()
int libevdev_get_repeat |
( |
const struct libevdev * |
dev, |
|
|
int * |
delay, |
|
|
int * |
period |
|
) |
| |
Get the repeat delay and repeat period values for this device. This function is a convenience function only, EV_REP is supported by libevdev_get_event_value().
- Parameters
-
dev | The evdev device, already initialized with libevdev_set_fd() |
delay | If not null, set to the repeat delay value |
period | If not null, set to the repeat period value |
- Returns
- 0 on success, -1 if this device does not have repeat settings.
- Note
- This function is signal-safe
- See also
- libevdev_get_event_value
◆ libevdev_get_uniq()
const char* libevdev_get_uniq |
( |
const struct libevdev * |
dev | ) |
|
Retrieve the device's unique identifier, either as set by the caller or as read from the kernel. The string returned is valid until libevdev_free() or until libevdev_set_uniq(), whichever comes earlier.
- Parameters
-
- Returns
- The unique identifier for this device, or NULL if there is none
- Note
- This function is signal safe.
◆ libevdev_has_event_code()
int libevdev_has_event_code |
( |
const struct libevdev * |
dev, |
|
|
unsigned int |
type, |
|
|
unsigned int |
code |
|
) |
| |
- Parameters
-
dev | The evdev device, already initialized with libevdev_set_fd() |
type | The event type for the code to query (EV_SYN, EV_REL, etc.) |
code | The event code to query for, one of ABS_X, REL_X, etc. |
- Returns
- 1 if the device supports this event type and code, or 0 otherwise.
- Note
- This function is signal-safe.
◆ libevdev_has_event_type()
int libevdev_has_event_type |
( |
const struct libevdev * |
dev, |
|
|
unsigned int |
type |
|
) |
| |
- Parameters
-
dev | The evdev device, already initialized with libevdev_set_fd() |
type | The event type to query for, one of EV_SYN, EV_REL, etc. |
- Returns
- 1 if the device supports this event type, or 0 otherwise.
- Note
- This function is signal-safe.
◆ libevdev_has_property()
int libevdev_has_property |
( |
const struct libevdev * |
dev, |
|
|
unsigned int |
prop |
|
) |
| |
- Parameters
-
dev | The evdev device, already initialized with libevdev_set_fd() |
prop | The input property to query for, one of INPUT_PROP_... |
- Returns
- 1 if the device provides this input property, or 0 otherwise.
- Note
- This function is signal-safe