| LIRC libraries LinuxInfraredRemoteControl

Macros | Functions | Variables
irrecord.c File Reference

### (c94dd95 2017-01-06 18:56:46 +0100)

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. More...
void | flushhw (void)
| Clear the driver input buffers. More...
int | resethw (int started_as_root)
| Reset the hardware. More...
void | gap_state_init (struct gap_state *state)
| Initiate a pristine gap_state. More...
void | lengths_state_init (struct lengths_state *state)
| Initiate a pristine lengths_state. More...
void | toggle_state_init (struct toggle_state *state)
| Initiate a pristine toggle_state. More...
void | button_state_init (struct button_state *state, int started_as_root)
| Initiate a pristine button_state. More...
void | get_pre_data (struct ir_remote *remote)
| Test hook: Extract remote->pre_data from remote->bits. More...
void | get_post_data (struct ir_remote *remote)
| Test hook: Extract remote->post_data and post_data_bits from bits. More...
void | remove_pre_data (struct ir_remote *remote)
| Test hook: Move remote->pre_data into remote->bits. More...
void | remove_post_data (struct ir_remote *remote)
| Test hook: Move remote->post_data into remote->bits. More...
void | invert_data (struct ir_remote *remote)
| Test hook: Invert all data items in remote. More...
void | remove_trail (struct ir_remote *remote)
| Test hook: Move remote->trail into remote->bits. More...
void | for_each_remote (struct ir_remote *remotes, remote_func func)
| Unconditionally apply func(remote) for all items in remotes list. More...
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(). More...
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. More...
int | needs_toggle_mask (struct ir_remote *remote)
| Return true if a given remote needs to compute toggle_mask. More...
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. More...
int | analyse_get_lengths (struct lengths_state *lengths_state)
| analyse non-interactive get_lengths, returns boolean ok/fail. More...
int | analyse_remote (struct ir_remote *raw_data, const struct opts *opts)
| Implement the analyse task, return 1 for ok, 0 for errors. More...
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. More...
void | config_file_setup (struct main_state *state, const struct opts *opts)
| Write the provisionary config file. More...
int | config_file_finish (struct main_state *state, const struct opts *opts)
| Write the final config file. More...

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

## Detailed Description

Implements irrecord.h.

Definition in file irrecord.c.

## Function Documentation

## § analyse_get_lengths()

int analyse_get_lengths | ( | struct lengths_state * | lengths_state | ) |

analyse non-interactive get_lengths, returns boolean ok/fail.

Definition at line 1623 of file irrecord.c.

## § analyse_remote()

int analyse_remote | ( | struct ir_remote * | raw_data,
|  | const struct opts * | opts
| ) |  |

Implement the analyse task, return 1 for ok, 0 for errors.

Definition at line 1663 of file irrecord.c.

## § availabledata()

int availabledata | ( | void |  | ) |

Return 1 if there is available after running poll(2), else 0.

Definition at line 114 of file irrecord.c.

## § 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 93 of file irrecord.c.

## § button_state_init()

void button_state_init | ( | struct button_state * | state,
|  | int | started_as_root
| ) |  |

Initiate a pristine button_state.

Definition at line 215 of file irrecord.c.

## § config_file_finish()

int config_file_finish | ( | struct main_state * | state,
|  | const struct opts * | opts
| ) |  |

Write the final config file.

Definition at line 2102 of file irrecord.c.

## § config_file_setup()

void config_file_setup | ( | struct main_state * | state,
|  | const struct opts * | opts
| ) |  |

Write the provisionary config file.

Definition at line 2085 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 1772 of file irrecord.c.

## § flushhw()

void flushhw | ( | void |  | ) |

Clear the driver input buffers.

Definition at line 135 of file irrecord.c.

## § for_each_remote()

void for_each_remote | ( | struct ir_remote * | remotes,
|  | remote_func | func
| ) |  |

Unconditionally apply func(remote) for all items in remotes list.

Definition at line 487 of file irrecord.c.

## § free_all_lengths()

void free_all_lengths | ( | void |  | ) |

Free heap data allocated by get_lengths().

Definition at line 660 of file irrecord.c.

## § gap_state_init()

void gap_state_init | ( | struct gap_state * | state | ) |

Initiate a pristine gap_state.

Definition at line 185 of file irrecord.c.

## § get_gap_length()

enum get_gap_status get_gap_length | ( | struct gap_state * | state,
|  | struct ir_remote * | remote
| ) |  |

Try to find out gap length, returning gap_status.

Definition at line 1203 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 1383 of file irrecord.c.

## § get_post_data()

void get_post_data | ( | struct ir_remote * | remote | ) |

Test hook: Extract remote->post_data and post_data_bits from bits.

Definition at line 323 of file irrecord.c.

## § get_pre_data()

void get_pre_data | ( | struct ir_remote * | remote | ) |

Test hook: Extract remote->pre_data from remote->bits.

Definition at line 265 of file irrecord.c.

## § get_toggle_bit_mask()

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.

Definition at line 1541 of file irrecord.c.

## § invert_data()

void invert_data | ( | struct ir_remote * | remote | ) |

Test hook: Invert all data items in remote.

Definition at line 420 of file irrecord.c.

## § lengths_state_init()

void lengths_state_init | ( | struct lengths_state * | state | ) |

Initiate a pristine lengths_state.

Definition at line 191 of file irrecord.c.

## § needs_toggle_mask()

int needs_toggle_mask | ( | struct ir_remote * | remote | ) |

Return true if a given remote needs to compute toggle_mask.

Definition at line 1245 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 1800 of file irrecord.c.

## § record_buttons()

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.

Definition at line 1831 of file irrecord.c.

## § remove_post_data()

void remove_post_data | ( | struct ir_remote * | remote | ) |

Test hook: Move remote->post_data into remote->bits.

Definition at line 399 of file irrecord.c.

## § remove_pre_data()

void remove_pre_data | ( | struct ir_remote * | remote | ) |

Test hook: Move remote->pre_data into remote->bits.

Definition at line 379 of file irrecord.c.

## § remove_trail()

void remove_trail | ( | struct ir_remote * | remote | ) |

Test hook: Move remote->trail into remote->bits.

Definition at line 459 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 157 of file irrecord.c.

## § toggle_state_init()

void toggle_state_init | ( | struct toggle_state * | state | ) |

Initiate a pristine toggle_state.

Definition at line 207 of file irrecord.c.

## Variable Documentation

## § aeps

lirc_t aeps = 100

Error tolerance in per cent.

Definition at line 59 of file irrecord.c.

## § eps

unsigned int eps = 30

Shared list of remotes.

Definition at line 58 of file irrecord.c.