20 #ifdef TIME_WITH_SYS_TIME
21 # include <sys/time.h>
24 # ifdef HAVE_SYS_TIME_H
25 # include <sys/time.h>
32 #include "include/media/lirc.h"
33 #include "lirc/config_file.h"
34 #include "lirc/dump_config.h"
35 #include "lirc/config_flags.h"
36 #include "lirc/ir_remote_types.h"
38 void fprint_comment(FILE* f,
const struct ir_remote* rem,
const char* commandline)
46 p = popen(
"uname -r",
"r");
48 strcat(uname,
"Cannot run uname -r(!)");
50 if (fgets(uname,
sizeof(uname), p) != uname)
51 strcat(uname,
"Cannot run uname -r (!)");
55 snprintf(cmd,
sizeof(cmd),
"%s", commandline);
60 tmp = localtime(&timet);
63 "# This config file was automatically generated\n"
64 "# using lirc-%s(%s) on %s"
65 "# Command line used: %s\n"
66 "# Kernel version (uname -r): %s"
68 "# Remote name (as of config file): %s\n"
69 "# Brand of remote device, the thing you hold in your hand:\n"
70 "# Remote device model nr:\n"
71 "# Remote device info url:\n"
72 "# Does remote device has a bundled capture device e. g., a\n"
74 "# For bundled USB devices: usb vendor id, product id\n"
75 "# and device string (use dmesg or lsusb):\n"
76 "# Type of device controlled\n"
77 "# (TV, VCR, Audio, DVD, Satellite, Cable, HTPC, ...) :\n"
78 "# Device(s) controlled by this remote:\n\n",
82 void fprint_flags(FILE* f,
int flags)
91 fprintf(f,
" flags ");
102 void fprint_remotes(FILE* f,
const struct ir_remote* all,
const char* commandline)
105 fprint_remote(f, all, commandline);
111 void fprint_remote_gap(FILE* f,
const struct ir_remote* rem)
114 fprintf(f,
" gap %u %u\n", (__u32)rem->
gap, (__u32)rem->
gap2);
116 fprintf(f,
" gap %u\n", (__u32)rem->
gap);
119 void fprint_remote_head(FILE* f,
const struct ir_remote* rem)
121 fprintf(f,
"begin remote\n\n");
122 fprintf(f,
" name %s\n", rem->
name);
126 fprintf(f,
" driver %s\n", rem->
driver);
128 fprintf(f,
" bits %5d\n", rem->
bits);
129 fprint_flags(f, rem->
flags);
130 fprintf(f,
" eps %5d\n", rem->
eps);
131 fprintf(f,
" aeps %5d\n\n", rem->
aeps);
134 fprintf(f,
" header %5u %5u\n", (__u32)rem->phead, (__u32)rem->
shead);
135 if (rem->pthree != 0 || rem->
sthree != 0)
136 fprintf(f,
" three %5u %5u\n", (__u32)rem->pthree, (__u32)rem->
sthree);
137 if (rem->ptwo != 0 || rem->
stwo != 0)
138 fprintf(f,
" two %5u %5u\n", (__u32)rem->ptwo, (__u32)rem->
stwo);
139 fprintf(f,
" one %5u %5u\n", (__u32)rem->pone, (__u32)rem->
sone);
140 fprintf(f,
" zero %5u %5u\n", (__u32)rem->pzero, (__u32)rem->
szero);
143 fprintf(f,
" ptrail %5u\n", (__u32)rem->
ptrail);
146 fprintf(f,
" plead %5u\n", (__u32)rem->
plead);
148 fprintf(f,
" foot %5u %5u\n", (__u32)rem->pfoot, (__u32)rem->
sfoot);
151 fprintf(f,
" repeat %5u %5u\n", (__u32)rem->prepeat, (__u32)rem->
srepeat);
155 fprintf(f,
" pre_data 0x%llX\n", (
unsigned long long)rem->
pre_data);
159 fprintf(f,
" post_data 0x%llX\n", (
unsigned long long)rem->
post_data);
161 if (rem->pre_p != 0 && rem->
pre_s != 0)
162 fprintf(f,
" pre %5u %5u\n", (__u32)rem->pre_p, (__u32)rem->
pre_s);
163 if (rem->post_p != 0 && rem->
post_s != 0)
164 fprintf(f,
" post %5u %5u\n", (__u32)rem->post_p, (__u32)rem->
post_s);
166 fprint_remote_gap(f, rem);
167 if (has_repeat_gap(rem))
168 fprintf(f,
" repeat_gap %u\n", (__u32)rem->
repeat_gap);
172 fprintf(f,
" min_repeat %d\n", rem->
min_repeat);
174 fprintf(f,
"# suppress_repeat %d\n", rem->
min_repeat);
175 fprintf(f,
"# uncomment to suppress unwanted repeats\n");
181 fprintf(f,
" toggle_bit_mask 0x%llX\n", (
unsigned long long)rem->
toggle_bit_mask);
182 if (has_toggle_mask(rem))
183 fprintf(f,
" toggle_mask 0x%llX\n", (
unsigned long long)rem->
toggle_mask);
185 fprintf(f,
" repeat_mask 0x%llX\n", (
unsigned long long)rem->
repeat_mask);
187 fprintf(f,
" rc6_mask 0x%llX\n", (
unsigned long long)rem->
rc6_mask);
188 if (has_ignore_mask(rem))
189 fprintf(f,
" ignore_mask 0x%llX\n", (
unsigned long long)rem->
ignore_mask);
190 if (is_serial(rem)) {
191 fprintf(f,
" baud %d\n", rem->
baud);
197 fprintf(f,
" frequency %u\n", rem->
freq);
199 fprintf(f,
" duty_cycle %u\n", rem->
duty_cycle);
203 void fprint_remote_foot(FILE* f,
const struct ir_remote* rem)
205 fprintf(f,
"end remote\n");
208 void fprint_remote_signal_head(FILE* f,
const struct ir_remote* rem)
211 fprintf(f,
" begin codes\n");
213 fprintf(f,
" begin raw_codes\n\n");
216 void fprint_remote_signal_foot(FILE* f,
const struct ir_remote* rem)
219 fprintf(f,
" end codes\n\n");
221 fprintf(f,
" end raw_codes\n\n");
224 void fprint_remote_signal(FILE* f,
const struct ir_remote* rem,
const struct ir_ncode* codes)
232 sprintf(format,
" %%-24s 0x%%0%dllX", (rem->
bits + 3) / 4);
233 fprintf(f, format, codes->
name, codes->
code);
234 sprintf(format,
" 0x%%0%dlX", (rem->
bits + 3) / 4);
235 for (loop = codes->
next; loop != NULL; loop = loop->next)
236 fprintf(f, format, loop->code);
240 fprintf(f,
" name %s\n", codes->
name);
242 for (i = 0; i < codes->
length; i++) {
244 fprintf(f,
" %7u", (__u32)codes->
signals[i]);
246 fprintf(f,
" %7u", (__u32)codes->
signals[i]);
248 fprintf(f,
" %7u\n", (__u32)codes->
signals[i]);
262 void fprint_remote_signals(FILE* f,
const struct ir_remote* rem)
266 fprint_remote_signal_head(f, rem);
268 while (codes->
name != NULL) {
269 fprint_remote_signal(f, rem, codes);
272 fprint_remote_signal_foot(f, rem);
275 void fprint_remote(FILE* f,
const struct ir_remote* rem,
const char* commandline)
277 fprint_comment(f, rem, commandline);
278 fprint_remote_head(f, rem);
279 fprint_remote_signals(f, rem);
280 fprint_remote_foot(f, rem);
struct ir_code_node * next
unsigned int min_code_repeat
const struct flaglist all_flags[]
const struct driver const * curr_driver
unsigned int bits_in_byte