driver Struct Reference
User-space driver API

`#include <driver.h>`

## Data Fields

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
const int | api_version
const char * | driver_version
const char * | info
int(*const | close_func )(void)
const char *const | device_hint

## Detailed Description

The data the driver exports i. e., lirc accesses the driver as defined here.

Definition at line 127 of file driver.h.

## Field Documentation

## api_version

const int driver::api_version

API version (from version 2+).

Definition at line 229 of file driver.h.

## close_func

int(*const driver::close_func) (void)

Hard closing, returns 0 on OK.

Definition at line 233 of file driver.h.

## code_length

const __u32 driver::code_length

Length in bits of the code.

Definition at line 155 of file driver.h.

## decode_func

int(*const driver::decode_func) (struct ir_remote *remote, struct decode_ctx_t *ctx)

TODO

Definition at line 197 of file driver.h.

## deinit_func

int(*const driver::deinit_func) (void)

Function called when transmitting/receiving stops. Zero return value indicates failure, all other return values success.

Definition at line 175 of file driver.h.

## device

const char* driver::device

Name of the device (string). Set by open_func() before init(), possibly using the hard-coded driver default value.

Definition at line 134 of file driver.h.

## device_hint

const char* const driver::device_hint

device_hint is a mean for config tools to autodetect devices.

- /dev/tty* User selects a tty.
- /dev/usb/* Denotes serial, USB-connectd port.
- /dev/event* A devinput device
- /dev/foo* A wildcard listing possible devices, general fallback.
- /bin/sh ... Shell command listing possible devices.
- drvctl Driver supports DRVCTL_GET_DEVICES drvctl.
- None No device is silently configured.
- Auto No device configured, but a message is displayed.

Definition at line 249 of file driver.h.

## driver_version

const char* driver::driver_version

Driver version (free text).

Definition at line 230 of file driver.h.

## drvctl_func

int(*const driver::drvctl_func) (unsigned int cmd, void *arg)

Generic driver control function with semantics as defined by driver Returns 0 on success, else a positive error code.

Definition at line 204 of file driver.h.

## fd

int driver::fd

Set by the driver after init().

Definition at line 137 of file driver.h.

## features

__u32 driver::features

Code for the features of the present device, valid after init().

Definition at line 140 of file driver.h.

## info

const char* driver::info

Free text driver info.

Definition at line 231 of file driver.h.

## init_func

int(*const driver::init_func) (void)

Function called for initializing the driver and the hardware. Zero return value indicates failure, all other return values success.

Definition at line 169 of file driver.h.

## name

const char* driver::name

Driver name, as listed by -H help and used as argument to i –driver.

Definition at line 219 of file driver.h.

## open_func

int(*const driver::open_func) (const char *device)

Function called to do basic driver setup.

Parameters

  device | String describing what device driver should communicate with. Often (but not always) a /dev/... path.

Returns
  0 if everything is fine, else positive error code.

Definition at line 163 of file driver.h.

## readdata

lirc_t(*const driver::readdata) (lirc_t timeout)

Get length of next pulse/space from hardware.

Parameters

  timeout | Max time to wait (us).

Returns
  Length of pulse in lower 24 bits (us). PULSE_BIT is set to reflect if this is a pulse or space. 0 indicates errors.

Definition at line 213 of file driver.h.

## rec_func

char*(*const driver::rec_func) (struct ir_remote *remotes)

Receive data from remote. Might close device on error conditions.

Parameters

  The | remote to read from.

Returns
  Formatted, statically allocated string with decoded data: "remote-name code-name code repetitions"

Definition at line 192 of file driver.h.

## rec_mode

__u32 driver::rec_mode

Possible values are: LIRC_MODE_RAW, LIRC_MODE_PULSE, LIRC_MODE_MODE2, LIRC_MODE_LIRCCODE. These can be combined using bitwise or.

Definition at line 152 of file driver.h.

## resolution

unsigned int driver::resolution

The resolution in microseconds of the recorded durations when reading signals.

Definition at line 225 of file driver.h.

## send_func

int(*const driver::send_func) (struct ir_remote *remote, struct ir_ncode *code)

Send data to the remote.

Parameters

  remote | The remote used to send.
  code | Code(s) to send, a single code or the head of a list of codes.

Definition at line 183 of file driver.h.

## send_mode

__u32 driver::send_mode

Possible values are: LIRC_MODE_RAW, LIRC_MODE_PULSE, LIRC_MODE_MODE2, LIRC_MODE_LIRCCODE. These can be combined using bitwise or.

Definition at line 146 of file driver.h.

The documentation for this struct was generated from the following file:

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