LIRC libraries
LinuxInfraredRemoteControl
|
Basic interface for user-space drivers, aimed to be included in each driver. More...
Files | |
file | driver.h |
Interface to the userspace drivers. | |
file | drv_enum.c |
Implemenents drv_enum.h. | |
file | drv_enum.h |
dynamic drivers device enumeration support | |
file | ir_remote.h |
Describes and decodes the signals from IR remotes. | |
file | lirc_config.h |
Local configuration constants not managed by autotools. | |
file | lirc_log.h |
Logging functionality. | |
file | receive.h |
Functions that decode IR codes. | |
file | serial.h |
Common routines for hw that uses the standard serial port driver. | |
file | transmit.h |
Functions that prepare IR codes for transmitting. | |
Classes | |
struct | option_t |
Argument for DRV_SET_OPTION. More... | |
struct | driver |
The data the driver exports i. More... | |
Macros | |
#define | MAXPATHLEN 4096 |
#define | HAVE_SERVER_VERSION 1 |
Testable flag for get_server_version() presence. More... | |
#define | DRV_ERR_NOT_IMPLEMENTED 1 |
drvctl definitions More... | |
#define | DRV_ERR_NOT_IMPLEMENTED 1 |
drvctl definitions More... | |
#define | DRVCTL_GET_STATE 1 |
Drvctl cmd: return current state as an int in *arg. More... | |
#define | DRVCTL_SEND_SPACE 2 |
Drvctl cmd: Send long space. More... | |
#define | DRVCTL_SET_OPTION 3 |
Drvctl cmd: Set driver options. More... | |
#define | DRVCTL_GET_RAW_CODELENGTH 4 |
Drvctl cmd: get raw length to read, if different than codelength. More... | |
#define | DRVCTL_GET_DEVICES 5 |
Drvctl cmd: get list of possible devices. More... | |
#define | DRVCTL_FREE_DEVICES 6 |
drvctl cmd: Free memory in argument obtained using DRVCTL_GET_DEVICES. More... | |
#define | DRVCTL_NOTIFY_DECODE 7 |
The former LIRC_NOTIFY_DECODE, informs drier that signal is successfully decoded e. More... | |
#define | DRVCTL_MAX 128 |
Last well-known command. More... | |
#define | DRV_ERR_BAD_STATE 2 |
drvctl error: cmd and arg is OK, but other errors. More... | |
#define | DRV_ERR_BAD_OPTION 3 |
drvctl error: cmd is bad | |
#define | DRV_ERR_BAD_VALUE 4 |
drvctl error: arg is bad | |
#define | DRV_ERR_ENUM_EMPTY 5 |
No requested data available. More... | |
#define | DRV_ERR_INTERNAL 6 |
drvctl error: "Should not happen" type of errors. More... | |
#define | MIN_RECEIVE_TIMEOUT 100000 |
Min value returned by receive_timeout. More... | |
#define | WBUF_SIZE 256 |
Functions | |
int | get_server_version (void) |
Return numeric server version, m.v.r => 10000 * m + 100 * v + r. More... | |
int | default_open (const char *path) |
Stores path in drv.device if non-null. More... | |
int | default_close (void) |
For now, a placeholder. More... | |
int | default_drvctl (unsigned int cmd, void *arg) |
Return DRV_ERR_NOTIMPLEMENTED. More... | |
int | drv_handle_options (const char *options) |
Parse an option string "key:value;key:value..." and invoke drvctl DRV_SET_OPTION as appropriate. | |
struct ir_ncode * | ncode_dup (struct ir_ncode *ncode) |
Create a malloc'd, deep copy of ncode. More... | |
void | ncode_free (struct ir_ncode *ncode) |
Dispose an ir_ncode instance obtained from ncode_dup(). More... | |
const struct ir_remote * | is_in_remotes (const struct ir_remote *remotes, const struct ir_remote *remote) |
Test if a given remote is in a list of remotes. More... | |
struct ir_remote * | get_ir_remote (const struct ir_remote *remotes, const char *name) |
Return ir_remote with given name in remotes list, or NULL if not found. More... | |
void | get_frequency_range (const struct ir_remote *remotes, unsigned int *min_freq, unsigned int *max_freq) |
void | get_filter_parameters (const struct ir_remote *remotes, lirc_t *max_gap_lengthp, lirc_t *min_pulse_lengthp, lirc_t *min_space_lengthp, lirc_t *max_pulse_lengthp, lirc_t *max_space_lengthp) |
int | map_code (const struct ir_remote *remote, struct decode_ctx_t *ctx, int pre_bits, ir_code pre, int bits, ir_code code, int post_bits, ir_code post) |
void | map_gap (const struct ir_remote *remote, struct decode_ctx_t *ctx, const struct timeval *start, const struct timeval *last, lirc_t signal_length) |
struct ir_ncode * | get_code_by_name (const struct ir_remote *remote, const char *name) |
Return code with given name in remote's list of codes or NULL. More... | |
int | write_message (char *buffer, size_t size, const char *remote_name, const char *button_name, const char *button_suffix, ir_code code, int reps) |
Formats the arguments into a readable string. More... | |
char * | decode_all (struct ir_remote *remotes) |
Tries to decode current signal trying all known remotes. More... | |
int | send_ir_ncode (struct ir_remote *remote, struct ir_ncode *code, int delay) |
Transmits the actual code in the second argument by calling the current hardware driver. More... | |
void | ir_remote_init (int use_dyncodes) |
Initiate: define if dynamic codes should be used. More... | |
const struct ir_remote * | get_decoding (void) |
Return pointer to currently decoded remote. More... | |
void | rec_set_update_mode (int mode) |
Set update mode, where recorded pre_data is verified to match the template pre_data. More... | |
void | rec_buffer_set_logfile (FILE *f) |
Set a file logging input from driver in same format as mode2(1). More... | |
int | waitfordata (uint32_t maxusec) |
If set_waitfordata(func) is called, invoke and return function set this way. More... | |
void | set_waitfordata_func (int(*func)(uint32_t maxusec)) |
Set the function used by waitfordata(). More... | |
void | rec_buffer_init (void) |
Clear internal buffer to pristine state. More... | |
int | rec_buffer_clear (void) |
Flush the internal fifo and store a single code read from the driver in it. | |
int | receive_decode (struct ir_remote *remote, struct decode_ctx_t *ctx) |
Decode data from remote. More... | |
void | rec_buffer_rewind (void) |
Reset the modules's internal fifo's read state to initial values where the nothing is read. More... | |
void | rec_buffer_reset_wptr (void) |
Reset internal fifo's write pointer. More... | |
int | tty_reset (int fd) |
Set the cfmakeraw termio options. More... | |
int | tty_setrtscts (int fd, int enable) |
Set/clear CTS control line. More... | |
int | tty_setdtr (int fd, int enable) |
Set/clear DTR control line. More... | |
int | tty_setbaud (int fd, int baud) |
Set the speed a. More... | |
int | tty_setcsize (int fd, int csize) |
Set the character size. More... | |
int | tty_create_lock (const char *name) |
Creates a lock file of the type /var/local/LCK. More... | |
int | tty_delete_lock (void) |
Delete any legacy lock(s) owned by this process. More... | |
int | tty_set (int fd, int rts, int dtr) |
Set RTS and DTR control lines. More... | |
int | tty_clear (int fd, int rts, int dtr) |
Clear RTS and DTR control lines. More... | |
int | tty_write (int fd, char byte) |
Write a single byte to serial device. More... | |
int | tty_read (int fd, char *byte) |
Read a single byte from serial device. More... | |
int | tty_write_echo (int fd, char byte) |
Write a single byte and check the echo from remote party. More... | |
void | send_buffer_init (void) |
Clear and re-initiate the buffer. More... | |
int | send_buffer_put (struct ir_remote *remote, struct ir_ncode *code) |
Initializes the global send buffer for transmitting the code in the second argument, residing in the remote in the first. More... | |
int | send_buffer_length (void) |
Do not document this function. More... | |
const lirc_t * | send_buffer_data (void) |
lirc_t | send_buffer_sum (void) |
Variables | |
struct ir_remote * | last_remote |
TODO. | |
struct ir_remote * | repeat_remote |
Global pointer to the remote that contains the code currently repeating. More... | |
struct ir_ncode * | repeat_code |
Global pointer to the code currently repeating. More... | |
Basic interface for user-space drivers, aimed to be included in each driver.
User-space driver API.
It provides basic functionality for sending, receiving and logging.
#define DRV_ERR_BAD_STATE 2 |
#define DRV_ERR_INTERNAL 6 |
#define DRV_ERR_NOT_IMPLEMENTED 1 |
#define DRV_ERR_NOT_IMPLEMENTED 1 |
#define DRVCTL_FREE_DEVICES 6 |
#define DRVCTL_GET_DEVICES 5 |
Drvctl cmd: get list of possible devices.
Argument is a *glob_t as defined in <glob.h>. The returned memory is owned by driver and should be free()'d using DRVCTL_FREE_DEVICES.
Each string in glob is a space-separated list of words. The first word is the mandatory device path, the optional reminder is information about the device suitable in user interfaces.
#define DRVCTL_GET_RAW_CODELENGTH 4 |
#define DRVCTL_GET_STATE 1 |
#define DRVCTL_MAX 128 |
#define DRVCTL_NOTIFY_DECODE 7 |
#define DRVCTL_SEND_SPACE 2 |
#define DRVCTL_SET_OPTION 3 |
#define HAVE_SERVER_VERSION 1 |
Testable flag for get_server_version() presence.
#define MIN_RECEIVE_TIMEOUT 100000 |
char* decode_all | ( | struct ir_remote * | remotes | ) |
Tries to decode current signal trying all known remotes.
This is non-blocking, failures could be retried later when more data is available.
remotes | Parsed lircd.conf file as returned by read_config() |
Definition at line 733 of file ir_remote.c.
int default_drvctl | ( | unsigned int | cmd, |
void * | arg | ||
) |
int default_open | ( | const char * | path | ) |
Return code with given name in remote's list of codes or NULL.
Definition at line 397 of file ir_remote.c.
const struct ir_remote* get_decoding | ( | void | ) |
Return pointer to currently decoded remote.
Definition at line 854 of file ir_remote.c.
void get_filter_parameters | ( | const struct ir_remote * | remotes, |
lirc_t * | max_gap_lengthp, | ||
lirc_t * | min_pulse_lengthp, | ||
lirc_t * | min_space_lengthp, | ||
lirc_t * | max_pulse_lengthp, | ||
lirc_t * | max_space_lengthp | ||
) |
remotes | |
max_gap_lengthp | |
min_pulse_lengthp | |
min_space_lengthp | |
max_pulse_lengthp | |
max_space_lengthp |
Definition at line 193 of file ir_remote.c.
void get_frequency_range | ( | const struct ir_remote * | remotes, |
unsigned int * | min_freq, | ||
unsigned int * | max_freq | ||
) |
remotes | |
min_freq | |
max_freq |
Definition at line 156 of file ir_remote.c.
Return ir_remote with given name in remotes list, or NULL if not found.
Definition at line 251 of file ir_remote.c.
int get_server_version | ( | void | ) |
void ir_remote_init | ( | int | use_dyncodes | ) |
Initiate: define if dynamic codes should be used.
use_dyncodes | Should normally reflect "lircd:dynamic-codes" option. |
Definition at line 124 of file ir_remote.c.
const struct ir_remote* is_in_remotes | ( | const struct ir_remote * | remotes, |
const struct ir_remote * | remote | ||
) |
Test if a given remote is in a list of remotes.
remotes | Head of linked list of remotes (using remote.next). |
remote | Pointer to remote to check |
remotes | |
remote |
Definition at line 239 of file ir_remote.c.
int map_code | ( | const struct ir_remote * | remote, |
struct decode_ctx_t * | ctx, | ||
int | pre_bits, | ||
ir_code | pre, | ||
int | bits, | ||
ir_code | code, | ||
int | post_bits, | ||
ir_code | post | ||
) |
remote | |
prep | |
codep | |
postp | |
pre_bits | |
pre | |
bits | |
code | |
post_bits | |
post |
Definition at line 283 of file ir_remote.c.
void map_gap | ( | const struct ir_remote * | remote, |
struct decode_ctx_t * | ctx, | ||
const struct timeval * | start, | ||
const struct timeval * | last, | ||
lirc_t | signal_length | ||
) |
remote | |
start | |
last | |
signal_length | |
repeat_flagp | |
min_remaining_gapp | |
max_remaining_gapp |
Definition at line 329 of file ir_remote.c.
Create a malloc'd, deep copy of ncode.
Use ncode_free() to dispose().
Use ncode_free() to dispose.
Definition at line 69 of file ir_remote.c.
void ncode_free | ( | struct ir_ncode * | ncode | ) |
Dispose an ir_ncode instance obtained from ncode_dup().
Definition at line 104 of file ir_remote.c.
void rec_buffer_init | ( | void | ) |
void rec_buffer_reset_wptr | ( | void | ) |
void rec_buffer_rewind | ( | void | ) |
void rec_buffer_set_logfile | ( | FILE * | f | ) |
void rec_set_update_mode | ( | int | mode | ) |
int receive_decode | ( | struct ir_remote * | remote, |
struct decode_ctx_t * | ctx | ||
) |
const lirc_t* send_buffer_data | ( | void | ) |
Definition at line 379 of file transmit.c.
void send_buffer_init | ( | void | ) |
Clear and re-initiate the buffer.
Clear and re-initiate the buffer.
(Just fills it with zeros.)
Definition at line 62 of file transmit.c.
int send_buffer_length | ( | void | ) |
Do not document this function.
Definition at line 373 of file transmit.c.
Initializes the global send buffer for transmitting the code in the second argument, residing in the remote in the first.
Definition at line 355 of file transmit.c.
lirc_t send_buffer_sum | ( | void | ) |
Definition at line 384 of file transmit.c.
Transmits the actual code in the second argument by calling the current hardware driver.
The processing depends on global repeat-remote. If this is not-NULL, the codes are sent using repeat formatting if the remote supports it.
remote | Currently active remote, used as database for timing, and as keeper of an internal state. |
code | IR code to be transmitted |
delay | If true (normal case), generate a delay corresponding to the time it takes to send the code. If not (test case), don't. |
Definition at line 823 of file ir_remote.c.
void set_waitfordata_func | ( | int(*)(uint32_t maxusec) | func | ) |
Set the function used by waitfordata().
int tty_clear | ( | int | fd, |
int | rts, | ||
int | dtr | ||
) |
int tty_create_lock | ( | const char * | name | ) |
Creates a lock file of the type /var/local/LCK.
. + name
name | Name of the device |
int tty_delete_lock | ( | void | ) |
Delete any legacy lock(s) owned by this process.
int tty_read | ( | int | fd, |
char * | byte | ||
) |
int tty_reset | ( | int | fd | ) |
int tty_set | ( | int | fd, |
int | rts, | ||
int | dtr | ||
) |
int tty_setbaud | ( | int | fd, |
int | baud | ||
) |
int tty_setcsize | ( | int | fd, |
int | csize | ||
) |
int tty_setdtr | ( | int | fd, |
int | enable | ||
) |
int tty_setrtscts | ( | int | fd, |
int | enable | ||
) |
int tty_write | ( | int | fd, |
char | byte | ||
) |
int tty_write_echo | ( | int | fd, |
char | byte | ||
) |
Write a single byte and check the echo from remote party.
Makes a log printout if these don't match.
fd | File opened on a serial device. |
byte | Byte to be written. |
int waitfordata | ( | uint32_t | maxusec | ) |
If set_waitfordata(func) is called, invoke and return function set this way.
Otherwise wait until data is available in drv.fd, timeout or a signal is raised.
maxusec | timeout in micro seconds, given to poll(2). If <= 0, the function will block indefinitely until data is available or a signal is processed. If positive, a timeout value in microseconds. |
int write_message | ( | char * | buffer, |
size_t | size, | ||
const char * | remote_name, | ||
const char * | button_name, | ||
const char * | button_suffix, | ||
ir_code | code, | ||
int | reps | ||
) |
Formats the arguments into a readable string.
buffer | Formatted string on exit. |
size | Size of buffer. |
remote_name | |
button_name | |
button_suffix | |
code | |
reps |
Definition at line 713 of file ir_remote.c.
struct ir_ncode* repeat_code |
Global pointer to the code currently repeating.
Defined in ir_remote.c.
Definition at line 63 of file ir_remote.c.
struct ir_remote* repeat_remote |
Global pointer to the remote that contains the code currently repeating.
Defined in ir_remote.c.
Definition at line 61 of file ir_remote.c.