LIRC libraries
LinuxInfraredRemoteControl
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
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 "include/media/lirc.h"
24 #include "lirc/ir_remote_types.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
31 #define DRV_ERR_NOT_IMPLEMENTED 1
32 
34 int default_open(const char* path);
35 
37 int default_close(void);
38 
40 int default_drvctl(unsigned int cmd, void* arg);
41 
43 struct option_t {
44  char key[32];
45  char value[64];
46 };
47 
52 int drv_handle_options(const char* options);
53 
54 
56 #define DRVCTL_GET_STATE 1
57 
59 #define DRVCTL_SEND_SPACE 2
60 
62 #define DRVCTL_SET_OPTION 3
63 
65 #define DRVCTL_MAX 128
66 
68 #define DRV_ERR_NOT_IMPLEMENTED 1
69 
71 #define DRV_ERR_BAD_STATE 2
72 
74 #define DRV_ERR_BAD_OPTION 3
75 
77 #define DRV_ERR_BAD_VALUE 4
78 
83 struct driver {
84 // Old-style implicit API version 1:
85 
90  const char* device;
91 
93  int fd;
94 
96  __u32 features;
97 
102  __u32 send_mode;
103 
108  __u32 rec_mode;
109 
111  const __u32 code_length;
112 
119  int (*const open_func) (const char* device);
120 
125  int (*const init_func)(void);
126 
131  int (*const deinit_func) (void);
132 
139  int (*const send_func)(struct ir_remote* remote,
140  struct ir_ncode* code);
141 
148  char* (*const rec_func)(struct ir_remote* remotes);
149 
153  int (*const decode_func)(struct ir_remote* remote,
154  struct decode_ctx_t* ctx);
155 
160  int (*const drvctl_func)(unsigned int cmd, void* arg);
161 
169  lirc_t (*const readdata)(lirc_t timeout);
170 
175  const char* name;
176 
181  unsigned int resolution;
182 
183 /* API version 2 addons: */
184 
185  const int api_version;
186  const char* driver_version;
187  const char* info;
189  int (*const close_func)(void);
190 };
191 
194 #ifdef IN_DRIVER
195 
196 extern struct driver drv;
197 #endif
198 
200 extern const struct driver* curr_driver;
201 
202 #ifdef __cplusplus
203 }
204 #endif
205 
206 #endif
__u32 features
Definition: driver.h:96
int(*const send_func)(struct ir_remote *remote, struct ir_ncode *code)
Definition: driver.h:139
int(*const open_func)(const char *device)
Definition: driver.h:119
int default_close(void)
Definition: driver.c:43
int fd
Definition: driver.h:93
const char * info
Definition: driver.h:187
char *(*const rec_func)(struct ir_remote *remotes)
Definition: driver.h:148
unsigned int resolution
Definition: driver.h:181
const __u32 code_length
Definition: driver.h:111
lirc_t(*const readdata)(lirc_t timeout)
Definition: driver.h:169
int(*const drvctl_func)(unsigned int cmd, void *arg)
Definition: driver.h:160
struct driver drv
Definition: driver.c:20
const char * driver_version
Definition: driver.h:186
const int api_version
Definition: driver.h:185
int(*const deinit_func)(void)
Definition: driver.h:131
int default_drvctl(unsigned int cmd, void *arg)
Definition: driver.c:48
Definition: driver.h:83
int drv_handle_options(const char *options)
Definition: driver.c:54
int(*const init_func)(void)
Definition: driver.h:125
const char * name
Definition: driver.h:175
__u32 send_mode
Definition: driver.h:102
int default_open(const char *path)
Definition: driver.c:28
ir_code code
int(*const decode_func)(struct ir_remote *remote, struct decode_ctx_t *ctx)
Definition: driver.h:153
__u32 rec_mode
Definition: driver.h:108
int(*const close_func)(void)
Definition: driver.h:189
const struct driver * curr_driver
Definition: driver.c:26
const char * device
Definition: driver.h:90