libevdev
1.3
A wrapper library for evdev devices
Main Page
Related Pages
Modules
Files
File List
Globals
All
Files
Functions
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
libevdev
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
743
enum
libevdev_read_flag
{
744
LIBEVDEV_READ_FLAG_SYNC
= 1,
745
LIBEVDEV_READ_FLAG_NORMAL
= 2,
746
LIBEVDEV_READ_FLAG_FORCE_SYNC
= 4,
748
LIBEVDEV_READ_FLAG_BLOCKING
= 8
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
806
enum
libevdev_log_priority
{
807
LIBEVDEV_LOG_ERROR
= 10,
808
LIBEVDEV_LOG_INFO
= 20,
809
LIBEVDEV_LOG_DEBUG
= 30
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)
833
LIBEVDEV_ATTRIBUTE_PRINTF
(6, 0);
834
853
void
libevdev_set_log_function
(
libevdev_log_func_t
logfunc,
void
*data);
854
867
void
libevdev_set_log_priority
(
enum
libevdev_log_priority
priority);
868
880
enum
libevdev_log_priority
libevdev_get_log_priority
(
void
);
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)
907
LIBEVDEV_ATTRIBUTE_PRINTF
(7, 0);
908
930
void
libevdev_set_device_log_function
(
struct
libevdev *dev,
931
libevdev_device_log_func_t
logfunc,
932
enum
libevdev_log_priority
priority,
933
void
*data);
934
938
enum
libevdev_grab_mode
{
939
LIBEVDEV_GRAB
= 3,
940
LIBEVDEV_UNGRAB
= 4
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
1035
1039
enum
libevdev_read_status
{
1046
LIBEVDEV_READ_STATUS_SUCCESS
= 0,
1055
LIBEVDEV_READ_STATUS_SYNC
= 1
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);
1400
int
libevdev_get_abs_maximum
(
const
struct
libevdev *dev,
unsigned
int
code);
1413
int
libevdev_get_abs_fuzz
(
const
struct
libevdev *dev,
unsigned
int
code);
1426
int
libevdev_get_abs_flat
(
const
struct
libevdev *dev,
unsigned
int
code);
1439
int
libevdev_get_abs_resolution
(
const
struct
libevdev *dev,
unsigned
int
code);
1440
1454
const
struct
input_absinfo*
libevdev_get_abs_info
(
const
struct
libevdev *dev,
unsigned
int
code);
1455
1478
int
libevdev_get_event_value
(
const
struct
libevdev *dev,
unsigned
int
type,
unsigned
int
code);
1479
1511
int
libevdev_set_event_value
(
struct
libevdev *dev,
unsigned
int
type,
unsigned
int
code,
int
value);
1512
1538
int
libevdev_fetch_event_value
(
const
struct
libevdev *dev,
unsigned
int
type,
unsigned
int
code,
int
*value);
1539
1560
int
libevdev_get_slot_value
(
const
struct
libevdev *dev,
unsigned
int
slot,
unsigned
int
code);
1561
1588
int
libevdev_set_slot_value
(
struct
libevdev *dev,
unsigned
int
slot,
unsigned
int
code,
int
value);
1589
1615
int
libevdev_fetch_slot_value
(
const
struct
libevdev *dev,
unsigned
int
slot,
unsigned
int
code,
int
*value);
1616
1630
int
libevdev_get_num_slots
(
const
struct
libevdev *dev);
1631
1647
int
libevdev_get_current_slot
(
const
struct
libevdev *dev);
1648
1660
void
libevdev_set_abs_minimum
(
struct
libevdev *dev,
unsigned
int
code,
int
min);
1661
1673
void
libevdev_set_abs_maximum
(
struct
libevdev *dev,
unsigned
int
code,
int
max);
1674
1686
void
libevdev_set_abs_fuzz
(
struct
libevdev *dev,
unsigned
int
code,
int
fuzz);
1687
1699
void
libevdev_set_abs_flat
(
struct
libevdev *dev,
unsigned
int
code,
int
flat);
1700
1712
void
libevdev_set_abs_resolution
(
struct
libevdev *dev,
unsigned
int
code,
int
resolution);
1713
1725
void
libevdev_set_abs_info
(
struct
libevdev *dev,
unsigned
int
code,
const
struct
input_absinfo *abs);
1726
1744
int
libevdev_enable_event_type
(
struct
libevdev *dev,
unsigned
int
type);
1745
1772
int
libevdev_disable_event_type
(
struct
libevdev *dev,
unsigned
int
type);
1773
1807
int
libevdev_enable_event_code
(
struct
libevdev *dev,
unsigned
int
type,
unsigned
int
code,
const
void
*data);
1808
1836
int
libevdev_disable_event_code
(
struct
libevdev *dev,
unsigned
int
type,
unsigned
int
code);
1837
1852
int
libevdev_kernel_set_abs_info
(
struct
libevdev *dev,
unsigned
int
code,
const
struct
input_absinfo *abs);
1853
1854
1858
enum
libevdev_led_value
{
1859
LIBEVDEV_LED_ON
= 3,
1860
LIBEVDEV_LED_OFF
= 4
1861
};
1862
1876
int
libevdev_kernel_set_led_value
(
struct
libevdev *dev,
unsigned
int
code,
enum
libevdev_led_value
value);
1877
1901
int
libevdev_kernel_set_led_values
(
struct
libevdev *dev, ...);
1902
1917
int
libevdev_set_clock_id
(
struct
libevdev *dev,
int
clockid);
1918
1940
int
libevdev_event_is_type
(
const
struct
input_event *ev,
unsigned
int
type);
1941
1965
int
libevdev_event_is_code
(
const
struct
input_event *ev,
unsigned
int
type,
unsigned
int
code);
1966
1978
const
char
*
libevdev_event_type_get_name
(
unsigned
int
type);
1991
const
char
*
libevdev_event_code_get_name
(
unsigned
int
type,
unsigned
int
code);
1992
2006
const
char
*
libevdev_property_get_name
(
unsigned
int
prop);
2007
2020
int
libevdev_event_type_get_max
(
unsigned
int
type);
2021
2036
int
libevdev_event_type_from_name
(
const
char
*name);
2037
2054
int
libevdev_event_type_from_name_n
(
const
char
*name,
size_t
len);
2055
2075
int
libevdev_event_code_from_name
(
unsigned
int
type,
const
char
*name);
2076
2098
int
libevdev_event_code_from_name_n
(
unsigned
int
type,
const
char
*name,
2099
size_t
len);
2100
2113
int
libevdev_property_from_name
(
const
char
*name);
2114
2129
int
libevdev_property_from_name_n
(
const
char
*name,
size_t
len);
2130
2148
int
libevdev_get_repeat
(
const
struct
libevdev *dev,
int
*delay,
int
*period);
2149
2150
2151
/********* DEPRECATED SECTION *********/
2152
#if defined(__GNUC__) && __GNUC__ >= 4
2153
#define LIBEVDEV_DEPRECATED __attribute__ ((deprecated))
2154
#else
2155
#define LIBEVDEV_DEPRECATED
2156
#endif
2157
2158
#ifdef __cplusplus
2159
}
2160
#endif
2161
2162
#endif
/* LIBEVDEV_H */
Generated on Tue Oct 28 2014 15:46:41 for libevdev by
1.8.1.2