libevdev  0.5
A wrapper library for evdev devices
 All Files Functions Variables 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 
345 struct libevdev;
346 
357 };
358 
373 struct libevdev* libevdev_new(void);
374 
397 int libevdev_new_from_fd(int fd, struct libevdev **dev);
398 
409 void libevdev_free(struct libevdev *dev);
410 
418 };
419 
436 typedef void (*libevdev_log_func_t)(enum libevdev_log_priority priority,
437  void *data,
438  const char *file, int line,
439  const char *func,
440  const char *format, va_list args);
441 
454 void libevdev_set_log_function(libevdev_log_func_t logfunc, void *data);
455 
467 
474 
481 };
482 
501 int libevdev_grab(struct libevdev *dev, enum libevdev_grab_mode grab);
502 
526 int libevdev_set_fd(struct libevdev* dev, int fd);
527 
552 int libevdev_change_fd(struct libevdev* dev, int fd);
553 
562 int libevdev_get_fd(const struct libevdev* dev);
563 
564 
585 };
620 int libevdev_next_event(struct libevdev *dev, unsigned int flags, struct input_event *ev);
621 
644 int libevdev_has_event_pending(struct libevdev *dev);
645 
656 const char* libevdev_get_name(const struct libevdev *dev);
657 
667 void libevdev_set_name(struct libevdev *dev, const char *name);
668 
680 const char * libevdev_get_phys(const struct libevdev *dev);
681 
691 void libevdev_set_phys(struct libevdev *dev, const char *phys);
692 
702 const char * libevdev_get_uniq(const struct libevdev *dev);
703 
713 void libevdev_set_uniq(struct libevdev *dev, const char *uniq);
714 
724 int libevdev_get_id_product(const struct libevdev *dev);
725 
735 void libevdev_set_id_product(struct libevdev *dev, int product_id);
736 
746 int libevdev_get_id_vendor(const struct libevdev *dev);
747 
757 void libevdev_set_id_vendor(struct libevdev *dev, int vendor_id);
758 
768 int libevdev_get_id_bustype(const struct libevdev *dev);
769 
779 void libevdev_set_id_bustype(struct libevdev *dev, int bustype);
780 
790 int libevdev_get_id_version(const struct libevdev *dev);
791 
801 void libevdev_set_id_version(struct libevdev *dev, int version);
802 
812 int libevdev_get_driver_version(const struct libevdev *dev);
813 
824 int libevdev_has_property(const struct libevdev *dev, unsigned int prop);
825 
837 int libevdev_enable_property(struct libevdev *dev, unsigned int prop);
838 
849 int libevdev_has_event_type(const struct libevdev *dev, unsigned int type);
850 
862 int libevdev_has_event_code(const struct libevdev *dev, unsigned int type, unsigned int code);
863 
874 int libevdev_get_abs_minimum(const struct libevdev *dev, unsigned int code);
885 int libevdev_get_abs_maximum(const struct libevdev *dev, unsigned int code);
896 int libevdev_get_abs_fuzz(const struct libevdev *dev, unsigned int code);
907 int libevdev_get_abs_flat(const struct libevdev *dev, unsigned int code);
918 int libevdev_get_abs_resolution(const struct libevdev *dev, unsigned int code);
919 
931 const struct input_absinfo* libevdev_get_abs_info(const struct libevdev *dev, unsigned int code);
932 
955 int libevdev_get_event_value(const struct libevdev *dev, unsigned int type, unsigned int code);
956 
983 int libevdev_set_event_value(struct libevdev *dev, unsigned int type, unsigned int code, int value);
984 
1010 int libevdev_fetch_event_value(const struct libevdev *dev, unsigned int type, unsigned int code, int *value);
1011 
1032 int libevdev_get_slot_value(const struct libevdev *dev, unsigned int slot, unsigned int code);
1033 
1060 int libevdev_set_slot_value(struct libevdev *dev, unsigned int slot, unsigned int code, int value);
1061 
1087 int libevdev_fetch_slot_value(const struct libevdev *dev, unsigned int slot, unsigned int code, int *value);
1088 
1102 int libevdev_get_num_slots(const struct libevdev *dev);
1103 
1117 int libevdev_get_current_slot(const struct libevdev *dev);
1118 
1126 void libevdev_set_abs_minimum(struct libevdev *dev, unsigned int code, int min);
1127 
1135 void libevdev_set_abs_maximum(struct libevdev *dev, unsigned int code, int max);
1136 
1144 void libevdev_set_abs_fuzz(struct libevdev *dev, unsigned int code, int fuzz);
1145 
1153 void libevdev_set_abs_flat(struct libevdev *dev, unsigned int code, int flat);
1154 
1162 void libevdev_set_abs_resolution(struct libevdev *dev, unsigned int code, int resolution);
1163 
1171 void libevdev_set_abs_info(struct libevdev *dev, unsigned int code, const struct input_absinfo *abs);
1172 
1190 int libevdev_enable_event_type(struct libevdev *dev, unsigned int type);
1191 
1218 int libevdev_disable_event_type(struct libevdev *dev, unsigned int type);
1219 
1247 int libevdev_enable_event_code(struct libevdev *dev, unsigned int type, unsigned int code, const void *data);
1248 
1276 int libevdev_disable_event_code(struct libevdev *dev, unsigned int type, unsigned int code);
1277 
1292 int libevdev_kernel_set_abs_info(struct libevdev *dev, unsigned int code, const struct input_absinfo *abs);
1293 
1294 
1301 };
1302 
1316 int libevdev_kernel_set_led_value(struct libevdev *dev, unsigned int code, enum libevdev_led_value value);
1317 
1341 int libevdev_kernel_set_led_values(struct libevdev *dev, ...);
1342 
1357 int libevdev_set_clock_id(struct libevdev *dev, int clockid);
1358 
1380 int libevdev_event_is_type(const struct input_event *ev, unsigned int type);
1381 
1405 int libevdev_event_is_code(const struct input_event *ev, unsigned int type, unsigned int code);
1406 
1418 const char * libevdev_event_type_get_name(unsigned int type);
1431 const char * libevdev_event_code_get_name(unsigned int type, unsigned int code);
1432 
1446 const char* libevdev_property_get_name(unsigned int prop);
1447 
1460 int libevdev_event_type_get_max(unsigned int type);
1461 
1476 int libevdev_event_type_from_name(const char *name);
1477 
1494 int libevdev_event_type_from_name_n(const char *name, size_t len);
1495 
1515 int libevdev_event_code_from_name(unsigned int type, const char *name);
1516 
1538 int libevdev_event_code_from_name_n(unsigned int type, const char *name,
1539  size_t len);
1540 
1554 int libevdev_get_repeat(struct libevdev *dev, int *delay, int *period);
1555 
1556 
1557 /********* DEPRECATED SECTION *********/
1558 #if defined(__GNUC__) && __GNUC__ >= 4
1559 #define LIBEVDEV_DEPRECATED __attribute__ ((deprecated))
1560 #else
1561 #define LIBEVDEV_DEPRECATED
1562 #endif
1563 
1568 
1569 /* replacement: libevdev_kernel_set_abs_info */
1570 int libevdev_kernel_set_abs_value(struct libevdev *dev, unsigned int code, const struct input_absinfo *abs) LIBEVDEV_DEPRECATED;
1571 
1572 
1573 /* replacement: libevdev_set_log_function */
1574 void libevdev_set_log_handler(struct libevdev *dev, libevdev_log_func_t logfunc) LIBEVDEV_DEPRECATED;
1575 
1577 int libevdev_get_event_type_max(unsigned int type) LIBEVDEV_DEPRECATED;
1578 
1580 const char* libevdev_get_property_name(unsigned int prop) LIBEVDEV_DEPRECATED;
1581 
1583 const char * libevdev_get_event_type_name(unsigned int type) LIBEVDEV_DEPRECATED;
1585 const char * libevdev_get_event_code_name(unsigned int type, unsigned int code) LIBEVDEV_DEPRECATED;
1586 
1588 int libevdev_is_event_type(const struct input_event *ev, unsigned int type) LIBEVDEV_DEPRECATED;
1589 
1591 int libevdev_is_event_code(const struct input_event *ev, unsigned int type, unsigned int code) LIBEVDEV_DEPRECATED;
1592 /**************************************/
1593 
1594 #ifdef __cplusplus
1595 }
1596 #endif
1597 
1598 #endif /* LIBEVDEV_H */