Loading...
Searching...
No Matches
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.
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.
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.
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.
ssize_t | raw_read (void *buffer, size_t size, unsigned int timeout_us)
| Absolute error tolerance (us).
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.

## Macro Definition Documentation

## _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 16 of file irrecord.c.

## Function Documentation

## add_length()

int add_length | ( | struct lengths ** | first,
|  | lirc_t | length )

Definition at line 617 of file irrecord.c.

## analyse_get_lengths()

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

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

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

## availabledata()

int availabledata | ( | void |  | ) |

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

Definition at line 118 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 97 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 219 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 2119 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 2102 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 1787 of file irrecord.c.

## flushhw()

void flushhw | ( | void |  | ) |

Clear the driver input buffers.

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

## free_all_lengths()

void free_all_lengths | ( | void |  | ) |

Free heap data allocated by get_lengths().

Definition at line 664 of file irrecord.c.

## free_lengths()

void free_lengths | ( | struct lengths ** | firstp | ) |

Definition at line 647 of file irrecord.c.

## gap_state_init()

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

Initiate a pristine gap_state.

Definition at line 189 of file irrecord.c.

## get_data_length()

int get_data_length | ( | struct ir_remote * | remote,
|  | int | interactive )

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

## get_header_length()

int get_header_length | ( | struct ir_remote * | remote,
|  | int | interactive )

Definition at line 845 of file irrecord.c.

## get_lead_length()

int get_lead_length | ( | struct ir_remote * | remote,
|  | int | interactive )

Definition at line 795 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.

## 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 327 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 269 of file irrecord.c.

## get_repeat_length()

int get_repeat_length | ( | struct ir_remote * | remote,
|  | int | interactive )

Definition at line 892 of file irrecord.c.

## get_scheme()

void get_scheme | ( | struct ir_remote * | remote,
|  | int | interactive )

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

## get_trail_length()

int get_trail_length | ( | struct ir_remote * | remote,
|  | int | interactive )

Definition at line 771 of file irrecord.c.

## invert_data()

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

Test hook: Invert all data items in remote.

Definition at line 424 of file irrecord.c.

## lengths_state_init()

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

Initiate a pristine lengths_state.

Definition at line 195 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 1249 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 1815 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 1848 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 403 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 383 of file irrecord.c.

## remove_trail()

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

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

Definition at line 463 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.

## toggle_state_init()

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

Initiate a pristine toggle_state.

Definition at line 211 of file irrecord.c.

## unlink_length()

void unlink_length | ( | struct lengths ** | first,
|  | struct lengths * | remove )

Definition at line 592 of file irrecord.c.

## Variable Documentation

## aeps

lirc_t aeps = 100

Error tolerance in per cent.

Definition at line 63 of file irrecord.c.

## eps

unsigned int eps = 30

Shared list of remotes.

Definition at line 62 of file irrecord.c.

## remote

struct ir_remote remote

Definition at line 61 of file irrecord.c.