LIRC libraries
LinuxInfraredRemoteControl
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Modules Pages
driver.h
Go to the documentation of this file.
1 
2 /****************************************************************************
3  ** driver.h **************************************************************
4  ****************************************************************************
5  *
6  * Copyright (C) 1999 Christoph Bartelmus <lirc@bartelmus.de>
7  *
8  */
9 
21 #ifndef _HARDWARE_H
22 #define _HARDWARE_H
23 
24 #include "include/media/lirc.h"
25 #include "lirc/ir_remote_types.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
32 #define DRV_ERR_NOT_IMPLEMENTED 1
33 
35 int default_open(const char* path);
36 
38 int default_close(void);
39 
41 int default_drvctl(unsigned int cmd, void* arg);
42 
44 struct option_t {
45  char key[32];
46  char value[64];
47 };
48 
53 int drv_handle_options(const char* options);
54 
55 
57 #define DRVCTL_GET_STATE 1
58 
60 #define DRVCTL_SEND_SPACE 2
61 
63 #define DRVCTL_SET_OPTION 3
64 
66 #define DRVCTL_MAX 128
67 
69 #define DRV_ERR_NOT_IMPLEMENTED 1
70 
72 #define DRV_ERR_BAD_STATE 2
73 
75 #define DRV_ERR_BAD_OPTION 3
76 
81 struct driver {
82 // Old-style implicit API version 1:
83 
85  const char* device;
86 
88  int fd;
89 
91  __u32 features;
92 
97  __u32 send_mode;
98 
103  __u32 rec_mode;
104 
106  const __u32 code_length;
107 
114  int (*const open_func) (const char* device);
115 
120  int (*const init_func) (void);
121 
126  int (*const deinit_func) (void);
127 
134  int (*const send_func)(struct ir_remote* remote,
135  struct ir_ncode* code);
136 
143  char* (*const rec_func)(struct ir_remote* remotes);
144 
148  int (*const decode_func)(struct ir_remote* remote,
149  struct decode_ctx_t* ctx);
150 
155  int (*const drvctl_func)(unsigned int cmd, void* arg);
156 
164  lirc_t (*const readdata)(lirc_t timeout);
165 
170  const char* name;
171 
176  unsigned int resolution;
177 
178 // API version 2 addons:
179 
180  const int api_version;
181  const char* driver_version;
182  int (*const close_func)(void);
183  const char* info;
185 };
186 
189 #ifdef IN_DRIVER
190 
191 extern struct driver drv;
192 #endif
193 
195 extern const struct driver* curr_driver;
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 
201 #endif
__u32 features
Definition: driver.h:91
int(*const send_func)(struct ir_remote *remote, struct ir_ncode *code)
Definition: driver.h:134
int(*const open_func)(const char *device)
Definition: driver.h:114
int default_close(void)
Definition: driver.c:34
int fd
Definition: driver.h:88
const char * info
Definition: driver.h:183
char *(*const rec_func)(struct ir_remote *remotes)
Definition: driver.h:143
unsigned int resolution
Definition: driver.h:176
const __u32 code_length
Definition: driver.h:106
lirc_t(*const readdata)(lirc_t timeout)
Definition: driver.h:164
int(*const drvctl_func)(unsigned int cmd, void *arg)
Definition: driver.h:155
struct driver drv
Definition: driver.c:18
const char * driver_version
Definition: driver.h:181
const int api_version
Definition: driver.h:180
int(*const deinit_func)(void)
Definition: driver.h:126
int default_drvctl(unsigned int cmd, void *arg)
Definition: driver.c:39
Definition: driver.h:81
int drv_handle_options(const char *options)
Definition: driver.c:45
int(*const init_func)(void)
Definition: driver.h:120
const char * name
Definition: driver.h:170
__u32 send_mode
Definition: driver.h:97
int default_open(const char *path)
Definition: driver.c:26
ir_code code
int(*const decode_func)(struct ir_remote *remote, struct decode_ctx_t *ctx)
Definition: driver.h:148
__u32 rec_mode
Definition: driver.h:103
int(*const close_func)(void)
Definition: driver.h:182
const struct driver * curr_driver
Definition: driver.c:24
const char * device
Definition: driver.h:85