LIRC libraries
LinuxInfraredRemoteControl
irrecord.c File Reference

Implements irrecord.h. More...

#include <stdint.h>
#include <unistd.h>
#include <poll.h>
#include "lirc_private.h"
#include "irrecord.h"

Go to the source code of this file.

Functions

void btn_state_set_message (struct button_state *state, const char *fmt,...)
 snprintf-style message formatting into state->message. More...
 
int availabledata (void)
 Return 1 if there is available after running poll(2), else 0.
 
void flushhw (void)
 Clear the driver input buffers.
 
int resethw (int started_as_root)
 Reset the hardware. More...
 
void gap_state_init (struct gap_state *state)
 Initiate a pristine gap_state.
 
void lengths_state_init (struct lengths_state *state)
 Initiate a pristine lengths_state.
 
void toggle_state_init (struct toggle_state *state)
 Initiate a pristine toggle_state.
 
void button_state_init (struct button_state *state, int started_as_root)
 Initiate a pristine button_state.
 
void get_pre_data (struct ir_remote *remote)
 Test hook: Extract remote->pre_data from remote->bits.
 
void get_post_data (struct ir_remote *remote)
 Test hook: Extract remote->post_data and post_data_bits from bits.
 
void remove_pre_data (struct ir_remote *remote)
 Test hook: Move remote->pre_data into remote->bits.
 
void remove_post_data (struct ir_remote *remote)
 Test hook: Move remote->post_data into remote->bits.
 
void invert_data (struct ir_remote *remote)
 Test hook: Invert all data items in remote.
 
void remove_trail (struct ir_remote *remote)
 Test hook: Move remote->trail into remote->bits.
 
void for_each_remote (struct ir_remote *remotes, remote_func func)
 Unconditionally apply func(remote) for all items in remotes list.
 
void unlink_length (struct lengths **first, struct lengths *remove)
 
int add_length (struct lengths **first, lirc_t length)
 
void free_lengths (struct lengths **firstp)
 
void free_all_lengths (void)
 Free heap data allocated by get_lengths().
 
int get_trail_length (struct ir_remote *remote, int interactive)
 
int get_lead_length (struct ir_remote *remote, int interactive)
 
int get_header_length (struct ir_remote *remote, int interactive)
 
int get_repeat_length (struct ir_remote *remote, int interactive)
 
void get_scheme (struct ir_remote *remote, int interactive)
 
int get_data_length (struct ir_remote *remote, int interactive)
 
enum get_gap_status get_gap_length (struct gap_state *state, struct ir_remote *remote)
 Try to find out gap length, returning gap_status.
 
int needs_toggle_mask (struct ir_remote *remote)
 Return true if a given remote needs to compute toggle_mask.
 
enum lengths_status get_lengths (struct lengths_state *state, struct ir_remote *remote, int force, int interactive)
 Try to find out pre/post etc. More...
 
enum toggle_status get_toggle_bit_mask (struct toggle_state *state, struct ir_remote *remote)
 Try to find out toggle_bit_mask, returning toggle_status.
 
int analyse_get_lengths (struct lengths_state *lengths_state)
 analyse non-interactive get_lengths, returns boolean ok/fail.
 
int analyse_remote (struct ir_remote *raw_data, const struct opts *opts)
 Implement the analyse task, return 1 for ok, 0 for errors.
 
int do_analyse (const struct opts *opts, struct main_state *state)
 The –analyse wrapper. More...
 
ssize_t raw_read (void *buffer, size_t size, unsigned int timeout_us)
 Absolute error tolerance (us). More...
 
enum button_status record_buttons (struct button_state *btn_state, enum button_status last_status, struct main_state *state, const struct opts *opts)
 Try to record one button, returning button_status.
 
void config_file_setup (struct main_state *state, const struct opts *opts)
 Write the provisionary config file.
 
int config_file_finish (struct main_state *state, const struct opts *opts)
 Write the final config file.
 

Variables

struct ir_remote remote
 
unsigned int eps = 30
 Shared list of remotes.
 
lirc_t aeps = 100
 Error tolerance in per cent.
 

Detailed Description

Implements irrecord.h.

Definition in file irrecord.c.

Function Documentation

◆ btn_state_set_message()

void btn_state_set_message ( struct button_state state,
const char *  fmt,
  ... 
)

snprintf-style message formatting into state->message.

sprintf-style message formatting into state->message.

Definition at line 97 of file irrecord.c.

◆ do_analyse()

int do_analyse ( const struct opts opts,
struct main_state state 
)

The –analyse wrapper.

The –analyse wrapper, returns boolean ok/fail.

Definition at line 1776 of file irrecord.c.

◆ get_lengths()

enum lengths_status get_lengths ( struct lengths_state state,
struct ir_remote remote,
int  force,
int  interactive 
)

Try to find out pre/post etc.

lengths, returning lengths_status.

Definition at line 1387 of file irrecord.c.

◆ raw_read()

ssize_t raw_read ( void *  buffer,
size_t  size,
unsigned int  timeout_us 
)

Absolute error tolerance (us).

Try to read some bytes from the device, no decoding whatsoever.

Definition at line 1804 of file irrecord.c.

◆ resethw()

int resethw ( int  started_as_root)

Reset the hardware.

Return 1 on OK, else 0 and possibly closes driver.

Definition at line 161 of file irrecord.c.