* Abstraction functions to handle device capabilities, specificially
* device propeties such as the name of the device and the bits
* representing the events suppported 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_fd(). If a caller does not
+ * use libevdev_next_fd(), libevdev will not update the internal state of the
+ * device and thus returns outdated values.
*/
/**
* @defgroup mt Multi-touch related functions
- * Functions for querying multi-touch-related capabilities.
+ * 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 @ref bits, the logical state of the device as seen by the library
+ * depends on the caller using libevdev_next_event().
*/
/**
* @defgroup kernel Modifying the appearance or capabilities of the device
*
- * Modifying the set of events reported by this device.
+ * Modifying the set of events reported by this device. By default, the
+ * libevdev device mirrors the kernel device, enabling only those bits
+ * exported by the kernel. This set of functions enable or disable bits as
+ * seen from the caller.
+ *
+ * Enabling an event type or code does not affect event reporting - a
+ * software-enabled event will not be generated by the physical hardware.
+ * Disabling an event will prevent libevdev from routing such events to the
+ * caller. Enabling and disabling event types and codes is at the library
+ * level and thus only affects the caller.
+ *
+ * If an event type or code is enabled at kernel-level, future users of this
+ * device will see this event enabled. Currently there is no option of
+ * disabling an event type or code at kernel-level.
*/
/**
*
* This is a shortcut for
*
- * <pre>
+ * @code
* int err;
* struct libevdev *dev = libevdev_new();
* err = libevdev_set_fd(dev, fd);
- * </pre>
+ * @endcode
*
* @param fd A file descriptor to the device in O_RDWR or O_RDONLY mode.
*
/**
* Set a printf-style logging handler for library-internal logging.
*
- * @note This function may be called before libevdev_set_fd.
+ * @note This function may be called before libevdev_set_fd().
*/
void libevdev_set_log_handler(struct libevdev *dev, libevdev_log_func_t logfunc);
/**
*
* @return The previously set fd, or -1 if none had been set previously.
- * @note This function may be called before libevdev_set_fd.
+ * @note This function may be called before libevdev_set_fd().
*/
int libevdev_get_fd(const struct libevdev* dev);
/**
* @ingroup bits
*
- * @return The device name as read off the kernel device
+ * @return 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.
*/
/**
* @ingroup bits
*
- * @return 1 if the device supports this event type, or 0 otherwise.
+ * @return 1 if the device provides this input property, or 0 otherwise.
*
* @note This function is signal-safe
*/
/**
* @ingroup bits
*
- * @return 1 if the device supports this event type, or 0 otherwise.
+ * @return 1 if the device supports this event type and code, or 0 otherwise.
*
* @note This function is signal-safe.
*/
*
* @note This function is signal-safe.
* @note The value for ABS_MT_ events is undefined, use
- * libevdev_get_slot_value instead
+ * libevdev_get_slot_value() instead
*
* @see libevdev_get_slot_value
*/
*
* Fetch the current value of the event type. This is a shortcut for
*
- * <pre>
+ * @code
* if (libevdev_has_event_type(dev, t) && libevdev_has_event_code(dev, t, c))
* val = libevdev_get_event_value(dev, t, c);
- * </pre>
+ * @endcode
*
- * @return non-zero if the device supports this event code, or zero
- * otherwise. On return of zero, value is unmodified.
+ * @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.
*
* @note This function is signal-safe.
* @note The value for ABS_MT_ events is undefined, use
- * libevdev_fetch_slot_value instead
+ * libevdev_fetch_slot_value() instead
*
* @see libevdev_fetch_slot_value
*/
* 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, or for a device that does not have slots.
+ * the device, for a code that is not in the permitted ABS_MT range or for a
+ * device that does not have slots.
*
* @note This function is signal-safe.
* @note The value for events other than ABS_MT_ is undefined, use
- * libevdev_fetch_value instead
+ * libevdev_fetch_value() instead
*
* @see libevdev_get_value
*/
*
* Fetch the current value of the code for the given slot. This is a shortcut for
*
- * <pre>
+ * @code
* if (libevdev_has_event_type(dev, EV_ABS) &&
* libevdev_has_event_code(dev, EV_ABS, c) &&
* slot < device->number_of_slots)
* val = libevdev_get_slot_value(dev, slot, c);
- * </pre>
+ * @endcode
*
- * @return non-zero if the device supports this event code, or zero
- * otherwise. On return of zero, value is unmodified.
+ * @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
+ * is unmodified.
*
* @note This function is signal-safe.
- * @note The value for ABS_MT_ events is undefined, use
- * libevdev_fetch_slot_value instead
- *
- * @see libevdev_fetch_slot_value
*/
int libevdev_fetch_slot_value(const struct libevdev *dev, unsigned int slot, unsigned int code, int *value);
* Note that the slot offset may be non-zero, use libevdev_get_abs_min() or
* libevdev_get_abs_info() to get the minimum slot number.
*
- * @return The number of slots supported, or -1
+ * @return The number of slots supported, or -1 if the device does not provide
+ * any slots
*/
int libevdev_get_num_slots(const struct libevdev *dev);
*
* Forcibly enable an event type on this device, even if the underlying
* device does not support it. While this cannot make the device actually
- * report such events, it will now return true for libevdev_has_event_type.
+ * report such events, it will now return true for libevdev_has_event_type().
*
- * This is a local modification only affecting only this process and only
+ * This is a local modification only affecting only this representation of
* this device.
*
* @param type The event type to enable (EV_ABS, EV_KEY, ...)
* Forcibly disable an event type on this device, even if the underlying
* device provides it, effectively muting all keys or axes. libevdev will
* filter any events matching this type and none will reach the caller.
- * libevdev_has_event_type will return false for this type.
+ * libevdev_has_event_type() will return false for this type.
*
* In most cases, a caller likely only wants to disable a single code, not
- * the whole type. Use libevdev_disable_event_code for that.
+ * the whole type. Use libevdev_disable_event_code() for that.
*
- * This is a local modification only affecting only this process and only
+ * This is a local modification only affecting only this representation of
* this device.
*
- * @param type The event type to enable (EV_ABS, EV_KEY, ...)
+ * @param type The event type to disable (EV_ABS, EV_KEY, ...)
*
* @return 0 on success or -1 otherwise
*
*
* Forcibly enable an event type on this device, even if the underlying
* device does not support it. While this cannot make the device actually
- * report such events, it will now return true for libevdev_has_event_code.
+ * report such events, it will now return true for libevdev_has_event_code().
*
* The last argument depends on the type and code:
* - If type is EV_ABS, the vararg must be a pointer to a struct input_absinfo
* containing the data for this axis.
* - For all other types, the argument is ignored.
*
- * This function calls libevdev_enable_event_type if necessary.
+ * This function calls libevdev_enable_event_type() if necessary.
*
- * This is a local modification only affecting only this process and only
+ * This is a local modification only affecting only this representation of
* this device.
*
* @param type The event type to enable (EV_ABS, EV_KEY, ...)
* device provides it, effectively muting this key or axis. libevdev will
* filter any events matching this type and code and none will reach the
* caller.
- * libevdev_has_event_code will return false for this code combination.
+ * libevdev_has_event_code() will return false for this code combination.
*
* Disabling all event codes for a given type will not disable the event
- * type. Use libevdev_disable_event_type for that.
+ * type. Use libevdev_disable_event_type() for that.
*
- * This is a local modification only affecting only this process and only
+ * This is a local modification only affecting only this representation of
* this device.
*
- * @param type The event type to enable (EV_ABS, EV_KEY, ...)
- * @param code The event code to enable (ABS_X, REL_X, etc.)
+ * @param type The event type to disable (EV_ABS, EV_KEY, ...)
+ * @param code The event code to disable (ABS_X, REL_X, etc.)
*
* @return 0 on success or -1 otherwise
*
*
* Forcibly enable an event type on this device, even if the underlying
* device does not support it. While this cannot make the device actually
- * report such events, it will now return true for libevdev_has_event_code.
+ * report such events, it will now return true for libevdev_has_event_code().
*
* This will be written to the kernel.
*
* This cannot be undone, the kernel only allows to enable axes, not disable
* them.
*
- * This function calls libevdev_kernel_enable_event_type if necessary.
+ * This function calls libevdev_kernel_enable_event_type() if necessary.
*
* @param type The event type to enable (EV_ABS, EV_KEY, ...)
- * @param code The event code to enable (ABS_X, REL_X, etc.)
*/
int libevdev_kernel_enable_event_type(struct libevdev *dev, unsigned int type);
*
* Forcibly enable an event code on this device, even if the underlying
* device does not support it. While this cannot make the device actually
- * report such events, it will now return true for libevdev_has_event_code.
+ * report such events, it will now return true for libevdev_has_event_code().
*
* This will be written to the kernel.
*
* This cannot be undone, the kernel only allows to enable axes, not disable
* them.
*
- * This function calls libevdev_kernel_enable_event_type if necessary.
+ * This function calls libevdev_kernel_enable_event_type() if necessary.
*
* @param type The event type to enable (EV_ABS, EV_KEY, ...)
* @param code The event code to enable (ABS_X, REL_X, etc.)
* @note The list of names is compiled into libevdev. If the kernel adds new
* defines for new properties libevdev will not automatically pick these up.
* @note On older kernels input properties may not be defined and
- * libevdev_get_input_prop_name will always return NULL
+ * libevdev_get_input_prop_name() will always return NULL
*/
const char * libevdev_get_input_prop_name(unsigned int prop);
* @param period If not null, set to the repeat period value
*
* @return 0 on success, -1 if this device does not have repeat settings.
+ *
+ * @note This function is signal-safe
*/
int libevdev_get_repeat(struct libevdev *dev, int *delay, int *period);