libevdev  0.4
A wrapper library for evdev devices
 All Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
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 
289 struct libevdev;
290 
301 };
302 
317 struct libevdev* libevdev_new(void);
318 
341 int libevdev_new_from_fd(int fd, struct libevdev **dev);
342 
353 void libevdev_free(struct libevdev *dev);
354 
362 };
363 
380 typedef void (*libevdev_log_func_t)(enum libevdev_log_priority priority,
381  void *data,
382  const char *file, int line,
383  const char *func,
384  const char *format, va_list args);
385 
398 void libevdev_set_log_function(libevdev_log_func_t logfunc, void *data);
399 
411 
418 
425 };
426 
445 int libevdev_grab(struct libevdev *dev, enum libevdev_grab_mode grab);
446 
470 int libevdev_set_fd(struct libevdev* dev, int fd);
471 
492 int libevdev_change_fd(struct libevdev* dev, int fd);
493 
502 int libevdev_get_fd(const struct libevdev* dev);
503 
504 
525 };
560 int libevdev_next_event(struct libevdev *dev, unsigned int flags, struct input_event *ev);
561 
584 int libevdev_has_event_pending(struct libevdev *dev);
585 
596 const char* libevdev_get_name(const struct libevdev *dev);
597 
607 void libevdev_set_name(struct libevdev *dev, const char *name);
608 
620 const char * libevdev_get_phys(const struct libevdev *dev);
621 
631 void libevdev_set_phys(struct libevdev *dev, const char *phys);
632 
642 const char * libevdev_get_uniq(const struct libevdev *dev);
643 
653 void libevdev_set_uniq(struct libevdev *dev, const char *uniq);
654 
664 int libevdev_get_id_product(const struct libevdev *dev);
665 
675 void libevdev_set_id_product(struct libevdev *dev, int product_id);
676 
686 int libevdev_get_id_vendor(const struct libevdev *dev);
687 
697 void libevdev_set_id_vendor(struct libevdev *dev, int vendor_id);
698 
708 int libevdev_get_id_bustype(const struct libevdev *dev);
709 
719 void libevdev_set_id_bustype(struct libevdev *dev, int bustype);
720 
730 int libevdev_get_id_version(const struct libevdev *dev);
731 
741 void libevdev_set_id_version(struct libevdev *dev, int version);
742 
752 int libevdev_get_driver_version(const struct libevdev *dev);
753 
764 int libevdev_has_property(const struct libevdev *dev, unsigned int prop);
765 
777 int libevdev_enable_property(struct libevdev *dev, unsigned int prop);
778 
789 int libevdev_has_event_type(const struct libevdev *dev, unsigned int type);
790 
802 int libevdev_has_event_code(const struct libevdev *dev, unsigned int type, unsigned int code);
803 
814 int libevdev_get_abs_minimum(const struct libevdev *dev, unsigned int code);
825 int libevdev_get_abs_maximum(const struct libevdev *dev, unsigned int code);
836 int libevdev_get_abs_fuzz(const struct libevdev *dev, unsigned int code);
847 int libevdev_get_abs_flat(const struct libevdev *dev, unsigned int code);
858 int libevdev_get_abs_resolution(const struct libevdev *dev, unsigned int code);
859 
871 const struct input_absinfo* libevdev_get_abs_info(const struct libevdev *dev, unsigned int code);
872 
895 int libevdev_get_event_value(const struct libevdev *dev, unsigned int type, unsigned int code);
896 
923 int libevdev_set_event_value(struct libevdev *dev, unsigned int type, unsigned int code, int value);
924 
950 int libevdev_fetch_event_value(const struct libevdev *dev, unsigned int type, unsigned int code, int *value);
951 
972 int libevdev_get_slot_value(const struct libevdev *dev, unsigned int slot, unsigned int code);
973 
1000 int libevdev_set_slot_value(struct libevdev *dev, unsigned int slot, unsigned int code, int value);
1001 
1027 int libevdev_fetch_slot_value(const struct libevdev *dev, unsigned int slot, unsigned int code, int *value);
1028 
1042 int libevdev_get_num_slots(const struct libevdev *dev);
1043 
1057 int libevdev_get_current_slot(const struct libevdev *dev);
1058 
1066 void libevdev_set_abs_minimum(struct libevdev *dev, unsigned int code, int min);
1067 
1075 void libevdev_set_abs_maximum(struct libevdev *dev, unsigned int code, int max);
1076 
1084 void libevdev_set_abs_fuzz(struct libevdev *dev, unsigned int code, int fuzz);
1085 
1093 void libevdev_set_abs_flat(struct libevdev *dev, unsigned int code, int flat);
1094 
1102 void libevdev_set_abs_resolution(struct libevdev *dev, unsigned int code, int resolution);
1103 
1111 void libevdev_set_abs_info(struct libevdev *dev, unsigned int code, const struct input_absinfo *abs);
1112 
1130 int libevdev_enable_event_type(struct libevdev *dev, unsigned int type);
1131 
1158 int libevdev_disable_event_type(struct libevdev *dev, unsigned int type);
1159 
1187 int libevdev_enable_event_code(struct libevdev *dev, unsigned int type, unsigned int code, const void *data);
1188 
1216 int libevdev_disable_event_code(struct libevdev *dev, unsigned int type, unsigned int code);
1217 
1232 int libevdev_kernel_set_abs_info(struct libevdev *dev, unsigned int code, const struct input_absinfo *abs);
1233 
1234 
1241 };
1242 
1256 int libevdev_kernel_set_led_value(struct libevdev *dev, unsigned int code, enum libevdev_led_value value);
1257 
1281 int libevdev_kernel_set_led_values(struct libevdev *dev, ...);
1282 
1297 int libevdev_set_clock_id(struct libevdev *dev, int clockid);
1298 
1320 int libevdev_event_is_type(const struct input_event *ev, unsigned int type);
1321 
1345 int libevdev_event_is_code(const struct input_event *ev, unsigned int type, unsigned int code);
1346 
1358 const char * libevdev_event_type_get_name(unsigned int type);
1371 const char * libevdev_event_code_get_name(unsigned int type, unsigned int code);
1372 
1386 const char* libevdev_property_get_name(unsigned int prop);
1387 
1400 int libevdev_event_type_get_max(unsigned int type);
1401 
1415 int libevdev_get_repeat(struct libevdev *dev, int *delay, int *period);
1416 
1417 
1418 /********* DEPRECATED SECTION *********/
1419 #if defined(__GNUC__) && __GNUC__ >= 4
1420 #define LIBEVDEV_DEPRECATED __attribute__ ((deprecated))
1421 #else
1422 #define LIBEVDEV_DEPRECATED
1423 #endif
1424 
1429 
1430 /* replacement: libevdev_kernel_set_abs_info */
1431 int libevdev_kernel_set_abs_value(struct libevdev *dev, unsigned int code, const struct input_absinfo *abs) LIBEVDEV_DEPRECATED;
1432 
1433 
1434 /* replacement: libevdev_set_log_function */
1435 void libevdev_set_log_handler(struct libevdev *dev, libevdev_log_func_t logfunc) LIBEVDEV_DEPRECATED;
1436 
1438 int libevdev_get_event_type_max(unsigned int type) LIBEVDEV_DEPRECATED;
1439 
1441 const char* libevdev_get_property_name(unsigned int prop);
1442 
1444 const char * libevdev_get_event_type_name(unsigned int type) LIBEVDEV_DEPRECATED;
1446 const char * libevdev_get_event_code_name(unsigned int type, unsigned int code) LIBEVDEV_DEPRECATED;
1447 
1449 int libevdev_is_event_type(const struct input_event *ev, unsigned int type);
1450 
1452 int libevdev_is_event_code(const struct input_event *ev, unsigned int type, unsigned int code);
1453 /**************************************/
1454 
1455 #ifdef __cplusplus
1456 }
1457 #endif
1458 
1459 #endif /* LIBEVDEV_H */