20 #ifdef TIME_WITH_SYS_TIME 21 # include <sys/time.h> 24 # ifdef HAVE_SYS_TIME_H 25 # include <sys/time.h> 33 #ifdef HAVE_KERNEL_LIRC_H 34 #include <linux/lirc.h> 36 #include "include/media/lirc.h" 39 #include "lirc/config_file.h" 40 #include "lirc/dump_config.h" 41 #include "lirc/config_flags.h" 42 #include "lirc/ir_remote_types.h" 44 void fprint_comment(FILE* f,
const struct ir_remote* rem,
const char* commandline)
52 p = popen(
"uname -r",
"r");
54 strcat(uname,
"Cannot run uname -r(!)");
56 if (fgets(uname,
sizeof(uname), p) != uname)
57 strcat(uname,
"Cannot run uname -r (!)");
61 snprintf(cmd,
sizeof(cmd),
"%s", commandline);
66 tmp = localtime(&timet);
69 "# This config file was automatically generated\n" 70 "# using lirc-%s(%s) on %s" 71 "# Command line used: %s\n" 72 "# Kernel version (uname -r): %s" 74 "# Remote name (as of config file): %s\n" 75 "# Brand of remote device, the thing you hold in your hand:\n" 76 "# Remote device model nr:\n" 77 "# Remote device info url:\n" 78 "# Does remote device has a bundled capture device e. g., a\n" 80 "# For bundled USB devices: usb vendor id, product id\n" 81 "# and device string (use dmesg or lsusb):\n" 82 "# Type of device controlled\n" 83 "# (TV, VCR, Audio, DVD, Satellite, Cable, HTPC, ...) :\n" 84 "# Device(s) controlled by this remote:\n\n",
88 void fprint_flags(FILE* f,
int flags)
97 fprintf(f,
" flags ");
108 void fprint_remotes(FILE* f,
const struct ir_remote* all,
const char* commandline)
111 fprint_remote(f, all, commandline);
117 void fprint_remote_gap(FILE* f,
const struct ir_remote* rem)
120 fprintf(f,
" gap %u %u\n", (__u32)rem->
gap, (__u32)rem->
gap2);
122 fprintf(f,
" gap %u\n", (__u32)rem->
gap);
125 void fprint_remote_head(FILE* f,
const struct ir_remote* rem)
127 fprintf(f,
"begin remote\n\n");
128 fprintf(f,
" name %s\n", rem->
name);
132 fprintf(f,
" driver %s\n", rem->
driver);
134 fprintf(f,
" bits %5d\n", rem->
bits);
135 fprint_flags(f, rem->
flags);
136 fprintf(f,
" eps %5d\n", rem->
eps);
137 fprintf(f,
" aeps %5d\n\n", rem->
aeps);
140 fprintf(f,
" header %5u %5u\n", (__u32)rem->phead, (__u32)rem->
shead);
141 if (rem->pthree != 0 || rem->
sthree != 0)
142 fprintf(f,
" three %5u %5u\n", (__u32)rem->pthree, (__u32)rem->
sthree);
143 if (rem->ptwo != 0 || rem->
stwo != 0)
144 fprintf(f,
" two %5u %5u\n", (__u32)rem->ptwo, (__u32)rem->
stwo);
145 fprintf(f,
" one %5u %5u\n", (__u32)rem->pone, (__u32)rem->
sone);
146 fprintf(f,
" zero %5u %5u\n", (__u32)rem->pzero, (__u32)rem->
szero);
149 fprintf(f,
" ptrail %5u\n", (__u32)rem->
ptrail);
152 fprintf(f,
" plead %5u\n", (__u32)rem->
plead);
154 fprintf(f,
" foot %5u %5u\n", (__u32)rem->pfoot, (__u32)rem->
sfoot);
157 fprintf(f,
" repeat %5u %5u\n", (__u32)rem->prepeat, (__u32)rem->
srepeat);
161 fprintf(f,
" pre_data 0x%llX\n", (
unsigned long long)rem->
pre_data);
165 fprintf(f,
" post_data 0x%llX\n", (
unsigned long long)rem->
post_data);
167 if (rem->pre_p != 0 && rem->
pre_s != 0)
168 fprintf(f,
" pre %5u %5u\n", (__u32)rem->pre_p, (__u32)rem->
pre_s);
169 if (rem->post_p != 0 && rem->
post_s != 0)
170 fprintf(f,
" post %5u %5u\n", (__u32)rem->post_p, (__u32)rem->
post_s);
172 fprint_remote_gap(f, rem);
173 if (has_repeat_gap(rem))
174 fprintf(f,
" repeat_gap %u\n", (__u32)rem->
repeat_gap);
178 fprintf(f,
" min_repeat %d\n", rem->
min_repeat);
180 fprintf(f,
"# suppress_repeat %d\n", rem->
min_repeat);
181 fprintf(f,
"# uncomment to suppress unwanted repeats\n");
187 fprintf(f,
" toggle_bit_mask 0x%llX\n", (
unsigned long long)rem->
toggle_bit_mask);
188 if (has_toggle_mask(rem))
189 fprintf(f,
" toggle_mask 0x%llX\n", (
unsigned long long)rem->
toggle_mask);
191 fprintf(f,
" repeat_mask 0x%llX\n", (
unsigned long long)rem->
repeat_mask);
193 fprintf(f,
" rc6_mask 0x%llX\n", (
unsigned long long)rem->
rc6_mask);
194 if (has_ignore_mask(rem))
195 fprintf(f,
" ignore_mask 0x%llX\n", (
unsigned long long)rem->
ignore_mask);
196 if (is_serial(rem)) {
197 fprintf(f,
" baud %d\n", rem->
baud);
203 fprintf(f,
" frequency %u\n", rem->
freq);
205 fprintf(f,
" duty_cycle %u\n", rem->
duty_cycle);
209 void fprint_remote_foot(FILE* f,
const struct ir_remote* rem)
211 fprintf(f,
"end remote\n");
214 void fprint_remote_signal_head(FILE* f,
const struct ir_remote* rem)
217 fprintf(f,
" begin codes\n");
219 fprintf(f,
" begin raw_codes\n\n");
222 void fprint_remote_signal_foot(FILE* f,
const struct ir_remote* rem)
225 fprintf(f,
" end codes\n\n");
227 fprintf(f,
" end raw_codes\n\n");
230 void fprint_remote_signal(FILE* f,
const struct ir_remote* rem,
const struct ir_ncode* codes)
238 sprintf(format,
" %%-24s 0x%%0%dllX", (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", (__u32)codes->
signals[i]);
252 fprintf(f,
" %7u", (__u32)codes->
signals[i]);
254 fprintf(f,
" %7u\n", (__u32)codes->
signals[i]);
268 void 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);
281 void 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 driver *const curr_driver
struct ir_code_node * next
unsigned int min_code_repeat
const struct flaglist all_flags[]
unsigned int bits_in_byte