libevdev
1.5.7
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
749
struct
libevdev;
750
754
enum
libevdev_read_flag
{
755
LIBEVDEV_READ_FLAG_SYNC
= 1,
756
LIBEVDEV_READ_FLAG_NORMAL
= 2,
757
LIBEVDEV_READ_FLAG_FORCE_SYNC
= 4,
759
LIBEVDEV_READ_FLAG_BLOCKING
= 8
760
};
761
776
struct
libevdev*
libevdev_new
(
void
);
777
800
int
libevdev_new_from_fd
(
int
fd,
struct
libevdev **dev);
801
815
void
libevdev_free
(
struct
libevdev *dev);
816
820
enum
libevdev_log_priority
{
821
LIBEVDEV_LOG_ERROR
= 10,
822
LIBEVDEV_LOG_INFO
= 20,
823
LIBEVDEV_LOG_DEBUG
= 30
824
};
825
842
typedef
void (*
libevdev_log_func_t
)(
enum
libevdev_log_priority
priority,
843
void
*data,
844
const
char
*file,
int
line,
845
const
char
*func,
846
const
char
*format, va_list args)
847
LIBEVDEV_ATTRIBUTE_PRINTF
(6, 0);
848
867
void
libevdev_set_log_function
(
libevdev_log_func_t
logfunc,
void
*data);
868
881
void
libevdev_set_log_priority
(
enum
libevdev_log_priority
priority);
882
894
enum
libevdev_log_priority
libevdev_get_log_priority
(
void
);
895
915
typedef
void (*
libevdev_device_log_func_t
)(
const
struct
libevdev *dev,
916
enum
libevdev_log_priority
priority,
917
void
*data,
918
const
char
*file,
int
line,
919
const
char
*func,
920
const
char
*format, va_list args)
921
LIBEVDEV_ATTRIBUTE_PRINTF
(7, 0);
922
944
void
libevdev_set_device_log_function
(
struct
libevdev *dev,
945
libevdev_device_log_func_t
logfunc,
946
enum
libevdev_log_priority
priority,
947
void
*data);
948
952
enum
libevdev_grab_mode
{
953
LIBEVDEV_GRAB
= 3,
954
LIBEVDEV_UNGRAB
= 4
955
};
956
975
int
libevdev_grab
(
struct
libevdev *dev,
enum
libevdev_grab_mode
grab);
976
1009
int
libevdev_set_fd
(
struct
libevdev* dev,
int
fd);
1010
1046
int
libevdev_change_fd
(
struct
libevdev* dev,
int
fd);
1047
1056
int
libevdev_get_fd
(
const
struct
libevdev* dev);
1057
1061
enum
libevdev_read_status
{
1068
LIBEVDEV_READ_STATUS_SUCCESS
= 0,
1077
LIBEVDEV_READ_STATUS_SYNC
= 1
1078
};
1079
1130
int
libevdev_next_event
(
struct
libevdev *dev,
unsigned
int
flags,
struct
input_event *ev);
1131
1154
int
libevdev_has_event_pending
(
struct
libevdev *dev);
1155
1170
const
char
*
libevdev_get_name
(
const
struct
libevdev *dev);
1171
1185
void
libevdev_set_name
(
struct
libevdev *dev,
const
char
*name);
1186
1202
const
char
*
libevdev_get_phys
(
const
struct
libevdev *dev);
1203
1217
void
libevdev_set_phys
(
struct
libevdev *dev,
const
char
*phys);
1218
1232
const
char
*
libevdev_get_uniq
(
const
struct
libevdev *dev);
1233
1247
void
libevdev_set_uniq
(
struct
libevdev *dev,
const
char
*uniq);
1248
1258
int
libevdev_get_id_product
(
const
struct
libevdev *dev);
1259
1269
void
libevdev_set_id_product
(
struct
libevdev *dev,
int
product_id);
1270
1280
int
libevdev_get_id_vendor
(
const
struct
libevdev *dev);
1281
1291
void
libevdev_set_id_vendor
(
struct
libevdev *dev,
int
vendor_id);
1292
1302
int
libevdev_get_id_bustype
(
const
struct
libevdev *dev);
1303
1313
void
libevdev_set_id_bustype
(
struct
libevdev *dev,
int
bustype);
1314
1324
int
libevdev_get_id_version
(
const
struct
libevdev *dev);
1325
1335
void
libevdev_set_id_version
(
struct
libevdev *dev,
int
version);
1336
1346
int
libevdev_get_driver_version
(
const
struct
libevdev *dev);
1347
1358
int
libevdev_has_property
(
const
struct
libevdev *dev,
unsigned
int
prop);
1359
1371
int
libevdev_enable_property
(
struct
libevdev *dev,
unsigned
int
prop);
1372
1383
int
libevdev_has_event_type
(
const
struct
libevdev *dev,
unsigned
int
type);
1384
1396
int
libevdev_has_event_code
(
const
struct
libevdev *dev,
unsigned
int
type,
unsigned
int
code);
1397
1410
int
libevdev_get_abs_minimum
(
const
struct
libevdev *dev,
unsigned
int
code);
1411
1424
int
libevdev_get_abs_maximum
(
const
struct
libevdev *dev,
unsigned
int
code);
1425
1438
int
libevdev_get_abs_fuzz
(
const
struct
libevdev *dev,
unsigned
int
code);
1439
1452
int
libevdev_get_abs_flat
(
const
struct
libevdev *dev,
unsigned
int
code);
1453
1466
int
libevdev_get_abs_resolution
(
const
struct
libevdev *dev,
unsigned
int
code);
1467
1481
const
struct
input_absinfo*
libevdev_get_abs_info
(
const
struct
libevdev *dev,
unsigned
int
code);
1482
1505
int
libevdev_get_event_value
(
const
struct
libevdev *dev,
unsigned
int
type,
unsigned
int
code);
1506
1538
int
libevdev_set_event_value
(
struct
libevdev *dev,
unsigned
int
type,
unsigned
int
code,
int
value);
1539
1565
int
libevdev_fetch_event_value
(
const
struct
libevdev *dev,
unsigned
int
type,
unsigned
int
code,
int
*value);
1566
1587
int
libevdev_get_slot_value
(
const
struct
libevdev *dev,
unsigned
int
slot,
unsigned
int
code);
1588
1615
int
libevdev_set_slot_value
(
struct
libevdev *dev,
unsigned
int
slot,
unsigned
int
code,
int
value);
1616
1642
int
libevdev_fetch_slot_value
(
const
struct
libevdev *dev,
unsigned
int
slot,
unsigned
int
code,
int
*value);
1643
1657
int
libevdev_get_num_slots
(
const
struct
libevdev *dev);
1658
1674
int
libevdev_get_current_slot
(
const
struct
libevdev *dev);
1675
1687
void
libevdev_set_abs_minimum
(
struct
libevdev *dev,
unsigned
int
code,
int
min);
1688
1700
void
libevdev_set_abs_maximum
(
struct
libevdev *dev,
unsigned
int
code,
int
max);
1701
1713
void
libevdev_set_abs_fuzz
(
struct
libevdev *dev,
unsigned
int
code,
int
fuzz);
1714
1726
void
libevdev_set_abs_flat
(
struct
libevdev *dev,
unsigned
int
code,
int
flat);
1727
1739
void
libevdev_set_abs_resolution
(
struct
libevdev *dev,
unsigned
int
code,
int
resolution);
1740
1752
void
libevdev_set_abs_info
(
struct
libevdev *dev,
unsigned
int
code,
const
struct
input_absinfo *abs);
1753
1771
int
libevdev_enable_event_type
(
struct
libevdev *dev,
unsigned
int
type);
1772
1799
int
libevdev_disable_event_type
(
struct
libevdev *dev,
unsigned
int
type);
1800
1834
int
libevdev_enable_event_code
(
struct
libevdev *dev,
unsigned
int
type,
unsigned
int
code,
const
void
*data);
1835
1863
int
libevdev_disable_event_code
(
struct
libevdev *dev,
unsigned
int
type,
unsigned
int
code);
1864
1879
int
libevdev_kernel_set_abs_info
(
struct
libevdev *dev,
unsigned
int
code,
const
struct
input_absinfo *abs);
1880
1884
enum
libevdev_led_value
{
1885
LIBEVDEV_LED_ON
= 3,
1886
LIBEVDEV_LED_OFF
= 4
1887
};
1888
1902
int
libevdev_kernel_set_led_value
(
struct
libevdev *dev,
unsigned
int
code,
enum
libevdev_led_value
value);
1903
1927
int
libevdev_kernel_set_led_values
(
struct
libevdev *dev, ...);
1928
1943
int
libevdev_set_clock_id
(
struct
libevdev *dev,
int
clockid);
1944
1966
int
libevdev_event_is_type
(
const
struct
input_event *ev,
unsigned
int
type);
1967
1991
int
libevdev_event_is_code
(
const
struct
input_event *ev,
unsigned
int
type,
unsigned
int
code);
1992
2004
const
char
*
libevdev_event_type_get_name
(
unsigned
int
type);
2017
const
char
*
libevdev_event_code_get_name
(
unsigned
int
type,
unsigned
int
code);
2018
2032
const
char
*
libevdev_property_get_name
(
unsigned
int
prop);
2033
2046
int
libevdev_event_type_get_max
(
unsigned
int
type);
2047
2062
int
libevdev_event_type_from_name
(
const
char
*name);
2063
2080
int
libevdev_event_type_from_name_n
(
const
char
*name,
size_t
len);
2081
2101
int
libevdev_event_code_from_name
(
unsigned
int
type,
const
char
*name);
2102
2124
int
libevdev_event_code_from_name_n
(
unsigned
int
type,
const
char
*name,
2125
size_t
len);
2126
2139
int
libevdev_property_from_name
(
const
char
*name);
2140
2155
int
libevdev_property_from_name_n
(
const
char
*name,
size_t
len);
2156
2174
int
libevdev_get_repeat
(
const
struct
libevdev *dev,
int
*delay,
int
*period);
2175
2176
/********* DEPRECATED SECTION *********/
2177
#if defined(__GNUC__) && __GNUC__ >= 4
2178
#define LIBEVDEV_DEPRECATED __attribute__ ((deprecated))
2179
#else
2180
#define LIBEVDEV_DEPRECATED
2181
#endif
2182
2183
#ifdef __cplusplus
2184
}
2185
#endif
2186
2187
#endif
/* LIBEVDEV_H */
Generated on Mon Jun 27 2022 00:17:23 for libevdev by
1.8.1.2