libevdev  1.4.3
A wrapper library for evdev devices
 All Files Functions Typedefs Enumerations Enumerator Macros Groups Pages
libevdev.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Red Hat, Inc.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that copyright
7  * notice and this permission notice appear in supporting documentation, and
8  * that the name of the copyright holders not be used in advertising or
9  * publicity pertaining to distribution of the software without specific,
10  * written prior permission. The copyright holders make no representations
11  * about the suitability of this software for any purpose. It is provided "as
12  * is" without express or implied warranty.
13  *
14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20  * OF THIS SOFTWARE.
21  */
22 
23 #ifndef LIBEVDEV_H
24 #define LIBEVDEV_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #include <linux/input.h>
31 #include <stdarg.h>
32 
33 #define LIBEVDEV_ATTRIBUTE_PRINTF(_format, _args) __attribute__ ((format (printf, _format, _args)))
34 
738 struct libevdev;
739 
749 };
750 
765 struct libevdev* libevdev_new(void);
766 
789 int libevdev_new_from_fd(int fd, struct libevdev **dev);
790 
801 void libevdev_free(struct libevdev *dev);
802 
810 };
811 
828 typedef void (*libevdev_log_func_t)(enum libevdev_log_priority priority,
829  void *data,
830  const char *file, int line,
831  const char *func,
832  const char *format, va_list args)
834 
853 void libevdev_set_log_function(libevdev_log_func_t logfunc, void *data);
854 
868 
881 
901 typedef void (*libevdev_device_log_func_t)(const struct libevdev *dev,
902  enum libevdev_log_priority priority,
903  void *data,
904  const char *file, int line,
905  const char *func,
906  const char *format, va_list args)
908 
930 void libevdev_set_device_log_function(struct libevdev *dev,
932  enum libevdev_log_priority priority,
933  void *data);
934 
941 };
942 
961 int libevdev_grab(struct libevdev *dev, enum libevdev_grab_mode grab);
962 
986 int libevdev_set_fd(struct libevdev* dev, int fd);
987 
1023 int libevdev_change_fd(struct libevdev* dev, int fd);
1024 
1033 int libevdev_get_fd(const struct libevdev* dev);
1034 
1055 };
1056 
1107 int libevdev_next_event(struct libevdev *dev, unsigned int flags, struct input_event *ev);
1108 
1131 int libevdev_has_event_pending(struct libevdev *dev);
1132 
1147 const char* libevdev_get_name(const struct libevdev *dev);
1148 
1162 void libevdev_set_name(struct libevdev *dev, const char *name);
1163 
1179 const char * libevdev_get_phys(const struct libevdev *dev);
1180 
1194 void libevdev_set_phys(struct libevdev *dev, const char *phys);
1195 
1209 const char * libevdev_get_uniq(const struct libevdev *dev);
1210 
1224 void libevdev_set_uniq(struct libevdev *dev, const char *uniq);
1225 
1235 int libevdev_get_id_product(const struct libevdev *dev);
1236 
1246 void libevdev_set_id_product(struct libevdev *dev, int product_id);
1247 
1257 int libevdev_get_id_vendor(const struct libevdev *dev);
1258 
1268 void libevdev_set_id_vendor(struct libevdev *dev, int vendor_id);
1269 
1279 int libevdev_get_id_bustype(const struct libevdev *dev);
1280 
1290 void libevdev_set_id_bustype(struct libevdev *dev, int bustype);
1291 
1301 int libevdev_get_id_version(const struct libevdev *dev);
1302 
1312 void libevdev_set_id_version(struct libevdev *dev, int version);
1313 
1323 int libevdev_get_driver_version(const struct libevdev *dev);
1324 
1335 int libevdev_has_property(const struct libevdev *dev, unsigned int prop);
1336 
1348 int libevdev_enable_property(struct libevdev *dev, unsigned int prop);
1349 
1360 int libevdev_has_event_type(const struct libevdev *dev, unsigned int type);
1361 
1373 int libevdev_has_event_code(const struct libevdev *dev, unsigned int type, unsigned int code);
1374 
1387 int libevdev_get_abs_minimum(const struct libevdev *dev, unsigned int code);
1388 
1401 int libevdev_get_abs_maximum(const struct libevdev *dev, unsigned int code);
1402 
1415 int libevdev_get_abs_fuzz(const struct libevdev *dev, unsigned int code);
1416 
1429 int libevdev_get_abs_flat(const struct libevdev *dev, unsigned int code);
1430 
1443 int libevdev_get_abs_resolution(const struct libevdev *dev, unsigned int code);
1444 
1458 const struct input_absinfo* libevdev_get_abs_info(const struct libevdev *dev, unsigned int code);
1459 
1482 int libevdev_get_event_value(const struct libevdev *dev, unsigned int type, unsigned int code);
1483 
1515 int libevdev_set_event_value(struct libevdev *dev, unsigned int type, unsigned int code, int value);
1516 
1542 int libevdev_fetch_event_value(const struct libevdev *dev, unsigned int type, unsigned int code, int *value);
1543 
1564 int libevdev_get_slot_value(const struct libevdev *dev, unsigned int slot, unsigned int code);
1565 
1592 int libevdev_set_slot_value(struct libevdev *dev, unsigned int slot, unsigned int code, int value);
1593 
1619 int libevdev_fetch_slot_value(const struct libevdev *dev, unsigned int slot, unsigned int code, int *value);
1620 
1634 int libevdev_get_num_slots(const struct libevdev *dev);
1635 
1651 int libevdev_get_current_slot(const struct libevdev *dev);
1652 
1664 void libevdev_set_abs_minimum(struct libevdev *dev, unsigned int code, int min);
1665 
1677 void libevdev_set_abs_maximum(struct libevdev *dev, unsigned int code, int max);
1678 
1690 void libevdev_set_abs_fuzz(struct libevdev *dev, unsigned int code, int fuzz);
1691 
1703 void libevdev_set_abs_flat(struct libevdev *dev, unsigned int code, int flat);
1704 
1716 void libevdev_set_abs_resolution(struct libevdev *dev, unsigned int code, int resolution);
1717 
1729 void libevdev_set_abs_info(struct libevdev *dev, unsigned int code, const struct input_absinfo *abs);
1730 
1748 int libevdev_enable_event_type(struct libevdev *dev, unsigned int type);
1749 
1776 int libevdev_disable_event_type(struct libevdev *dev, unsigned int type);
1777 
1811 int libevdev_enable_event_code(struct libevdev *dev, unsigned int type, unsigned int code, const void *data);
1812 
1840 int libevdev_disable_event_code(struct libevdev *dev, unsigned int type, unsigned int code);
1841 
1856 int libevdev_kernel_set_abs_info(struct libevdev *dev, unsigned int code, const struct input_absinfo *abs);
1857 
1864 };
1865 
1879 int libevdev_kernel_set_led_value(struct libevdev *dev, unsigned int code, enum libevdev_led_value value);
1880 
1904 int libevdev_kernel_set_led_values(struct libevdev *dev, ...);
1905 
1920 int libevdev_set_clock_id(struct libevdev *dev, int clockid);
1921 
1943 int libevdev_event_is_type(const struct input_event *ev, unsigned int type);
1944 
1968 int libevdev_event_is_code(const struct input_event *ev, unsigned int type, unsigned int code);
1969 
1981 const char * libevdev_event_type_get_name(unsigned int type);
1994 const char * libevdev_event_code_get_name(unsigned int type, unsigned int code);
1995 
2009 const char* libevdev_property_get_name(unsigned int prop);
2010 
2023 int libevdev_event_type_get_max(unsigned int type);
2024 
2039 int libevdev_event_type_from_name(const char *name);
2040 
2057 int libevdev_event_type_from_name_n(const char *name, size_t len);
2058 
2078 int libevdev_event_code_from_name(unsigned int type, const char *name);
2079 
2101 int libevdev_event_code_from_name_n(unsigned int type, const char *name,
2102  size_t len);
2103 
2116 int libevdev_property_from_name(const char *name);
2117 
2132 int libevdev_property_from_name_n(const char *name, size_t len);
2133 
2151 int libevdev_get_repeat(const struct libevdev *dev, int *delay, int *period);
2152 
2153 /********* DEPRECATED SECTION *********/
2154 #if defined(__GNUC__) && __GNUC__ >= 4
2155 #define LIBEVDEV_DEPRECATED __attribute__ ((deprecated))
2156 #else
2157 #define LIBEVDEV_DEPRECATED
2158 #endif
2159 
2160 #ifdef __cplusplus
2161 }
2162 #endif
2163 
2164 #endif /* LIBEVDEV_H */