1 |
axs 13/08/27 18:22:28 |
2 |
|
3 |
Added: lirc-0.9.0-add-zotac-support.patch |
4 |
Log: |
5 |
added support for zotac, bug 462596 |
6 |
|
7 |
(Portage version: 2.1.12.2/cvs/Linux x86_64, signed Manifest commit with key 2B6559ED) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 app-misc/lirc/files/lirc-0.9.0-add-zotac-support.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/lirc/files/lirc-0.9.0-add-zotac-support.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/lirc/files/lirc-0.9.0-add-zotac-support.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: lirc-0.9.0-add-zotac-support.patch |
16 |
=================================================================== |
17 |
diff -rupN base/configure.ac mod/configure.ac |
18 |
--- base/configure.ac 2011-03-25 23:28:18.000000000 +0100 |
19 |
+++ mod/configure.ac 2013-03-21 16:25:07.218419985 +0100 |
20 |
@@ -383,7 +383,7 @@ AC_CHECK_HEADERS(linux/input.h,[ |
21 |
dnl check if hiddev is available |
22 |
AC_CHECK_HEADERS([linux/types.h]) |
23 |
AC_CHECK_HEADERS([linux/hiddev.h],[ |
24 |
- possible_drivers="${possible_drivers} (asusdh) (bw6130) (dvico) (macmini)" |
25 |
+ possible_drivers="${possible_drivers} (asusdh) (bw6130) (dvico) (macmini) (zotac)" |
26 |
AC_MSG_CHECKING(for HIDDEV_FLAG_UREF support) |
27 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
28 |
#include <linux/types.h> |
29 |
@@ -393,7 +393,7 @@ AC_CHECK_HEADERS([linux/hiddev.h],[ |
30 |
]])],[ |
31 |
AC_MSG_RESULT(yes) |
32 |
AC_DEFINE(HAVE_LINUX_HIDDEV_FLAG_UREF) |
33 |
- possible_drivers="${possible_drivers} (samsung) (sb0540)" |
34 |
+ possible_drivers="${possible_drivers} (samsung) (sb0540) (zotac)" |
35 |
],[ |
36 |
AC_MSG_RESULT(no) |
37 |
]) |
38 |
@@ -446,7 +446,7 @@ AC_ARG_WITH(driver, |
39 |
srm7500libusb, tekram, |
40 |
tekram_bt829, tira, tira_raw, ttusbir, |
41 |
tuxbox, tvbox, udp, uirt2, uirt2_raw, |
42 |
- usb_uirt_raw, usbx, wpc8769l], |
43 |
+ usb_uirt_raw, usbx, wpc8769l, zotac], |
44 |
driver=${withval}, |
45 |
driver="unset" |
46 |
) |
47 |
@@ -464,6 +464,7 @@ portaudio_lib="" |
48 |
alsa_lib="" |
49 |
atilibusb_lib="" |
50 |
atwf83_lib="" |
51 |
+zotac_lib="" |
52 |
awlibusb_lib="" |
53 |
dfclibusb_lib="" |
54 |
srm7500libusb_lib="" |
55 |
@@ -683,6 +684,10 @@ if test "$driver" = "userspace" -o "$dri |
56 |
usbx) |
57 |
hw_module="${hw_module} hw_usbx.o serial.o" |
58 |
;; |
59 |
+ zotac) |
60 |
+ hw_module="${hw_module} hw_zotac.o" |
61 |
+ zotac_lib=-lpthread |
62 |
+ ;; |
63 |
esac |
64 |
done |
65 |
#remove duplicates |
66 |
@@ -733,6 +738,14 @@ if test "$driver" = "alsa_usb"; then |
67 |
lircd_conf="creative/lircd.conf.alsa_usb" |
68 |
fi |
69 |
|
70 |
+if test "$driver" = "zotac"; then |
71 |
+ lirc_driver="$driver" |
72 |
+ hw_module="hw_zotac.o" |
73 |
+ HW_DEFAULT="hw_zotac" |
74 |
+ lircd_conf="zotac/lircd.conf.zotac" |
75 |
+ zotac_lib=-lpthread |
76 |
+fi |
77 |
+ |
78 |
if test "$driver" = "animax"; then |
79 |
lirc_driver="lirc_dev lirc_serial" |
80 |
lircd_conf="animax/lircd.conf.animax" |
81 |
@@ -1499,6 +1512,7 @@ if test "$lirc_driver" = "none" || \ |
82 |
test "$lirc_driver" = "macmini" || \ |
83 |
test "$lirc_driver" = "samsung" || \ |
84 |
test "$lirc_driver" = "sb0540" || \ |
85 |
+ test "$lirc_driver" = "zotac" || \ |
86 |
test "$lirc_driver" = "srm7500libusb" || \ |
87 |
test "$lirc_driver" = "userspace"; then |
88 |
lirc_driver= |
89 |
@@ -1669,7 +1683,7 @@ if ! echo ${hw_module}|grep " receive.o" |
90 |
receive="receive.o" |
91 |
fi |
92 |
|
93 |
-hw_module_libs="${alsa_lib} ${atilibusb_lib} ${awlibusb_lib} ${caraca_lib} ${commandir_lib} ${dfclibusb_lib} ${ftdi_lib} ${iguanaIR_lib} ${irman_lib} ${portaudio_lib} ${srm7500libusb_lib} ${atwf83_lib}" |
94 |
+hw_module_libs="${alsa_lib} ${atilibusb_lib} ${awlibusb_lib} ${caraca_lib} ${commandir_lib} ${dfclibusb_lib} ${ftdi_lib} ${iguanaIR_lib} ${irman_lib} ${portaudio_lib} ${srm7500libusb_lib} ${atwf83_lib} ${zotac_lib}" |
95 |
|
96 |
dnl tell the Makefiles what we decided |
97 |
AC_SUBST(daemon) |
98 |
diff -rupN base/daemons/Makefile.am mod/daemons/Makefile.am |
99 |
--- base/daemons/Makefile.am 2011-03-25 23:28:18.000000000 +0100 |
100 |
+++ mod/daemons/Makefile.am 2013-03-21 16:25:40.488790784 +0100 |
101 |
@@ -58,7 +58,8 @@ EXTRA_libhw_module_a_SOURCES = \ |
102 |
hw_usbx.c hw_usbx.h \ |
103 |
receive.c receive.h \ |
104 |
transmit.c transmit.h \ |
105 |
- serial.c serial.h |
106 |
+ serial.c serial.h \ |
107 |
+ hw_zotac.c |
108 |
|
109 |
libhw_module_a_LIBADD = @hw_module@ |
110 |
libhw_module_a_DEPENDENCIES = @hw_module@ |
111 |
diff -rupN base/daemons/hw-types.c mod/daemons/hw-types.c |
112 |
--- base/daemons/hw-types.c 2011-03-25 23:28:18.000000000 +0100 |
113 |
+++ mod/daemons/hw-types.c 2013-03-21 16:26:38.913200218 +0100 |
114 |
@@ -59,6 +59,7 @@ extern struct hardware hw_uirt2; |
115 |
extern struct hardware hw_uirt2_raw; |
116 |
extern struct hardware hw_usb_uirt_raw; |
117 |
extern struct hardware hw_usbx; |
118 |
+extern struct hardware hw_zotac; |
119 |
|
120 |
#ifndef HW_DEFAULT |
121 |
# define HW_DEFAULT hw_default |
122 |
@@ -160,6 +161,7 @@ struct hardware *hw_list[] = { |
123 |
#ifdef HAVE_LINUX_HIDDEV_FLAG_UREF |
124 |
&hw_samsung, |
125 |
&hw_sb0540, |
126 |
+ &hw_zotac, |
127 |
#endif |
128 |
&hw_silitek, |
129 |
#ifdef HAVE_LIBUSB |
130 |
diff -rupN base/daemons/hw_zotac.c mod/daemons/hw_zotac.c |
131 |
--- base/daemons/hw_zotac.c 1970-01-01 01:00:00.000000000 +0100 |
132 |
+++ mod/daemons/hw_zotac.c 2013-03-21 16:31:06.989272556 +0100 |
133 |
@@ -0,0 +1,429 @@ |
134 |
+/**************************************************************************** |
135 |
+ ** hw_zotac.c ************************************************************* |
136 |
+ **************************************************************************** |
137 |
+ * |
138 |
+ * Lirc driver for Zotac remote |
139 |
+ * |
140 |
+ * Copyright (C) 2010 Rainer Hochecker |
141 |
+ * |
142 |
+ * Distribute under GPL version 2 or later. |
143 |
+ * |
144 |
+ */ |
145 |
+ |
146 |
+#ifdef HAVE_CONFIG_H |
147 |
+# include <config.h> |
148 |
+#endif |
149 |
+ |
150 |
+#include <stdio.h> |
151 |
+#include <pthread.h> |
152 |
+#include <sys/fcntl.h> |
153 |
+#include <signal.h> |
154 |
+#include <linux/hiddev.h> |
155 |
+#include <sys/ioctl.h> |
156 |
+#include "hardware.h" |
157 |
+#include "ir_remote.h" |
158 |
+#include "lircd.h" |
159 |
+ |
160 |
+enum { |
161 |
+ RPT_NO = 0, |
162 |
+ RPT_YES = 1, |
163 |
+}; |
164 |
+ |
165 |
+static int zotac_init(); |
166 |
+static int zotac_deinit(); |
167 |
+static char *zotac_rec(struct ir_remote *remotes); |
168 |
+static int zotac_decode(struct ir_remote *remote, ir_code * prep, ir_code * codep, ir_code * postp, int *repeat_flagp, |
169 |
+ lirc_t * min_remaining_gapp, lirc_t * max_remaining_gapp); |
170 |
+static void *zotac_repeat(); |
171 |
+static int zotac_getcode(); |
172 |
+ |
173 |
+/** Max number of repetitions */ |
174 |
+const unsigned max_repeat_count = 500; |
175 |
+/** Code that triggers key release */ |
176 |
+const unsigned release_code = 0x00000000; |
177 |
+/** Code that triggers device remove */ |
178 |
+const unsigned remove_code =0x00FFFFFF; |
179 |
+/** Time to wait before first repetition */ |
180 |
+const unsigned repeat_time1_us = 500000; |
181 |
+/** Time to wait between two repetitions */ |
182 |
+const unsigned repeat_time2_us = 100000; |
183 |
+/** Pipe between main thread and repetition thread */ |
184 |
+static int fd_pipe[2] = { -1, -1 }; |
185 |
+ |
186 |
+/** Thread that simulates repetitions */ |
187 |
+static pthread_t repeat_thread; |
188 |
+/** File descriptor for the real device */ |
189 |
+static int fd_hidraw; |
190 |
+ |
191 |
+const int main_code_length = 32; |
192 |
+static signed int main_code = 0; |
193 |
+static struct timeval start, end, last; |
194 |
+static int repeat_state = RPT_NO; |
195 |
+static int error_state = 0; |
196 |
+static int probe_code = 0; |
197 |
+ |
198 |
+#ifdef HAVE_LINUX_HIDDEV_FLAG_UREF |
199 |
+/* Zotac USB iR Receiver */ |
200 |
+struct hardware hw_zotac = { |
201 |
+ "/dev/usb/hiddev0", /* "device" */ |
202 |
+ -1, /* fd (device) */ |
203 |
+ LIRC_CAN_REC_LIRCCODE, /* features */ |
204 |
+ 0, /* send_mode */ |
205 |
+ LIRC_MODE_LIRCCODE, /* rec_mode */ |
206 |
+ 32, /* code_length */ |
207 |
+ zotac_init, /* init_func */ |
208 |
+ zotac_deinit, /* deinit_func */ |
209 |
+ NULL, /* send_func */ |
210 |
+ zotac_rec, /* rec_func */ |
211 |
+ zotac_decode, /* decode_func */ |
212 |
+ NULL, /* ioctl_func */ |
213 |
+ NULL, /* readdata */ |
214 |
+ "zotac" /* name */ |
215 |
+}; |
216 |
+#endif |
217 |
+ |
218 |
+static int zotac_decode(struct ir_remote *remote, ir_code * prep, ir_code * codep, ir_code * postp, int *repeat_flagp, |
219 |
+ lirc_t * min_remaining_gapp, lirc_t * max_remaining_gapp) |
220 |
+{ |
221 |
+ LOGPRINTF(1, "zotac_decode"); |
222 |
+ |
223 |
+ if (!map_code(remote, prep, codep, postp, 0, 0, main_code_length, main_code, 0, 0)) { |
224 |
+ return 0; |
225 |
+ } |
226 |
+ |
227 |
+ map_gap(remote, &start, &last, 0, repeat_flagp, min_remaining_gapp, max_remaining_gapp); |
228 |
+ /* override repeat */ |
229 |
+ *repeat_flagp = repeat_state; |
230 |
+ |
231 |
+ return 1; |
232 |
+} |
233 |
+ |
234 |
+static int zotac_getcode() { |
235 |
+ |
236 |
+ ssize_t rd; |
237 |
+ struct hiddev_usage_ref uref; |
238 |
+ struct hiddev_report_info rinfo; |
239 |
+ struct hiddev_field_info finfo; |
240 |
+ int shift = 0; |
241 |
+ |
242 |
+ rd = read(fd_hidraw, &uref, sizeof(uref)); |
243 |
+ if (rd < 0) { |
244 |
+ logprintf(LOG_ERR, "error reading '%s'", hw.device); |
245 |
+ logperror(LOG_ERR, NULL); |
246 |
+ zotac_deinit(); |
247 |
+ error_state = 1; |
248 |
+ return -1; |
249 |
+ } |
250 |
+ |
251 |
+ if (uref.field_index == HID_FIELD_INDEX_NONE) { |
252 |
+ /* |
253 |
+ * we get this when the new report has been send from |
254 |
+ * device at this point we have the uref structure |
255 |
+ * prefilled with correct report type and id |
256 |
+ * |
257 |
+ */ |
258 |
+ |
259 |
+ switch (uref.report_id) { |
260 |
+ case 1: /* USB standard keyboard usage page */ |
261 |
+ { |
262 |
+ /* This page reports cursor keys */ |
263 |
+ LOGPRINTF(3, "Keyboard (standard)\n"); |
264 |
+ |
265 |
+ /* check for special codes */ |
266 |
+ uref.field_index = 0; |
267 |
+ uref.usage_index = 1; |
268 |
+ /* fetch the usage code for given indexes */ |
269 |
+ ioctl(fd_hidraw, HIDIOCGUCODE, &uref, sizeof(uref)); |
270 |
+ /* fetch the value from report */ |
271 |
+ ioctl(fd_hidraw, HIDIOCGUSAGE, &uref, sizeof(uref)); |
272 |
+ |
273 |
+ if (uref.value) |
274 |
+ shift = 1; |
275 |
+ |
276 |
+ /* populate required field number */ |
277 |
+ uref.field_index = 1; |
278 |
+ uref.usage_index = 0; |
279 |
+ /* fetch the usage code for given indexes */ |
280 |
+ ioctl(fd_hidraw, HIDIOCGUCODE, &uref, sizeof(uref)); |
281 |
+ /* fetch the value from report */ |
282 |
+ ioctl(fd_hidraw, HIDIOCGUSAGE, &uref, sizeof(uref)); |
283 |
+ /* now we have the key */ |
284 |
+ |
285 |
+ LOGPRINTF(3, "usage: %x value: %x shift: %d\n",uref.usage_code, uref.value, shift); |
286 |
+ |
287 |
+ /* now we have the key */ |
288 |
+ if (uref.value) { |
289 |
+ probe_code = (uref.usage_code | uref.value); |
290 |
+ if (shift) |
291 |
+ probe_code |= 0x10000000; |
292 |
+ LOGPRINTF(3, "Main code 1: %x\n", probe_code); |
293 |
+ return 1; |
294 |
+ } |
295 |
+ else { |
296 |
+ LOGPRINTF(3, "rel button\n"); |
297 |
+ probe_code = release_code; |
298 |
+ return 2; |
299 |
+ } |
300 |
+ } |
301 |
+ break; |
302 |
+ |
303 |
+ case 2: |
304 |
+ case 3: /* USB generic desktop usage page */ |
305 |
+ case 4: |
306 |
+ { |
307 |
+ /* This page reports power key |
308 |
+ * (via SystemControl SLEEP) |
309 |
+ */ |
310 |
+ LOGPRINTF(3, "Generic desktop (standard)\n"); |
311 |
+ |
312 |
+ |
313 |
+ /* traverse report descriptor */ |
314 |
+ rinfo.report_type = HID_REPORT_TYPE_INPUT; |
315 |
+ rinfo.report_id = HID_REPORT_ID_FIRST; |
316 |
+ rd = ioctl(fd_hidraw, HIDIOCGREPORTINFO, &rinfo); |
317 |
+ |
318 |
+ unsigned int i,j; |
319 |
+ while (rd >= 0) { |
320 |
+ for (i = 0; i < rinfo.num_fields; i++) { |
321 |
+ finfo.report_type = rinfo.report_type; |
322 |
+ finfo.report_id = rinfo.report_id; |
323 |
+ finfo.field_index = i; |
324 |
+ ioctl(fd_hidraw, HIDIOCGFIELDINFO, &finfo); |
325 |
+ for (j = 0; j < finfo.maxusage; j++) { |
326 |
+ uref.field_index = i; |
327 |
+ uref.usage_index = j; |
328 |
+ ioctl(fd_hidraw, HIDIOCGUCODE, &uref); |
329 |
+ ioctl(fd_hidraw, HIDIOCGUSAGE, &uref); |
330 |
+ |
331 |
+ if (uref.value != 0) { |
332 |
+ LOGPRINTF(3, "field: %d, idx: %d, usage: %x value: %x\n",i, j, uref.usage_code, uref.value); |
333 |
+ probe_code = uref.usage_code; |
334 |
+ return 1; |
335 |
+ } |
336 |
+ } |
337 |
+ } |
338 |
+ rinfo.report_id |= HID_REPORT_ID_NEXT; |
339 |
+ rd = ioctl(fd_hidraw, HIDIOCGREPORTINFO, &rinfo); |
340 |
+ } |
341 |
+ return 2; |
342 |
+ } |
343 |
+ break; |
344 |
+ default: |
345 |
+ /* Unknown/unsupported report id. |
346 |
+ * Should not happen because remaining reports |
347 |
+ * from report descriptor seem to be unused by remote. |
348 |
+ */ |
349 |
+ logprintf(LOG_ERR, "Unexpected report id %d", uref.report_id); |
350 |
+ break; |
351 |
+ } |
352 |
+ } |
353 |
+ else { |
354 |
+ /* This page reports power key |
355 |
+ * (via SystemControl SLEEP) |
356 |
+ */ |
357 |
+ LOGPRINTF(3, "Same Event ...\n"); |
358 |
+ |
359 |
+ /* traverse report descriptor */ |
360 |
+ rinfo.report_type = HID_REPORT_TYPE_INPUT; |
361 |
+ rinfo.report_id = HID_REPORT_ID_FIRST; |
362 |
+ rd = ioctl(fd_hidraw, HIDIOCGREPORTINFO, &rinfo); |
363 |
+ |
364 |
+ unsigned int i,j; |
365 |
+ while (rd >= 0) { |
366 |
+ for (i = 0; i < rinfo.num_fields; i++) { |
367 |
+ finfo.report_type = rinfo.report_type; |
368 |
+ finfo.report_id = rinfo.report_id; |
369 |
+ finfo.field_index = i; |
370 |
+ ioctl(fd_hidraw, HIDIOCGFIELDINFO, &finfo); |
371 |
+ for (j = 0; j < finfo.maxusage; j++) { |
372 |
+ uref.field_index = i; |
373 |
+ uref.usage_index = j; |
374 |
+ ioctl(fd_hidraw, HIDIOCGUCODE, &uref); |
375 |
+ ioctl(fd_hidraw, HIDIOCGUSAGE, &uref); |
376 |
+ |
377 |
+ if (uref.value != 0) { |
378 |
+ LOGPRINTF(3, "usage: %x value: %x\n",uref.usage_code, uref.value); |
379 |
+ //probe_code = uref.usage_code; |
380 |
+ return 0; |
381 |
+ } |
382 |
+ } |
383 |
+ } |
384 |
+ rinfo.report_id |= HID_REPORT_ID_NEXT; |
385 |
+ rd = ioctl(fd_hidraw, HIDIOCGREPORTINFO, &rinfo); |
386 |
+ } |
387 |
+ return 2; |
388 |
+ } |
389 |
+ return 0; |
390 |
+} |
391 |
+ |
392 |
+static int zotac_init() |
393 |
+{ |
394 |
+ logprintf(LOG_INFO, "zotac initializing '%s'", hw.device); |
395 |
+ if ((fd_hidraw = open(hw.device, O_RDONLY)) < 0) { |
396 |
+ logprintf(LOG_ERR, "unable to open '%s'", hw.device); |
397 |
+ return 0; |
398 |
+ } |
399 |
+ int flags = HIDDEV_FLAG_UREF | HIDDEV_FLAG_REPORT; |
400 |
+ if (ioctl(fd_hidraw, HIDIOCSFLAG, &flags)) { |
401 |
+ return 0; |
402 |
+ } |
403 |
+ hw.fd = fd_hidraw; |
404 |
+ |
405 |
+ /* Create pipe so that events sent by the repeat thread will |
406 |
+ trigger main thread */ |
407 |
+ if (pipe(fd_pipe) != 0) { |
408 |
+ logperror(LOG_ERR, "couldn't open pipe"); |
409 |
+ close(fd_hidraw); |
410 |
+ return 0; |
411 |
+ } |
412 |
+ hw.fd = fd_pipe[0]; |
413 |
+ /* Create thread to simulate repetitions */ |
414 |
+ if (pthread_create(&repeat_thread, NULL, zotac_repeat, NULL)) { |
415 |
+ logprintf(LOG_ERR, "Could not create \"repeat thread\""); |
416 |
+ return 0; |
417 |
+ } |
418 |
+ return 1; |
419 |
+} |
420 |
+ |
421 |
+static int zotac_deinit() |
422 |
+{ |
423 |
+ pthread_cancel(repeat_thread); |
424 |
+ if (fd_hidraw != -1) { |
425 |
+ // Close device if it is open |
426 |
+ logprintf(LOG_INFO, "closing '%s'", hw.device); |
427 |
+ close(fd_hidraw); |
428 |
+ fd_hidraw = -1; |
429 |
+ } |
430 |
+ // Close pipe input |
431 |
+ if (fd_pipe[1] >= 0) { |
432 |
+ close(fd_pipe[1]); |
433 |
+ fd_pipe[1] = -1; |
434 |
+ } |
435 |
+ // Close pipe output |
436 |
+ if (fd_pipe[0] >= 0) { |
437 |
+ close(fd_pipe[0]); |
438 |
+ fd_pipe[0] = -1; |
439 |
+ } |
440 |
+ hw.fd = -1; |
441 |
+ return 1; |
442 |
+} |
443 |
+ |
444 |
+/** |
445 |
+ * Runtime that reads device, forwards codes to main thread |
446 |
+ * and simulates repetitions. |
447 |
+ */ |
448 |
+static void *zotac_repeat() |
449 |
+{ |
450 |
+ int repeat_count = 0; |
451 |
+ unsigned current_code; |
452 |
+ int ret; |
453 |
+ int sel; |
454 |
+ fd_set files; |
455 |
+ struct timeval delay; |
456 |
+ int pressed = 0; |
457 |
+ int fd = fd_pipe[1]; |
458 |
+ |
459 |
+ while (1) { |
460 |
+ // Initialize set to monitor device's events |
461 |
+ FD_ZERO(&files); |
462 |
+ FD_SET(fd_hidraw, &files); |
463 |
+ if (pressed) { |
464 |
+ sel = select(FD_SETSIZE, &files, NULL, NULL, &delay); |
465 |
+ } else { |
466 |
+ sel = select(FD_SETSIZE, &files, NULL, NULL, NULL); |
467 |
+ } |
468 |
+ |
469 |
+ switch (sel) { |
470 |
+ case 1: |
471 |
+ // Data ready in device's file |
472 |
+ ret = zotac_getcode(); |
473 |
+ |
474 |
+ if (ret < 0) { |
475 |
+ // Error |
476 |
+ logprintf(LOG_ERR, "(%s) Could not read %s", __FUNCTION__, hw.device); |
477 |
+ goto exit_loop; |
478 |
+ } |
479 |
+ if (ret == 1) { |
480 |
+ // Key code : forward it to main thread |
481 |
+ pressed = 1; |
482 |
+ repeat_count = 0; |
483 |
+ delay.tv_sec = 0; |
484 |
+ delay.tv_usec = repeat_time1_us; |
485 |
+ current_code = probe_code; |
486 |
+ } else if (ret == 2) { |
487 |
+ // Release code : stop repetitions |
488 |
+ pressed = 0; |
489 |
+ current_code = release_code; |
490 |
+ } else if (ret == 0) { |
491 |
+ continue; |
492 |
+ } |
493 |
+ break; |
494 |
+ case 0: |
495 |
+ repeat_count++; |
496 |
+ if (repeat_count >= max_repeat_count) { |
497 |
+ // Too many repetitions, something must have gone wrong |
498 |
+ logprintf(LOG_ERR,"(%s) too many repetitions", __FUNCTION__); |
499 |
+ goto exit_loop; |
500 |
+ } |
501 |
+ // Timeout : send current_code again to main |
502 |
+ // thread to simulate repetition |
503 |
+ delay.tv_sec = 0; |
504 |
+ delay.tv_usec = repeat_time2_us; |
505 |
+ break; |
506 |
+ default: |
507 |
+ // Error |
508 |
+ logprintf(LOG_ERR, "(%s) select() failed", __FUNCTION__); |
509 |
+ goto exit_loop; |
510 |
+ } |
511 |
+ // Send code to main thread through pipe |
512 |
+ write(fd, ¤t_code, sizeof(current_code)); |
513 |
+ } |
514 |
+exit_loop: |
515 |
+ |
516 |
+ // Wake up main thread with special key code |
517 |
+ current_code = remove_code; |
518 |
+ write(fd, ¤t_code, sizeof(current_code)); |
519 |
+ return NULL; |
520 |
+} |
521 |
+ |
522 |
+/* |
523 |
+* Aureal Technology ATWF@83 cheap remote |
524 |
+* specific code. |
525 |
+*/ |
526 |
+ |
527 |
+static char *zotac_rec(struct ir_remote *remotes) |
528 |
+{ |
529 |
+ unsigned ev; |
530 |
+ int rd; |
531 |
+ last = end; |
532 |
+ gettimeofday(&start, NULL); |
533 |
+ rd = read(hw.fd, &ev, sizeof(ev)); |
534 |
+ |
535 |
+ if (rd == -1) { |
536 |
+ // Error |
537 |
+ logprintf(LOG_ERR, "(%s) could not read pipe", __FUNCTION__); |
538 |
+ zotac_deinit(); |
539 |
+ return 0; |
540 |
+ } |
541 |
+ |
542 |
+ if (ev == release_code) { |
543 |
+ // Release code |
544 |
+ main_code = 0; |
545 |
+ return 0; |
546 |
+ } else if (ev == remove_code) { |
547 |
+ // Device has been removed |
548 |
+ zotac_deinit(); |
549 |
+ return 0; |
550 |
+ } |
551 |
+ |
552 |
+ LOGPRINTF(1, "zotac : %x", ev); |
553 |
+ // Record the code and check for repetition |
554 |
+ if (main_code == ev) { |
555 |
+ repeat_state = RPT_YES; |
556 |
+ } else { |
557 |
+ main_code = ev; |
558 |
+ repeat_state = RPT_NO; |
559 |
+ } |
560 |
+ gettimeofday(&end, NULL); |
561 |
+ return decode_all(remotes); |
562 |
+} |
563 |
diff -rupN base/remotes/zotac/lircd.conf.zotac mod/remotes/zotac/lircd.conf.zotac |
564 |
--- base/remotes/zotac/lircd.conf.zotac 1970-01-01 01:00:00.000000000 +0100 |
565 |
+++ mod/remotes/zotac/lircd.conf.zotac 2013-03-21 16:31:31.343367869 +0100 |
566 |
@@ -0,0 +1,77 @@ |
567 |
+ |
568 |
+# Please make this file available to others |
569 |
+# by sending it to <lirc@×××××××××.de> |
570 |
+# |
571 |
+# this config file was automatically generated |
572 |
+# using lirc-0.9.1-git(zotac) on Mon Apr 2 14:10:29 2012 |
573 |
+# |
574 |
+# contributed by |
575 |
+# |
576 |
+# brand: zotac.conf |
577 |
+# model no. of remote control: |
578 |
+# devices being controlled by this remote: |
579 |
+# |
580 |
+ |
581 |
+begin remote |
582 |
+ |
583 |
+ name zotac.conf |
584 |
+ bits 32 |
585 |
+ eps 30 |
586 |
+ aeps 100 |
587 |
+ |
588 |
+ one 0 0 |
589 |
+ zero 0 0 |
590 |
+ gap 100123 |
591 |
+ min_repeat 9 |
592 |
+# suppress_repeat 9 |
593 |
+# uncomment to suppress unwanted repeats |
594 |
+# toggle_bit_mask 0x7004F |
595 |
+ |
596 |
+ begin codes |
597 |
+ KEY_SLEEP 0x00010082 |
598 |
+ KEY_WAKEUP 0x00010083 |
599 |
+ KEY_RECORD 0x000C00B2 |
600 |
+ KEY_PAUSE 0x000C00B1 |
601 |
+ KEY_STOP 0x000C00B7 |
602 |
+ KEY_REWIND 0x000C00B4 |
603 |
+ KEY_PLAY 0x000C00B0 |
604 |
+ KEY_FORWARD 0x000C00B3 |
605 |
+ KEY_LEFTSHIFT 0x000C00B6 |
606 |
+ KEY_RIGHTSHIFT 0x000C00B5 |
607 |
+ KEY_BACK 0x000C0224 |
608 |
+ KEY_INFO 0x000C0209 |
609 |
+ KEY_MENU 0xFFBC000D |
610 |
+ KEY_UP 0x00070052 |
611 |
+ KEY_LEFT 0x00070050 |
612 |
+ KEY_RIGHT 0x0007004F |
613 |
+ KEY_DOWN 0x00070051 |
614 |
+ KEY_OK 0x00070028 |
615 |
+ KEY_VOLUMEUP 0x000C00E9 |
616 |
+ KEY_VOLUMEDOWN 0x000C00EA |
617 |
+ KEY_MUTE 0x000C00E2 |
618 |
+ KEY_CHANNELUP 0x000C009C |
619 |
+ KEY_CHANNELDOWN 0x000C009D |
620 |
+ KEY_1 0x0007001E |
621 |
+ KEY_2 0x0007001F |
622 |
+ KEY_3 0x00070020 |
623 |
+ KEY_4 0x00070021 |
624 |
+ KEY_5 0x00070022 |
625 |
+ KEY_6 0x00070023 |
626 |
+ KEY_7 0x00070024 |
627 |
+ KEY_8 0x00070025 |
628 |
+ KEY_9 0x00070026 |
629 |
+ KEY_0 0x00070027 |
630 |
+ KEY_NUMERIC_STAR 0x10070025 |
631 |
+ KEY_NUMERIC_POUND 0x10070020 |
632 |
+ KEY_CLEAR 0x00070029 |
633 |
+ KEY_TEXT 0xFFBC005A |
634 |
+ KEY_TITLE 0x000C008D |
635 |
+ KEY_ENTER 0x00070028 |
636 |
+ KEY_RED 0xFFBC005B |
637 |
+ KEY_GREEN 0xFFBC005C |
638 |
+ KEY_YELLOW 0xFFBC005D |
639 |
+ KEY_BLUE 0xFFBC005E |
640 |
+ end codes |
641 |
+ |
642 |
+end remote |
643 |
+ |
644 |
diff -rupN base/setup.data mod/setup.data |
645 |
--- base/setup.data 2011-03-25 23:28:18.000000000 +0100 |
646 |
+++ mod/setup.data 2013-03-21 16:28:11.433935463 +0100 |
647 |
@@ -146,6 +146,7 @@ hw_menu_entry: @hw-usb |
648 |
usb_uirt_raw: "USB-UIRT" |
649 |
mplay: "VLSystem MPlay Blast" |
650 |
mplay: "VLSystem MPlay Mini" |
651 |
+ zotac: "Zotac USB IR Receiver" |
652 |
|
653 |
param_type: \ |
654 |
act200l \ |
655 |
@@ -260,7 +261,8 @@ param_type: \ |
656 |
ttusbir \ |
657 |
tvbox \ |
658 |
udp \ |
659 |
- wpc8769l |
660 |
+ wpc8769l \ |
661 |
+ zotac |
662 |
none: |
663 |
|
664 |
default_param: \ |
665 |
@@ -331,7 +333,8 @@ default_param: \ |
666 |
ttusbir \ |
667 |
tvbox \ |
668 |
udp \ |
669 |
- wpc8769l |
670 |
+ wpc8769l \ |
671 |
+ zotac |
672 |
none: |
673 |
|
674 |
default_param: \ |