* @endcode
*
* @param fd A file descriptor to the device in O_RDWR or O_RDONLY mode.
+ * @param[out] dev The newly initialized evdev device.
*
* @return On success, zero is returned and dev is set to the newly
* allocated struct. On failure, a negative errno is returned and the value
* Clean up and free the libevdev struct. After completion, the <code>struct
* libevdev</code> is invalid and must not be used.
*
+ * @param dev The evdev device
+ *
* @note This function may be called before libevdev_set_fd().
*/
void libevdev_free(struct libevdev *dev);
typedef void (*libevdev_log_func_t)(const char *format, va_list args);
/**
- * Set a printf-style logging handler for library-internal logging.
+ * Set a printf-style logging handler for library-internal logging. The default
+ * logging function is a noop.
+ *
+ * @param dev The evdev device
+ * @param logfunc The logging function for this device. If NULL, the current
+ * logging function is unset.
*
* @note This function may be called before libevdev_set_fd().
*/
* Grabbing an already grabbed device, or ungrabbing an ungrabbed device is
* a noop and always succeeds.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
* @param grab If true, grab the device. Otherwise ungrab the device.
*
* @return 0 if the device was successfull grabbed or ungrabbed, or a
* Unless otherwise specified, libevdev function behavior is undefined until
* a successfull call to libevdev_set_fd().
*
+ * @param dev The evdev device
* @param fd The file descriptor for the device
*
* @return 0 on success, or a negative error code on failure
*
* It is an error to call this function before calling libevdev_set_fd().
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
* @param fd The new fd
*
* @return 0 on success, or -1 on failure.
int libevdev_change_fd(struct libevdev* dev, int fd);
/**
+ * @param dev The evdev device
*
* @return The previously set fd, or -1 if none had been set previously.
* @note This function may be called before libevdev_set_fd().
* with the LIBEVDEV_READ_SYNC flag set, all events from the diff are dropped
* and event processing continues as normal.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
* @param flags Set of flags to determine behaviour. If LIBEVDEV_READ_NORMAL
* is set, the next event is read in normal mode. If LIBEVDEV_READ_SYNC is
* set, the next event is read in sync mode.
/**
* @ingroup bits
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ *
* @return The device name as read off the kernel device. The name is never
* NULL but it may be the empty string.
*
*
* Virtual devices such as uinput devices have no phys location.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ *
* @return The physical location of this device, or NULL if there is none
*
* @note This function is signal safe.
/**
* @ingroup bits
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ *
* @return The unique identifier for this device, or NULL if there is none
*
* @note This function is signal safe.
/**
* @ingroup bits
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ *
* @return The device's product ID
*
* @note This function is signal-safe.
/**
* @ingroup bits
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ *
* @return The device's vendor ID
*
* @note This function is signal-safe.
/**
* @ingroup bits
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ *
* @return The device's bus type
*
* @note This function is signal-safe.
/**
* @ingroup bits
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ *
* @return The device's firmware version
*
* @note This function is signal-safe.
/**
* @ingroup bits
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ *
* @return The driver version for this device
*
* @note This function is signal-safe.
/**
* @ingroup bits
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param prop The input property to query for, one of INPUT_PROP_...
+ *
* @return 1 if the device provides this input property, or 0 otherwise.
*
* @note This function is signal-safe
/**
* @ingroup bits
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param type The event type to query for, one of EV_SYN, EV_REL, etc.
+ *
* @return 1 if the device supports this event type, or 0 otherwise.
*
* @note This function is signal-safe.
/**
* @ingroup bits
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param type The event type for the code to query (EV_SYN, EV_REL, etc.)
+ * @param code The event code to query for, one of ABS_X, REL_X, etc.
+ *
* @return 1 if the device supports this event type and code, or 0 otherwise.
*
* @note This function is signal-safe.
/**
* @ingroup bits
*
+ * Get the minimum axis value for the given axis, as advertised by the kernel.
+ *
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param code The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc.
+ *
* @return axis minimum for the given axis or 0 if the axis is invalid
*/
int libevdev_get_abs_min(const struct libevdev *dev, unsigned int code);
/**
* @ingroup bits
*
+ * Get the maximum axis value for the given axis, as advertised by the kernel.
+ *
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param code The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc.
+ *
* @return axis maximum for the given axis or 0 if the axis is invalid
*/
int libevdev_get_abs_max(const struct libevdev *dev, unsigned int code);
/**
* @ingroup bits
*
+ * Get the axis fuzz for the given axis, as advertised by the kernel.
+ *
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param code The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc.
+ *
* @return axis fuzz for the given axis or 0 if the axis is invalid
*/
int libevdev_get_abs_fuzz(const struct libevdev *dev, unsigned int code);
/**
* @ingroup bits
*
+ * Get the axis flat for the given axis, as advertised by the kernel.
+ *
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param code The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc.
+ *
* @return axis flat for the given axis or 0 if the axis is invalid
*/
int libevdev_get_abs_flat(const struct libevdev *dev, unsigned int code);
/**
* @ingroup bits
*
+ * Get the axis resolution for the given axis, as advertised by the kernel.
+ *
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param code The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc.
+ *
* @return axis resolution for the given axis or 0 if the axis is invalid
*/
int libevdev_get_abs_resolution(const struct libevdev *dev, unsigned int code);
/**
* @ingroup bits
*
+ * Get the axis info for the given axis, as advertised by the kernel.
+ *
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param code The EV_ABS event code to query for, one of ABS_X, ABS_Y, etc.
+ *
* @return The input_absinfo for the given code, or NULL if the device does
* not support this event code.
*/
* Behaviour of this function is undefined if the device does not provide
* the event.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param type The event type for the code to query (EV_SYN, EV_REL, etc.)
+ * @param code The event code to query for, one of ABS_X, REL_X, etc.
+ *
* @return The current value of the event.
*
* @note This function is signal-safe.
* val = libevdev_get_event_value(dev, t, c);
* @endcode
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param type The event type for the code to query (EV_SYN, EV_REL, etc.)
+ * @param code The event code to query for, one of ABS_X, REL_X, etc.
+ * @param[out] value The current value of this axis returned.
+ *
* @return 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,
* zero is returned and value is unmodified.
* the device, for a code that is not in the permitted ABS_MT range or for a
* device that does not have slots.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param slot The numerical slot number, must be smaller than the total number
+ * of slots on this * device
+ * @param code The event code to query for, one of ABS_MT_POSITION_X, etc.
+ *
* @note This function is signal-safe.
* @note The value for events other than ABS_MT_ is undefined, use
* libevdev_fetch_value() instead
* val = libevdev_get_slot_value(dev, slot, c);
* @endcode
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param slot The numerical slot number, must be smaller than the total number
+ * of slots on this * device
+ * @param[out] value The current value of this axis returned.
+ *
+ * @param code The event code to query for, one of ABS_MT_POSITION_X, etc.
* @return If the device supports this event code, the return value is
* non-zero and value is set to the current value of this axis. Otherwise, or
* if the event code is not an ABS_MT_* event code, zero is returned and value
*
* Get the number of slots supported by this device.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ *
* @return The number of slots supported, or -1 if the device does not provide
* any slots
*
* waiting to be processed. The returned value is the value a caller would
* see if it were to process events manually one-by-one.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ *
* @return the currently active slot (logically)
*/
int libevdev_get_current_slot(const struct libevdev *dev);
* This is a local modification only affecting only this representation of
* this device.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
* @param type The event type to enable (EV_ABS, EV_KEY, ...)
*
* @return 0 on success or -1 otherwise
* This is a local modification only affecting only this representation of
* this device.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
* @param type The event type to disable (EV_ABS, EV_KEY, ...)
*
* @return 0 on success or -1 otherwise
* This is a local modification only affecting only this representation of
* this device.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
* @param type The event type to enable (EV_ABS, EV_KEY, ...)
* @param code The event code to enable (ABS_X, REL_X, etc.)
* @param data Axis/key data, depending on type and code
* This is a local modification only affecting only this representation of
* this device.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
* @param type The event type to disable (EV_ABS, EV_KEY, ...)
* @param code The event code to disable (ABS_X, REL_X, etc.)
*
* Set the device's EV_ABS axis to the value defined in the abs
* parameter. This will be written to the kernel.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
+ * @param code The EV_ABS event code to modify, one of ABS_X, ABS_Y, etc.
+ * @param abs Axis info to set the kernel axis to
+ *
* @return zero on success, or a negative errno on failure
*
* @see libevdev_enable_event_code
/**
* @ingroup misc
*
+ * @param type The event type to return the name for.
+ *
* @return The name of the given event type (e.g. EV_ABS) or NULL for an
* invalid type
*
/**
* @ingroup misc
*
+ * @param type The event type for the code to query (EV_SYN, EV_REL, etc.)
+ * @param code The event code to return the name for (e.g. ABS_X)
+ *
* @return The name of the given event code (e.g. ABS_X) or NULL for an
* invalid type or code
*
/**
* @ingroup misc
*
+ * @param prop The input prop to return the name for (e.g. INPUT_PROP_BUTTONPAD)
+ *
* @return The name of the given input prop (e.g. INPUT_PROP_BUTTONPAD) or NULL for an
* invalid property
*
/**
* @ingroup misc
*
+ * @param type The event type to return the maximum for (EV_ABS, EV_REL, etc.). No max is defined for
+ * EV_SYN.
+ *
* @return The max value defined for the given event type, e.g. ABS_MAX for a type of EV_ABS, or -1
* for an invalid type.
*
*
* Get the repeat delay and repeat period values for this device.
*
+ * @param dev The evdev device, already initialized with libevdev_set_fd()
* @param delay If not null, set to the repeat delay value
* @param period If not null, set to the repeat period value
*