LIRC libraries: /home/mk/tmp/lirc/lib/driver.h (8e114f9 2016-10-22 06:11:39 +0200) Source File

| LIRC libraries LinuxInfraredRemoteControl

driver.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** driver.h **************************************************************
3 ****************************************************************************
4 *
5 * Copyright (C) 1999 Christoph Bartelmus <lirc@bartelmus.de>
6 *
7 */
8
20 #ifndef _HARDWARE_H
21 #define _HARDWARE_H
22
23 #include <glob.h>
24
25 #ifdef HAVE_KERNEL_LIRC_H
26 #include <linux/lirc.h>
27 #else
28 #include "include/media/lirc.h"
29 #endif
30
31 #include "lirc/ir_remote_types.h"
32 #include "lirc/curl_poll.h"
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
39 #define DRV_ERR_NOT_IMPLEMENTED 1
40
42 int default_open(const char* path);
43
45 int default_close(void);
46
48 int default_drvctl(unsigned int cmd, void* arg);
49
51 void glob_t_init(glob_t* glob);
52
54 void glob_t_free(glob_t* glob);
55
57 void glob_t_add_path(glob_t* glob, const char* path);
58
60 struct option_t {
61 char key[32];
62 char value[64];
63 };
64
69 int drv_handle_options(const char* options);
70
71
73 #define DRVCTL_GET_STATE 1
74
76 #define DRVCTL_SEND_SPACE 2
77
79 #define DRVCTL_SET_OPTION 3
80
85 #define DRVCTL_GET_RAW_CODELENGTH 4
86
96 #define DRVCTL_GET_DEVICES 5
97
99 #define DRVCTL_FREE_DEVICES 6
100
106 #define DRVCTL_NOTIFY_DECODE 7
107
109 #define DRVCTL_MAX 128
110
112 #define DRV_ERR_NOT_IMPLEMENTED 1
113
115 #define DRV_ERR_BAD_STATE 2
116
118 #define DRV_ERR_BAD_OPTION 3
119
121 #define DRV_ERR_BAD_VALUE 4
122
127 struct driver {
128 // Old-style implicit API version 1:
129
134 const char* device;
135
137 int fd;
138
140 __u32 features;
141
146 __u32 send_mode;
147
152 __u32 rec_mode;
153
155 const __u32 code_length;
156
163 int (*const open_func) (const char* device);
164
169 int (*const init_func)(void);
170
175 int (*const deinit_func) (void);
176
183 int (*const send_func)(struct ir_remote* remote,
184 struct ir_ncode* code);
185
192 char* (*const rec_func)(struct ir_remote* remotes);
193
197 int (*const decode_func)(struct ir_remote* remote,
198 struct decode_ctx_t* ctx);
199
204 int (*const drvctl_func)(unsigned int cmd, void* arg);
205
213 lirc_t (*const readdata)(lirc_t timeout);
214
219 const char* name;
220
225 unsigned int resolution;
226
227 /* API version 2 addons: */
228
229 const int api_version;
230 const char* driver_version;
231 const char* info;
233 int (*const close_func)(void);
235 /* API version 3 addons: */
249 const char* const device_hint;
250 };
251
254 #ifdef IN_DRIVER
255
256 extern struct driver drv;
257 #endif
258
260 extern const struct driver* const curr_driver;
261
262
263 #ifdef __cplusplus
264 }
265 #endif
266
267 #endif
driver::features
__u32 features
Definition: driver.h:140
ir_remote
Definition: ir_remote_types.h:167
option_t
Definition: driver.h:60
default_close
int default_close(void)
Definition: driver.c:79
driver::fd
int fd
Definition: driver.h:137
driver::info
const char * info
Definition: driver.h:231
curr_driver
const struct driver *const curr_driver
Definition: driver.c:28
driver::resolution
unsigned int resolution
Definition: driver.h:225
glob_t_init
void glob_t_init(glob_t *glob)
Definition: driver.c:34
driver::code_length
const __u32 code_length
Definition: driver.h:155
drv
struct driver drv
Definition: driver.c:22
driver::driver_version
const char * driver_version
Definition: driver.h:230
driver::api_version
const int api_version
Definition: driver.h:229
driver::rec_func
char *(*const rec_func)(struct ir_remote *remotes)
Definition: driver.h:192
default_drvctl
int default_drvctl(unsigned int cmd, void *arg)
Definition: driver.c:84
driver
Definition: driver.h:127
glob_t_add_path
void glob_t_add_path(glob_t *glob, const char *path)
Definition: driver.c:42
ir_ncode
Definition: ir_remote_types.h:76
decode_ctx_t
Definition: ir_remote_types.h:154
drv_handle_options
int drv_handle_options(const char *options)
Definition: driver.c:90
driver::device_hint
const char *const device_hint
Definition: driver.h:249
driver::name
const char * name
Definition: driver.h:219
driver::send_mode
__u32 send_mode
Definition: driver.h:146
default_open
int default_open(const char *path)
Definition: driver.c:64
ir_ncode::code
ir_code code
Definition: ir_remote_types.h:81
driver::rec_mode
__u32 rec_mode
Definition: driver.h:152
driver::device
const char * device
Definition: driver.h:134
glob_t_free
void glob_t_free(glob_t *glob)
Definition: driver.c:54