driver.h
Go to the documentation of this file.
/****************************************************************************
** driver.h **************************************************************
****************************************************************************
*
* Copyright (C) 1999 Christoph Bartelmus <lirc@bartelmus.de>
*
*/
#ifndef _HARDWARE_H
#define _HARDWARE_H
#include <glob.h>
#ifdef HAVE_KERNEL_LIRC_H
#include <linux/lirc.h>
#else
#include "include/media/lirc.h"
#endif
#include "lirc/ir_remote_types.h"
#include "lirc/curl_poll.h"
#ifdef __cplusplus
extern "C" {
#endif
#define DRV_ERR_NOT_IMPLEMENTED 1
int default_open(const char* path);
int default_close(void);
int default_drvctl(unsigned int cmd, void* arg);
void glob_t_init(glob_t* glob);
void glob_t_free(glob_t* glob);
void glob_t_add_path(glob_t* glob, const char* path);
struct option_t {
char key[32];
char value[64];
};
int drv_handle_options(const char* options);
#define DRVCTL_GET_STATE 1
#define DRVCTL_SEND_SPACE 2
#define DRVCTL_SET_OPTION 3
#define DRVCTL_GET_RAW_CODELENGTH 4
#define DRVCTL_GET_DEVICES 5
#define DRVCTL_FREE_DEVICES 6
#define DRVCTL_NOTIFY_DECODE 7
#define DRVCTL_MAX 128
#define DRV_ERR_NOT_IMPLEMENTED 1
#define DRV_ERR_BAD_STATE 2
#define DRV_ERR_BAD_OPTION 3
#define DRV_ERR_BAD_VALUE 4
struct driver {
// Old-style implicit API version 1:
const char* device;
int fd;
__u32 features;
__u32 send_mode;
__u32 rec_mode;
const __u32 code_length;
int (*const open_func) (const char* device);
int (*const init_func)(void);
int (*const deinit_func) (void);
int (*const send_func)(struct ir_remote* remote,
struct ir_ncode* code);
char* (*const rec_func)(struct ir_remote* remotes);
int (*const decode_func)(struct ir_remote* remote,
struct decode_ctx_t* ctx);
int (*const drvctl_func)(unsigned int cmd, void* arg);
lirc_t (*const readdata)(lirc_t timeout);
const char* name;
unsigned int resolution;
/* API version 2 addons: */
const int api_version;
const char* driver_version;
const char* info;
int (*const close_func)(void);
/* API version 3 addons: */
const char* const device_hint;
};
#ifdef IN_DRIVER
extern struct driver drv;
#endif
extern const struct driver* const curr_driver;
#ifdef __cplusplus
}
#endif
#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