libevdev  0.3
A wrapper library for evdev devices
 All Files Functions 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 #include <linux/input.h>
27 #include <stdarg.h>
28 
285 struct libevdev;
286 
294 };
295 
310 struct libevdev* libevdev_new(void);
311 
334 int libevdev_new_from_fd(int fd, struct libevdev **dev);
335 
346 void libevdev_free(struct libevdev *dev);
347 
357 typedef void (*libevdev_log_func_t)(const char *format, va_list args);
358 
369 void libevdev_set_log_handler(struct libevdev *dev, libevdev_log_func_t logfunc);
370 
371 
375 };
376 
393 int libevdev_grab(struct libevdev *dev, int grab);
394 
418 int libevdev_set_fd(struct libevdev* dev, int fd);
419 
440 int libevdev_change_fd(struct libevdev* dev, int fd);
441 
448 int libevdev_get_fd(const struct libevdev* dev);
449 
483 int libevdev_next_event(struct libevdev *dev, unsigned int flags, struct input_event *ev);
484 
507 int libevdev_has_event_pending(struct libevdev *dev);
508 
519 const char* libevdev_get_name(const struct libevdev *dev);
520 
530 void libevdev_set_name(struct libevdev *dev, const char *name);
531 
543 const char * libevdev_get_phys(const struct libevdev *dev);
544 
554 void libevdev_set_phys(struct libevdev *dev, const char *phys);
555 
565 const char * libevdev_get_uniq(const struct libevdev *dev);
566 
576 void libevdev_set_uniq(struct libevdev *dev, const char *uniq);
577 
587 int libevdev_get_id_product(const struct libevdev *dev);
588 
598 void libevdev_set_id_product(struct libevdev *dev, int product_id);
599 
609 int libevdev_get_id_vendor(const struct libevdev *dev);
610 
620 void libevdev_set_id_vendor(struct libevdev *dev, int vendor_id);
621 
631 int libevdev_get_id_bustype(const struct libevdev *dev);
632 
642 void libevdev_set_id_bustype(struct libevdev *dev, int bustype);
643 
653 int libevdev_get_id_version(const struct libevdev *dev);
654 
664 void libevdev_set_id_version(struct libevdev *dev, int version);
665 
675 int libevdev_get_driver_version(const struct libevdev *dev);
676 
687 int libevdev_has_property(const struct libevdev *dev, unsigned int prop);
688 
700 int libevdev_enable_property(struct libevdev *dev, unsigned int prop);
701 
712 int libevdev_has_event_type(const struct libevdev *dev, unsigned int type);
713 
725 int libevdev_has_event_code(const struct libevdev *dev, unsigned int type, unsigned int code);
726 
737 int libevdev_get_abs_minimum(const struct libevdev *dev, unsigned int code);
748 int libevdev_get_abs_maximum(const struct libevdev *dev, unsigned int code);
759 int libevdev_get_abs_fuzz(const struct libevdev *dev, unsigned int code);
770 int libevdev_get_abs_flat(const struct libevdev *dev, unsigned int code);
781 int libevdev_get_abs_resolution(const struct libevdev *dev, unsigned int code);
782 
794 const struct input_absinfo* libevdev_get_abs_info(const struct libevdev *dev, unsigned int code);
795 
814 int libevdev_get_event_value(const struct libevdev *dev, unsigned int type, unsigned int code);
815 
841 int libevdev_fetch_event_value(const struct libevdev *dev, unsigned int type, unsigned int code, int *value);
842 
863 int libevdev_get_slot_value(const struct libevdev *dev, unsigned int slot, unsigned int code);
864 
890 int libevdev_fetch_slot_value(const struct libevdev *dev, unsigned int slot, unsigned int code, int *value);
891 
905 int libevdev_get_num_slots(const struct libevdev *dev);
906 
920 int libevdev_get_current_slot(const struct libevdev *dev);
921 
929 void libevdev_set_abs_minimum(struct libevdev *dev, unsigned int code, int min);
930 
938 void libevdev_set_abs_maximum(struct libevdev *dev, unsigned int code, int max);
939 
947 void libevdev_set_abs_fuzz(struct libevdev *dev, unsigned int code, int fuzz);
948 
956 void libevdev_set_abs_flat(struct libevdev *dev, unsigned int code, int flat);
957 
965 void libevdev_set_abs_resolution(struct libevdev *dev, unsigned int code, int resolution);
966 
974 void libevdev_set_abs_info(struct libevdev *dev, unsigned int code, const struct input_absinfo *abs);
975 
993 int libevdev_enable_event_type(struct libevdev *dev, unsigned int type);
994 
1020 int libevdev_disable_event_type(struct libevdev *dev, unsigned int type);
1021 
1049 int libevdev_enable_event_code(struct libevdev *dev, unsigned int type, unsigned int code, const void *data);
1050 
1078 int libevdev_disable_event_code(struct libevdev *dev, unsigned int type, unsigned int code);
1079 
1094 int libevdev_kernel_set_abs_value(struct libevdev *dev, unsigned int code, const struct input_absinfo *abs);
1095 
1114 int libevdev_is_event_type(const struct input_event *ev, unsigned int type);
1115 
1136 int libevdev_is_event_code(const struct input_event *ev, unsigned int type, unsigned int code);
1137 
1149 const char * libevdev_get_event_type_name(unsigned int type);
1162 const char * libevdev_get_event_code_name(unsigned int type, unsigned int code);
1163 
1177 const char* libevdev_get_property_name(unsigned int prop);
1178 
1191 int libevdev_get_event_type_max(unsigned int type);
1192 
1206 int libevdev_get_repeat(struct libevdev *dev, int *delay, int *period);
1207 
1208 
1209 /********* DEPRECATED SECTION *********/
1210 #if defined(__GNUC__) && __GNUC__ >= 4
1211 #define LIBEVDEV_DEPRECATED __attribute__ ((deprecated))
1212 #else
1213 #define LIBEVDEV_DEPRECATED
1214 #endif
1215 
1216 /* replacement: libevdev_get_abs_minimum */
1217 int libevdev_get_abs_min(const struct libevdev *dev, unsigned int code) LIBEVDEV_DEPRECATED;
1218 /* replacement: libevdev_get_abs_maximum */
1219 int libevdev_get_abs_max(const struct libevdev *dev, unsigned int code) LIBEVDEV_DEPRECATED;
1220 
1221 /* replacement: libevdev_get_property_name */
1222 const char* libevdev_get_input_prop_name(unsigned int prop) LIBEVDEV_DEPRECATED;
1223 
1224 int libevdev_get_product_id(const struct libevdev *dev) LIBEVDEV_DEPRECATED;
1225 int libevdev_get_vendor_id(const struct libevdev *dev) LIBEVDEV_DEPRECATED;
1226 int libevdev_get_bustype(const struct libevdev *dev) LIBEVDEV_DEPRECATED;
1227 int libevdev_get_version(const struct libevdev *dev) LIBEVDEV_DEPRECATED;
1228 
1229 /**************************************/
1230 #endif /* LIBEVDEV_H */