LIRC libraries
LinuxInfraredRemoteControl
|
User-space driver API. More...
Files | |
file | driver.h |
Interface to the userspace drivers. | |
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. | |
Data Structures | |
struct | option_t |
struct | driver |
Macros | |
#define | DRV_ERR_NOT_IMPLEMENTED 1 |
#define | DRV_ERR_NOT_IMPLEMENTED 1 |
#define | DRVCTL_GET_STATE 1 |
#define | DRVCTL_SEND_SPACE 2 |
#define | DRVCTL_SET_OPTION 3 |
#define | DRVCTL_MAX 128 |
#define | DRV_ERR_BAD_STATE 2 |
#define | DRV_ERR_BAD_OPTION 3 |
#define | DRV_ERR_BAD_VALUE 4 |
#define | MIN_RECEIVE_TIMEOUT 100000 |
#define | WBUF_SIZE 256 |
Functions | |
int | default_open (const char *path) |
int | default_close (void) |
int | default_drvctl (unsigned int cmd, void *arg) |
int | drv_handle_options (const char *options) |
struct ir_ncode * | ncode_dup (struct ir_ncode *ncode) |
void | ncode_free (struct ir_ncode *ncode) |
const struct ir_remote * | is_in_remotes (const struct ir_remote *remotes, const struct ir_remote *remote) |
struct ir_remote * | get_ir_remote (const struct ir_remote *remotes, const char *name) |
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) |
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) |
char * | decode_all (struct ir_remote *remotes) |
int | send_ir_ncode (struct ir_remote *remote, struct ir_ncode *code, int delay) |
void | ir_remote_init (int use_dyncodes) |
const struct ir_remote * | get_decoding (void) |
void | rec_set_update_mode (int mode) |
void | rec_buffer_set_logfile (FILE *f) |
int | waitfordata (__u32 maxusec) |
void | rec_buffer_init (void) |
int | rec_buffer_clear (void) |
int | receive_decode (struct ir_remote *remote, struct decode_ctx_t *ctx) |
void | rec_buffer_rewind (void) |
void | rec_buffer_reset_wptr (void) |
int | tty_reset (int fd) |
int | tty_setrtscts (int fd, int enable) |
int | tty_setdtr (int fd, int enable) |
int | tty_setbaud (int fd, int baud) |
int | tty_setcsize (int fd, int csize) |
int | tty_create_lock (const char *name) |
int | tty_delete_lock (void) |
int | tty_set (int fd, int rts, int dtr) |
int | tty_clear (int fd, int rts, int dtr) |
int | tty_write (int fd, char byte) |
int | tty_read (int fd, char *byte) |
int | tty_write_echo (int fd, char byte) |
void | send_buffer_init (void) |
int | send_buffer_put (struct ir_remote *remote, struct ir_ncode *code) |
int | send_buffer_length (void) |
const lirc_t * | send_buffer_data (void) |
lirc_t | send_buffer_sum (void) |
Variables | |
struct ir_remote * | last_remote |
struct ir_remote * | repeat_remote |
struct ir_ncode * | repeat_code |
User-space driver API.
Basic interface for user-space drivers, aimed to be included in each driver. It provides basic functionality for sending, receiving and logging.
#define DRV_ERR_NOT_IMPLEMENTED 1 |
#define DRV_ERR_NOT_IMPLEMENTED 1 |
#define DRVCTL_GET_STATE 1 |
#define DRVCTL_MAX 128 |
#define DRVCTL_SEND_SPACE 2 |
#define DRVCTL_SET_OPTION 3 |
#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 724 of file ir_remote.c.
int default_drvctl | ( | unsigned int | cmd, |
void * | arg | ||
) |
int default_open | ( | const char * | path | ) |
int drv_handle_options | ( | const char * | options | ) |
Return code with given name in remote's list of codes or NULL.
Definition at line 389 of file ir_remote.c.
const struct ir_remote* get_decoding | ( | void | ) |
Return pointer to currently decoded remote.
Definition at line 847 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 185 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 148 of file ir_remote.c.
Return ir_remote with given name in remotes list, or NULL if not found.
Definition at line 243 of file ir_remote.c.
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 116 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 231 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 275 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 321 of file ir_remote.c.
Create a malloc'd, deep copy of ncode. Use ncode_free() to dispose().
Create a malloc'd, deep copy of ncode. Use ncode_free() to dispose.
Definition at line 61 of file ir_remote.c.
void ncode_free | ( | struct ir_ncode * | ncode | ) |
Dispose an ir_ncode instance obtained from ncode_dup().
Definition at line 96 of file ir_remote.c.
int rec_buffer_clear | ( | void | ) |
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 372 of file transmit.c.
void send_buffer_init | ( | void | ) |
Clear and re-initiate the buffer.
Initializes the global sending buffer. (Just fills it with zeros.)
Definition at line 55 of file transmit.c.
int send_buffer_length | ( | void | ) |
Do not document this function
Definition at line 366 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 348 of file transmit.c.
lirc_t send_buffer_sum | ( | void | ) |
Definition at line 377 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 816 of file ir_remote.c.
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 | ( | __u32 | maxusec | ) |
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 705 of file ir_remote.c.
struct ir_remote* last_remote |
TODO
Definition at line 51 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 55 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 53 of file ir_remote.c.