20#ifdef TIME_WITH_SYS_TIME
24# ifdef HAVE_SYS_TIME_H
34#include "media/lirc.h"
36#include "lirc/config_file.h"
37#include "lirc/dump_config.h"
38#include "lirc/config_flags.h"
39#include "lirc/ir_remote_types.h"
41void fprint_comment(FILE* f,
const struct ir_remote* rem,
const char* commandline)
49 p = popen(
"uname -r",
"r");
51 strcat(uname,
"Cannot run uname -r(!)");
53 if (fgets(uname,
sizeof(uname), p) != uname)
54 strcat(uname,
"Cannot run uname -r (!)");
58 snprintf(cmd,
sizeof(cmd),
"%s", commandline);
63 tmp = localtime(&timet);
66 "# This config file was automatically generated\n"
67 "# using lirc-%s(%s) on %s"
68 "# Command line used: %s\n"
69 "# Kernel version (uname -r): %s"
71 "# Remote name (as of config file): %s\n"
72 "# Brand of remote device, the thing you hold in your hand:\n"
73 "# Remote device model nr:\n"
74 "# Remote device info url:\n"
75 "# Does remote device has a bundled capture device e. g., a\n"
77 "# For bundled USB devices: usb vendor id, product id\n"
78 "# and device string (use dmesg or lsusb):\n"
79 "# Type of device controlled\n"
80 "# (TV, VCR, Audio, DVD, Satellite, Cable, HTPC, ...) :\n"
81 "# Device(s) controlled by this remote:\n\n",
85void fprint_flags(FILE* f,
int flags)
94 fprintf(f,
" flags ");
105void fprint_remotes(FILE* f,
const struct ir_remote* all,
const char* commandline)
108 fprint_remote(f, all, commandline);
114void fprint_remote_gap(FILE* f,
const struct ir_remote* rem)
117 fprintf(f,
" gap %u %u\n", (uint32_t)rem->
gap, (uint32_t)rem->
gap2);
119 fprintf(f,
" gap %u\n", (uint32_t)rem->
gap);
122void fprint_remote_head(FILE* f,
const struct ir_remote* rem)
124 fprintf(f,
"begin remote\n\n");
125 fprintf(f,
" name %s\n", rem->
name);
129 fprintf(f,
" driver %s\n", rem->
driver);
131 fprintf(f,
" bits %5d\n", rem->
bits);
132 fprint_flags(f, rem->
flags);
133 fprintf(f,
" eps %5d\n", rem->
eps);
134 fprintf(f,
" aeps %5d\n\n", rem->
aeps);
137 fprintf(f,
" header %5u %5u\n", (uint32_t)rem->phead, (uint32_t)rem->
shead);
138 if (rem->pthree != 0 || rem->
sthree != 0)
139 fprintf(f,
" three %5u %5u\n", (uint32_t)rem->pthree, (uint32_t)rem->
sthree);
140 if (rem->ptwo != 0 || rem->
stwo != 0)
141 fprintf(f,
" two %5u %5u\n", (uint32_t)rem->ptwo, (uint32_t)rem->
stwo);
142 fprintf(f,
" one %5u %5u\n", (uint32_t)rem->pone, (uint32_t)rem->
sone);
143 fprintf(f,
" zero %5u %5u\n", (uint32_t)rem->pzero, (uint32_t)rem->
szero);
146 fprintf(f,
" ptrail %5u\n", (uint32_t)rem->
ptrail);
149 fprintf(f,
" plead %5u\n", (uint32_t)rem->
plead);
151 fprintf(f,
" foot %5u %5u\n", (uint32_t)rem->pfoot, (uint32_t)rem->
sfoot);
154 fprintf(f,
" repeat %5u %5u\n", (uint32_t)rem->prepeat, (uint32_t)rem->
srepeat);
158 fprintf(f,
" pre_data 0x%llX\n", (
unsigned long long)rem->
pre_data);
162 fprintf(f,
" post_data 0x%llX\n", (
unsigned long long)rem->
post_data);
164 if (rem->pre_p != 0 && rem->
pre_s != 0)
165 fprintf(f,
" pre %5u %5u\n", (uint32_t)rem->pre_p, (uint32_t)rem->
pre_s);
166 if (rem->post_p != 0 && rem->
post_s != 0)
167 fprintf(f,
" post %5u %5u\n", (uint32_t)rem->post_p, (uint32_t)rem->
post_s);
169 fprint_remote_gap(f, rem);
170 if (has_repeat_gap(rem))
171 fprintf(f,
" repeat_gap %u\n", (uint32_t)rem->
repeat_gap);
175 fprintf(f,
" min_repeat %d\n", rem->
min_repeat);
177 fprintf(f,
"# suppress_repeat %d\n", rem->
min_repeat);
178 fprintf(f,
"# uncomment to suppress unwanted repeats\n");
184 fprintf(f,
" toggle_bit_mask 0x%llX\n", (
unsigned long long)rem->
toggle_bit_mask);
185 if (has_toggle_mask(rem))
186 fprintf(f,
" toggle_mask 0x%llX\n", (
unsigned long long)rem->
toggle_mask);
188 fprintf(f,
" repeat_mask 0x%llX\n", (
unsigned long long)rem->
repeat_mask);
190 fprintf(f,
" rc6_mask 0x%llX\n", (
unsigned long long)rem->
rc6_mask);
191 if (has_ignore_mask(rem))
192 fprintf(f,
" ignore_mask 0x%llX\n", (
unsigned long long)rem->
ignore_mask);
193 if (is_serial(rem)) {
194 fprintf(f,
" baud %d\n", rem->
baud);
200 fprintf(f,
" frequency %u\n", rem->
freq);
202 fprintf(f,
" duty_cycle %u\n", rem->
duty_cycle);
206void fprint_remote_foot(FILE* f,
const struct ir_remote* rem)
208 fprintf(f,
"end remote\n");
211void fprint_remote_signal_head(FILE* f,
const struct ir_remote* rem)
214 fprintf(f,
" begin codes\n");
216 fprintf(f,
" begin raw_codes\n\n");
219void fprint_remote_signal_foot(FILE* f,
const struct ir_remote* rem)
222 fprintf(f,
" end codes\n\n");
224 fprintf(f,
" end raw_codes\n\n");
227void fprint_remote_signal(FILE* f,
237 sprintf(format,
" %%-24s 0x%%0%dllX",
238 (rem->
bits + 3) / 4);
239 fprintf(f, format, codes->
name, codes->
code);
240 sprintf(format,
" 0x%%0%dlX", (rem->
bits + 3) / 4);
241 for (loop = codes->
next; loop != NULL; loop = loop->next)
242 fprintf(f, format, loop->code);
246 fprintf(f,
" name %s\n", codes->
name);
248 for (i = 0; i < codes->
length; i++) {
250 fprintf(f,
" %7u", (uint32_t)codes->
signals[i]);
252 fprintf(f,
" %7u", (uint32_t)codes->
signals[i]);
254 fprintf(f,
" %7u\n", (uint32_t)codes->
signals[i]);
268void fprint_remote_signals(FILE* f,
const struct ir_remote* rem)
272 fprint_remote_signal_head(f, rem);
274 while (codes->
name != NULL) {
275 fprint_remote_signal(f, rem, codes);
278 fprint_remote_signal_foot(f, rem);
281void fprint_remote(FILE* f,
const struct ir_remote* rem,
const char* commandline)
283 fprint_comment(f, rem, commandline);
284 fprint_remote_head(f, rem);
285 fprint_remote_signals(f, rem);
286 fprint_remote_foot(f, rem);
const struct flaglist all_flags[]
All flags i config file: Their name and mask.
const struct driver *const curr_driver
Read-only access to drv for client code.
An ir_code for entering into (singly) linked lists, i.e.
IR Command, corresponding to one (command defining) line of the configuration file.
struct ir_code_node * next
Linked list of the subsequent ir_code's, after the first one.
ir_code code
The first code of the command.
lirc_t * signals
(private)
char * name
Name of command.
One remote as represented in the configuration file.
const char * driver
Name of driver for LIRCCODE cases.
uint32_t repeat_gap
time between two repeat codes if different from gap
lirc_t stwo
2 (only used for RC-MM)
unsigned int freq
modulation frequency
int suppress_repeat
suppress unwanted repeats
unsigned int aeps
detecting very short pulses is difficult with relative tolerance for some remotes,...
uint32_t gap2
time between signals in usecs
unsigned int stop_bits
mapping: 1->2 1.5->3 2->4
unsigned int bits_in_byte
default: 8
ir_code rc6_mask
RC-6 doubles signal length of some bits.
lirc_t ptrail
trailing pulse
unsigned int duty_cycle
0<duty cycle<=100 default: 50
ir_code repeat_mask
mask defines which bits are inverted for repeats
lirc_t srepeat
indicate repeating
ir_code pre_data
data which the remote sends before actual keycode
int bits
bits (length of code)
int post_data_bits
length of post_data
ir_code ignore_mask
mask defines which bits can be ignored when matching a code
lirc_t plead
leading pulse
lirc_t sthree
3 (only used for RC-MM)
ir_code post_data
data which the remote sends after actual keycode
ir_code toggle_mask
Sharp (?) error detection scheme.
unsigned int baud
can be overridden by [p|s]zero, [p|s]one
int min_repeat
code is repeated at least x times code sent once -> min_repeat=0
int manual_sort
If set in any remote, disables automatic sorting.
lirc_t post_s
signal between keycode and post_code
lirc_t pre_s
signal between pre_data and keycode
uint32_t gap
time between signals in usecs
int eps
eps (relative tolerance)
unsigned int min_code_repeat
meaningful only if remote sends a repeat code: in this case this value indicates how often the real c...
const char * name
name of remote control
ir_code toggle_bit_mask
previously only one bit called toggle_bit
int pre_data_bits
length of pre_data