Gentoo Archives: gentoo-commits

From: Mike Auty <ikelos@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/ikelos:master commit in: app-misc/lirc/files/, app-misc/lirc/
Date: Sat, 28 Dec 2013 02:21:58
Message-Id: 1388196474.eea34740b4f52893976857214bc8fba6e20a9bb1.ikelos@gentoo
1 commit: eea34740b4f52893976857214bc8fba6e20a9bb1
2 Author: Mike Auty <mike.auty <AT> gmail <DOT> com>
3 AuthorDate: Sat Dec 28 02:07:54 2013 +0000
4 Commit: Mike Auty <ikelos <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 28 02:07:54 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/ikelos.git;a=commit;h=eea34740
7
8 Add in lirc with usbir_toy support.
9
10 ---
11 app-misc/lirc/Manifest | 20 +
12 app-misc/lirc/files/irexec-confd | 9 +
13 app-misc/lirc/files/irexec-initd | 28 +
14 app-misc/lirc/files/irexec-initd-0.8.6-r2 | 28 +
15 .../files/lirc-0.8.3_pre1-remotewonderplus.patch | 26 +
16 .../lirc/files/lirc-0.8.4-portaudio_check.patch | 18 +
17 app-misc/lirc/files/lirc-0.9.0-atiusb_kfifo.patch | 14 +
18 .../files/lirc-0.9.0-kernel-2.6.39-fixes.patch | 67 ++
19 .../lirc/files/lirc-0.9.0-kernel-3.3.0-fixes.patch | 50 ++
20 .../lirc/files/lirc-0.9.0-kernel-3.5-err-fix.patch | 12 +
21 app-misc/lirc/files/lirc-0.9.0-usb_irtoy.patch | 772 +++++++++++++++++++++
22 app-misc/lirc/files/lircd-0.8.3 | 23 +
23 app-misc/lirc/files/lircd-0.8.6 | 41 ++
24 app-misc/lirc/files/lircd-0.8.6-r2 | 52 ++
25 app-misc/lirc/files/lircd.conf.2 | 10 +
26 app-misc/lirc/files/lircd.conf.4 | 22 +
27 app-misc/lirc/files/lircmd | 20 +
28 app-misc/lirc/files/modprobed.lirc | 22 +
29 app-misc/lirc/files/modulesd.lirc | 22 +
30 app-misc/lirc/lirc-0.9.0-r3.ebuild | 428 ++++++++++++
31 20 files changed, 1684 insertions(+)
32
33 diff --git a/app-misc/lirc/Manifest b/app-misc/lirc/Manifest
34 new file mode 100644
35 index 0000000..8041c34
36 --- /dev/null
37 +++ b/app-misc/lirc/Manifest
38 @@ -0,0 +1,20 @@
39 +AUX irexec-confd 280 SHA256 c404ad3b624004cab25bd3a89593cdeb0abbc25771d6e52caf2f37cb4f7b2b79 SHA512 2b33e1044086d11fd6e1f9a204ce925182a3a2b92ef4399610e01702f9c2c8fbc87cae52961123297171eef3d40468ac17437b4281b26a5f3b256c9cebc612ac WHIRLPOOL ff0e09a0babe7f434252416f3c7d0fb27b95215c62e582c1cd4670130c48c74dcf1e565e4aa7c5705fe39f67922b0abdc28a1938a9288ef3476979bd99609377
40 +AUX irexec-initd 808 SHA256 9325419aa45d80c205bc1cd47fe839b178da74bca5dd928cbe3ae17423b92493 SHA512 6d9535cfc6469d62f2b09bc5d12ff7c792c279dab6d58d3847625ac995f20945309765c3b9781bd51dbd9d2986465f0b96818c3f4162a689807bf5e3936a4067 WHIRLPOOL be2ef1c89803a6a7c3f533c075a6a60be550d84c9b1812673d79df400305518df2b5329c6726c4aece88cf113dd2db051d1c6d6e5ea7e37e16eb463c38694690
41 +AUX irexec-initd-0.8.6-r2 816 SHA256 5e5a31fbd93294a6e210499a880fcab371b23706824c9d60d827b0187d7bade4 SHA512 b90226e8dc29ed1769275a010e0b1f5376b91d4f3cfd7bb9dd135bdee31c0f7849f31a885baafe4cbbf9f11b548712e1d78198b44252c779ffeccc5e47730054 WHIRLPOOL 00936357f3df1f63821d7da4f4452ba25a5368d4d128c088e421be2fff2e50d1a190522a9aac6712da2867e827492e674806e5871f797eacf12d333091991f96
42 +AUX lirc-0.8.3_pre1-remotewonderplus.patch 943 SHA256 547efbfa30f282ba9100495044e3b720c8f74c44f9a4e34db934d2ac7976fe29 SHA512 f1c5b03eafb8fb9d4190e438fb4ca734cac102c7f3a097f193a0a1ac7cdee33b01fb1d794959e00be16c78bb66e34d113f3ff8fb87678e99f82670ec0306e3ca WHIRLPOOL 999b01a1c2860457bf9ed68891cbb497595d58fe57627bc87d5f6401835ee5586ebcf124e1f563264ba64df22e38c7a6ccfbaf628123c5a2419bb0f57f74f19a
43 +AUX lirc-0.8.4-portaudio_check.patch 769 SHA256 01e2034aaa6a7eb039e5c0e6c3b4a6ed38860614d3d0b0005d99a4aac2b3827e SHA512 a4e63da5d03f1fbb072679c3a415ae55767d601512f158c5e2fc52a045b632a055b94dca4e9d0d236ceeeb367daf22d4cc71f542229edb4fb13410512a8e4f0b WHIRLPOOL 0717efa4d7934c9736b220ec4416d1827397267b34bc3343a16a5963729fcfaa4871bb4e47b1aebbb310ea5bcc2bfaa7c675a451f5db46d979f0e4438e84a37e
44 +AUX lirc-0.9.0-atiusb_kfifo.patch 437 SHA256 b7950ee185588a3626b8024cb22c0e67c8514362f5c9cb74bfcead8018e11b02 SHA512 d072ecd94ed4b7f1662441106650b7eb329cbe62887819c1e607ae87375a17dedea02a3a5dcf6956a1151743fd652ec5884577c595771740eef509daab8dbd02 WHIRLPOOL f0013dd75d6cf3486cddbea4e97e7ca9962af882befc5e994f258d1eb5e77e09379c4ca246e407f4c7ad5438b860e0e3b0abb2cade6f04b101525f060188ed03
45 +AUX lirc-0.9.0-kernel-2.6.39-fixes.patch 2175 SHA256 f5f48c867716288835a73b8d29aa9b1fcc4905a723e1f99e35fe396b2c759957 SHA512 a502b815cec565a49382e9ad0e7237a9bc7da431f41e94db42d214655577212606500ea2651a298db8cd3a68ce706461e6a773b0d9e3316ac7d49b2038fda354 WHIRLPOOL f1968f51cc29ce4f630c59c964d106e024f4cb3e5938ea80b271800a65d130a42531db5fe6e220ae20577cd4f1998de09e5dbdf52ff1cf6f3839922dd9ece114
46 +AUX lirc-0.9.0-kernel-3.3.0-fixes.patch 1545 SHA256 f02e7b3c52dd17e179b6f89afc15f5eec2889a18f1df4523df680fbf50adb584 SHA512 75743844d7fe61a91174c1d7ee78a229e347659a35d1062a704c39e424d8a433efac4216a0b840282c38a4f2f22baa7a489c1c0402a40f734e7475992046a2ae WHIRLPOOL 871523dc5a9757d170b740acd9845b0ba42c4c5c4c5fdc71b5c701cefa2f6122cf1cb6171698e6bf2e605d93f052d15371657f5c1901794819ca2c3eded2ec1f
47 +AUX lirc-0.9.0-kernel-3.5-err-fix.patch 326 SHA256 171f03c8d93e60b86caec6027c303797028f57bc99cd37e6ccb65ef074f5de35 SHA512 c3a6e802b140595155a7ae8dc695bc13e4d6147323949a8dc9c86857bf7abcd442339eac64f99869925c308a100bfb1b7b0eb715f086afb8997252164ff079df WHIRLPOOL aa849092798c5e1335336d4de86139b5c545c8ffa899a92182f9a010e0c1e28d8e3dfca8e3d71bf2aee874c52dd237b8b10f9d514e7dce571b634b6cb1d4bd15
48 +AUX lirc-0.9.0-usb_irtoy.patch 19871 SHA256 17af4972d3194476314d3f10c8997a04734139b7245dd6cd9b2be27dcd03fbc8 SHA512 30fba8e5e4d2604b10d15029a7f46dd6dc9f71b12f949a5fbd44c3f5030f098c4fab892bf649a0bd168ae5e64ead280aae7cbd0fe67562377b5d31409939d9ad WHIRLPOOL 1969843afa953713e2d44f6758bc1fdebdcfbd28d5623c3aad9febf3ce8fb71e725d184a657838a823abadfb6541558f360457c5f86b41a646a7675e8f44fe80
49 +AUX lircd-0.8.3 581 SHA256 9ba3c5a8c0ca5966729dc5e2c7a5960bbf12b443d91e9e319a0277f153df1b1f SHA512 d0f652df31fa1583232e3b29b5fc95d21fc76564df9f5e54881ee849c7a6fa0d697f15335c2e3f1b8ab0b29b7cddef605bd15073f394c29df9e5704854b0017a WHIRLPOOL 69c23cc6584ec435ce50689df223b27244a8deda351dbf048646f05021eba6893c22be24e167930cbb786f15e79cbfa97cf335de8b311ff9543c0e50a853a503
50 +AUX lircd-0.8.6 973 SHA256 473cf04b2f6addf7c86d23103b1eff68bf3758fda2bf25401ff0631c568c7805 SHA512 9992b629073d9d9c05388b6063d1a7eff6a47514ccc1af2739638c8375b284cd6252c1a825d172d160acee9983f7bd59fdde6dd282c62597e8d6d7a149f06f69 WHIRLPOOL ccb99a3df8e52f3b6abeddebd727aa734c547fafb3db19b4fd266fc7f69d0b0674f937a21bb11d8d338d59c019d870797715993eb781de1f15f4bef1cfe9927d
51 +AUX lircd-0.8.6-r2 1317 SHA256 40d1b609e54327d40e0f4314e31ea58aa029bf95f9f27f311da1260fef2fa416 SHA512 c896b229c6b025d4f2cc3684c0905b83e8e6663f11f35fc705636445846f069cbe6ea1b03bd2e7dab136b0d4895ad35b2b940d713caee3204a97bc8c8080c2f3 WHIRLPOOL dda8fdee434778dcefb90778485845e1c7f724e292d6d11c26c5ac951b232b1bc87b75faa236c48bc3ffd4abb68b74bacbb5564173215c8d944906c542eaa232
52 +AUX lircd.conf.2 317 SHA256 694d96ffc0c5b8d258592d89c0221aa9b10d69ce024a69a0cc935d899e0b855e SHA512 59779104301e96b377999aad9980f2a915ee9d817e0ba33c172602ea868b49450cd198fe26cf6da4dd8690684768f4d5cd6132a66fec5fea486fbd7a5a8c3a7b WHIRLPOOL 353f5e9e17a831bc124124316f043063ee9c4a13f29f44cf66d236cfcd7d30e756392f18ad761343c723e0e4079541638d1ea7b921074e75a8449f0a5388d179
53 +AUX lircd.conf.4 699 SHA256 d36ff77fa193a065d25e373723e03f1a9471205151b82c73a6574cce4f095962 SHA512 1fb1778f4cc72fc9c11b13a704b3abe80bcce5b3770b69b6b6bea8571e5293adad8c6968779b812e611b67734462c9a577cc71c6b16da3a5bfe31b8007300a62 WHIRLPOOL c9d3b5845b4d395abed932f4553808c0eff66f2be2b6d6ab302c98b11eb2ffc0fcd752e2862982896a4c935425ae03a545cdeb4a6c0da91141d1622178263053
54 +AUX lircmd 466 SHA256 d47f22a33a83c14a4a0c333d6a445c40e550c491899fb0c6d323e23fe1eac7b7 SHA512 d3cf896f1a2229a51670d5c658c04d5c0aa078a3f8ea15211d655f8883366f9d4102e93941a75957ab3095faa5f598fb1242bfd03f534bb8af134f542d077c6e WHIRLPOOL 39880900b60f44277f41db990841620deefae03f2698122949038187a36631a14e90dba07323e5bf9b6e14cf05f28fe5a3b944ee802e56286ccbf58194ab3d35
55 +AUX modprobed.lirc 549 SHA256 b4951252321ea326d3ec401e5ff1112716c5aaf5b2ca94d9f5e187e22ad35c44 SHA512 a64cac97e21ab53c247d8dd3e518b3caee5eeb9c3558727eba8a04684894c6be1695ce681e71d559474f4e78bbb39130d97f843eae18e56b3d3eb70f1fbefc63 WHIRLPOOL a45ec8b3cd725f9b4c6b991cf6d4fec7869a07911a2ac82535dca665a0dd99a66b40d85faf0beea780001e9260a8a17c1ccec880c05a271a138c1e0501f7727c
56 +AUX modulesd.lirc 482 SHA256 3906b61951e1245cb3c9b16e81255a735f7bcdbbfcbedcdf44cd53236e2a3f28 SHA512 07ae7c7288878f65857962bb3a343b83d58eca6447299253dd297dec6443b95d89f46ebcbe1f1ac66ec5062f8134a2e19ecc3ce397b2f8d0d27f203a2a103fcc WHIRLPOOL 2bc4c45d3fd314cc88d50f79974b2aafa4e55a7df7383cbd2f3ddf5b66e144b5700f8d411f79ea458caec0da3e47d5e0db2c34e1efcc2d748c473fe2c5ae7389
57 +DIST lirc-0.9.0.tar.bz2 857286 SHA256 6323afae6ad498d4369675f77ec3dbb680fe661bea586aa296e67f2e2daba4ff SHA512 e91534c63e6065bd7da3b15e1676edf1672b8beb21864a6825df86247d7d165bf2dee6f8191732933e24e42a406e46afc55559948e4061eed2de7b08fac13431 WHIRLPOOL 0a1c00b07898aa7a5d78865fb73c6d26c6331dd0a4945773a801d29e40298b365eb58cae113a95fcf73be678a24ac082ad0868e8051303d732882fb82a859a7b
58 +EBUILD lirc-0.9.0-r3.ebuild 13125 SHA256 68fdce2db53886851756fc834b764381cfdccec1e98cb1c9a27753f67a7afb0e SHA512 df5ec27b6398d2820205076010b07f28b3a0169c04e9c331f9f4fe563715c1acd7334bdd5afb4a690c78b04baf224c24adb7ef67ab2f300069fa0de36a886d78 WHIRLPOOL 81d2835d949120d832da43f807bbd06ec980cba7a8006a00b2a853c89b841d027e6ebc7609951d1dfc72ff17203cde7121fb1712859c6bbc74f545f81f6ef500
59
60 diff --git a/app-misc/lirc/files/irexec-confd b/app-misc/lirc/files/irexec-confd
61 new file mode 100644
62 index 0000000..48eb8dd
63 --- /dev/null
64 +++ b/app-misc/lirc/files/irexec-confd
65 @@ -0,0 +1,9 @@
66 +# Options to pass to the irexec process
67 +IREXEC_OPTS="/etc/lircrc"
68 +
69 +# User to execute irexec as.
70 +# Warning: Running irexec as root can open security holes
71 +#IREXEC_USER="root"
72 +
73 +# Use this to disable the warning printed when starting irexec as root
74 +# IREXEC_DISABLE_ROOT_WARNING=yes
75
76 diff --git a/app-misc/lirc/files/irexec-initd b/app-misc/lirc/files/irexec-initd
77 new file mode 100755
78 index 0000000..e1defee
79 --- /dev/null
80 +++ b/app-misc/lirc/files/irexec-initd
81 @@ -0,0 +1,28 @@
82 +#!/sbin/runscript
83 +# Copyright 2003 Martin Hierling <mad@×××××××××××.de>
84 +# Distributed under the terms of the GNU General Public License v2
85 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/files/irexec-initd,v 1.3 2007/05/24 20:12:16 zzam Exp $
86 +
87 +: ${IREXEC_USER:=root}
88 +
89 +depend() {
90 + need lircd
91 +}
92 +
93 +start() {
94 + if [ "x${IREXEC_USER}" = "xroot" -a "x${IREXEC_DISABLE_ROOT_WARNING}" != "xyes" ]; then
95 + ewarn "Warning: Running irexec as root can open security holes"
96 + fi
97 +
98 + ebegin "Starting irexec"
99 + start-stop-daemon --start --chuid ${IREXEC_USER} --user ${IREXEC_USER} --chdir / \
100 + --exec /usr/bin/irexec -- --daemon ${IREXEC_OPTS}
101 + eend $? "Failed to start irexec."
102 +}
103 +
104 +stop() {
105 + ebegin "Stopping irexec"
106 + start-stop-daemon --stop --exec /usr/bin/irexec --user ${IREXEC_USER}
107 + eend $? "Failed to stop irexec."
108 +}
109 +
110
111 diff --git a/app-misc/lirc/files/irexec-initd-0.8.6-r2 b/app-misc/lirc/files/irexec-initd-0.8.6-r2
112 new file mode 100755
113 index 0000000..567322a
114 --- /dev/null
115 +++ b/app-misc/lirc/files/irexec-initd-0.8.6-r2
116 @@ -0,0 +1,28 @@
117 +#!/sbin/runscript
118 +# Copyright 2003 Martin Hierling <mad@×××××××××××.de>
119 +# Distributed under the terms of the GNU General Public License v2
120 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/files/irexec-initd-0.8.6-r2,v 1.1 2009/11/15 10:04:21 zzam Exp $
121 +
122 +: ${IREXEC_USER:=root}
123 +
124 +depend() {
125 + need lirc
126 +}
127 +
128 +start() {
129 + if [ "x${IREXEC_USER}" = "xroot" -a "x${IREXEC_DISABLE_ROOT_WARNING}" != "xyes" ]; then
130 + ewarn "Warning: Running irexec as root can open security holes"
131 + fi
132 +
133 + ebegin "Starting irexec"
134 + start-stop-daemon --start --chuid ${IREXEC_USER} --user ${IREXEC_USER} --chdir / \
135 + --exec /usr/bin/irexec -- --daemon ${IREXEC_OPTS}
136 + eend $? "Failed to start irexec."
137 +}
138 +
139 +stop() {
140 + ebegin "Stopping irexec"
141 + start-stop-daemon --stop --exec /usr/bin/irexec --user ${IREXEC_USER}
142 + eend $? "Failed to stop irexec."
143 +}
144 +
145
146 diff --git a/app-misc/lirc/files/lirc-0.8.3_pre1-remotewonderplus.patch b/app-misc/lirc/files/lirc-0.8.3_pre1-remotewonderplus.patch
147 new file mode 100644
148 index 0000000..66527bc
149 --- /dev/null
150 +++ b/app-misc/lirc/files/lirc-0.8.3_pre1-remotewonderplus.patch
151 @@ -0,0 +1,26 @@
152 +--- lirc-0.8.0/drivers/lirc_atiusb/lirc_atiusb.c.orig 2005-10-29 08:18:53.000000000 -0600
153 ++++ lirc-0.8.0/drivers/lirc_atiusb/lirc_atiusb.c 2006-04-01 14:31:05.000000000 -0700
154 +@@ -147,8 +147,9 @@
155 + /* init strings */
156 + #define USB_OUTLEN 7
157 +
158 +-static char init1[] = {0x01, 0x00, 0x20, 0x14};
159 +-static char init2[] = {0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20};
160 ++static char init1[] = {0x80, 0x05, 0x1b, 0x15, 0x14, 0x20, 0x24, 0x15};
161 ++static char init2[] = {0x83, 0x03};
162 ++static char init3[] = {0x84, 0xd7, 0x020};
163 +
164 + struct in_endpt {
165 + /* inner link in list of endpoints for the remote specified by ir */
166 +@@ -1034,8 +1034,9 @@
167 + usb_sndintpipe(ir->usbdev, oep->ep->bEndpointAddress), oep->buf,
168 + USB_OUTLEN, usb_remote_send, oep, oep->ep->bInterval);
169 +
170 +- send_packet(oep, 0x8004, init1);
171 +- send_packet(oep, 0x8007, init2);
172 ++ send_packet(oep, 0x8007, init1);
173 ++ send_packet(oep, 0x8002, init2);
174 ++ send_packet(oep, 0x8003, init3);
175 + }
176 + }
177 +
178
179 diff --git a/app-misc/lirc/files/lirc-0.8.4-portaudio_check.patch b/app-misc/lirc/files/lirc-0.8.4-portaudio_check.patch
180 new file mode 100644
181 index 0000000..36f5f36
182 --- /dev/null
183 +++ b/app-misc/lirc/files/lirc-0.8.4-portaudio_check.patch
184 @@ -0,0 +1,18 @@
185 +Portaudio is only needed for LIRC_DEVICES=audio, so not checking for Portaudio when the device is disabled will prevent automagic dependencies.
186 +--- configure.ac.orig 2009-03-13 10:02:50.000000000 +0100
187 ++++ configure.ac 2009-03-13 10:04:00.000000000 +0100
188 +@@ -336,14 +336,6 @@
189 + AC_DEFINE(HAVE_LIBIRMAN_SW)
190 + possible_drivers="${possible_drivers} (irman_sw)"
191 + )
192 +-dnl audio driver requires PortAudio library installed and some linker flags
193 +-AC_CHECK_HEADERS(portaudio.h,[
194 +- AC_CHECK_LIB(portaudio, Pa_Initialize,[
195 +- AC_DEFINE(HAVE_LIBPORTAUDIO)
196 +- possible_drivers="${possible_drivers} (audio)"
197 +- ],,${portaudio_lib_other}
198 +- )]
199 +-)
200 + dnl audio_alsa driver requires ALSA library installed and some linker flags
201 + have_alsa=no
202 + AC_CHECK_HEADERS(alsa/asoundlib.h,[
203
204 diff --git a/app-misc/lirc/files/lirc-0.9.0-atiusb_kfifo.patch b/app-misc/lirc/files/lirc-0.9.0-atiusb_kfifo.patch
205 new file mode 100644
206 index 0000000..32edb24
207 --- /dev/null
208 +++ b/app-misc/lirc/files/lirc-0.9.0-atiusb_kfifo.patch
209 @@ -0,0 +1,14 @@
210 +--- a/drivers/lirc_atiusb/lirc_atiusb.c 2012-07-17 16:04:39.000000000 -0400
211 ++++ b/drivers/lirc_atiusb/lirc_atiusb.c 2012-07-17 16:19:06.000000000 -0400
212 +@@ -1050,7 +1050,11 @@
213 + goto new_irctl_failure_check;
214 + }
215 +
216 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
217 + if (lirc_buffer_init(driver->rbuf, dclen, 1)) {
218 ++#else
219 ++ if (lirc_buffer_init(driver->rbuf, dclen, 2)) {
220 ++#endif
221 + mem_failure = 4;
222 + goto new_irctl_failure_check;
223 + }
224
225 diff --git a/app-misc/lirc/files/lirc-0.9.0-kernel-2.6.39-fixes.patch b/app-misc/lirc/files/lirc-0.9.0-kernel-2.6.39-fixes.patch
226 new file mode 100644
227 index 0000000..6247370
228 --- /dev/null
229 +++ b/app-misc/lirc/files/lirc-0.9.0-kernel-2.6.39-fixes.patch
230 @@ -0,0 +1,67 @@
231 +diff -u a/drivers/lirc_atiusb/lirc_atiusb.c b/drivers/lirc_atiusb/lirc_atiusb.c
232 +--- a/drivers/lirc_atiusb/lirc_atiusb.c
233 ++++ b/drivers/lirc_atiusb/lirc_atiusb.c
234 +@@ -48,7 +48,9 @@
235 + #include <linux/slab.h>
236 + #include <linux/module.h>
237 + #include <linux/kmod.h>
238 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
239 + #include <linux/smp_lock.h>
240 ++#endif
241 + #include <linux/completion.h>
242 + #include <linux/uaccess.h>
243 + #include <linux/usb.h>
244 +diff -u a/drivers/lirc_i2c/lirc_i2c.c b/drivers/lirc_i2c/lirc_i2c.c
245 +--- a/drivers/lirc_i2c/lirc_i2c.c
246 ++++ b/drivers/lirc_i2c/lirc_i2c.c
247 +@@ -555,8 +555,8 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
248 + kfree(ir);
249 + return -EINVAL;
250 + }
251 +- printk(KERN_INFO "lirc_i2c: chip 0x%x found @ 0x%02x (%s)\n",
252 +- adap->id, addr, ir->c.name);
253 ++ printk(KERN_INFO "lirc_i2c: chip found @ 0x%02x (%s)\n",
254 ++ addr, ir->c.name);
255 +
256 + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
257 + /* register device */
258 +diff -u a/drivers/lirc_wpc8769l/lirc_wpc8769l.c b/drivers/lirc_wpc8769l/lirc_wpc8769l.c
259 +--- a/drivers/lirc_wpc8769l/lirc_wpc8769l.c
260 ++++ b/drivers/lirc_wpc8769l/lirc_wpc8769l.c
261 +@@ -361,14 +361,22 @@ static irqreturn_t irq_handler(int irqno, void *blah, struct pt_regs *regs)
262 + size = count << 3;
263 +
264 + ldata = (unsigned long *) data_buf;
265 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
266 + next_one = generic_find_next_le_bit(ldata, size, 0);
267 ++#else
268 ++ next_one = find_next_zero_bit_le(ldata, size, 0);
269 ++#endif
270 +
271 + if (next_one > 0)
272 + put_pulse_bit(next_one
273 + * WPC8769L_USECS_PER_BIT);
274 +
275 + while (next_one < size) {
276 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
277 + next_zero = generic_find_next_zero_le_bit(ldata,
278 ++#else
279 ++ next_zero = find_next_zero_bit_le(ldata,
280 ++#endif
281 + size, next_one + 1);
282 +
283 + put_space_bit(
284 +@@ -376,7 +384,11 @@ static irqreturn_t irq_handler(int irqno, void *blah, struct pt_regs *regs)
285 + * WPC8769L_USECS_PER_BIT);
286 +
287 + if (next_zero < size) {
288 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
289 + next_one = generic_find_next_le_bit(ldata,
290 ++#else
291 ++ next_one = find_next_bit_le(ldata,
292 ++#endif
293 + size, next_zero + 1);
294 +
295 + put_pulse_bit(
296 +--
297 +1.7.5.4
298
299 diff --git a/app-misc/lirc/files/lirc-0.9.0-kernel-3.3.0-fixes.patch b/app-misc/lirc/files/lirc-0.9.0-kernel-3.3.0-fixes.patch
300 new file mode 100644
301 index 0000000..9b7d3ef
302 --- /dev/null
303 +++ b/app-misc/lirc/files/lirc-0.9.0-kernel-3.3.0-fixes.patch
304 @@ -0,0 +1,50 @@
305 +diff -ur drivers/lirc_serial/lirc_serial.c drivers.new/lirc_serial/lirc_serial.c
306 +--- drivers/lirc_serial/lirc_serial.c 2011-03-25 18:28:18.000000000 -0400
307 ++++ drivers.new/lirc_serial/lirc_serial.c 2012-10-24 14:32:14.000000000 -0400
308 +@@ -66,7 +66,12 @@
309 + #include <linux/poll.h>
310 + #include <linux/platform_device.h>
311 +
312 ++#include "drivers/kcompat.h"
313 ++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 3, 0)
314 ++#include <asm/switch_to.h>
315 ++#else
316 + #include <asm/system.h>
317 ++#endif
318 + #include <linux/io.h>
319 + #include <linux/irq.h>
320 + #include <linux/fcntl.h>
321 +@@ -80,7 +85,6 @@
322 + #define UART_IE_IXP42X_UUE 0x40 /* IXP42X UART Unit enable */
323 + #define UART_IE_IXP42X_RTOIE 0x10 /* IXP42X Receiver Data Timeout int.enable */
324 +
325 +-#include "drivers/kcompat.h"
326 + #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)
327 + #include <media/lirc.h>
328 + #include <media/lirc_dev.h>
329 +diff -ur drivers/lirc_sir/lirc_sir.c drivers.new/lirc_sir/lirc_sir.c
330 +--- drivers/lirc_sir/lirc_sir.c 2011-03-25 18:28:18.000000000 -0400
331 ++++ drivers.new/lirc_sir/lirc_sir.c 2012-10-24 14:32:46.000000000 -0400
332 +@@ -59,7 +59,14 @@
333 + #include <linux/mm.h>
334 + #include <linux/delay.h>
335 + #include <linux/poll.h>
336 ++
337 ++#include "drivers/kcompat.h"
338 ++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 3, 0)
339 ++#include <asm/switch_to.h>
340 ++#else
341 + #include <asm/system.h>
342 ++#endif
343 ++
344 + #include <linux/io.h>
345 + #include <asm/irq.h>
346 + #include <linux/fcntl.h>
347 +@@ -74,7 +81,6 @@
348 +
349 + #include <linux/timer.h>
350 +
351 +-#include "drivers/kcompat.h"
352 + #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)
353 + #include <media/lirc.h>
354 + #include <media/lirc_dev.h>
355
356 diff --git a/app-misc/lirc/files/lirc-0.9.0-kernel-3.5-err-fix.patch b/app-misc/lirc/files/lirc-0.9.0-kernel-3.5-err-fix.patch
357 new file mode 100644
358 index 0000000..b06d94e
359 --- /dev/null
360 +++ b/app-misc/lirc/files/lirc-0.9.0-kernel-3.5-err-fix.patch
361 @@ -0,0 +1,12 @@
362 +--- a/drivers/kcompat.h 2011-03-25 18:28:18.000000000 -0400
363 ++++ b/drivers/kcompat.h 2012-11-27 13:37:55.000000000 -0500
364 +@@ -136,4 +136,9 @@
365 + )
366 + #endif
367 +
368 ++#ifndef err
369 ++#define err(format, arg...) \
370 ++ printk(KERN_ERR KBUILD_MODNAME ": " format "\n", ##arg)
371 ++#endif
372 ++
373 + #endif /* _KCOMPAT_H */
374
375 diff --git a/app-misc/lirc/files/lirc-0.9.0-usb_irtoy.patch b/app-misc/lirc/files/lirc-0.9.0-usb_irtoy.patch
376 new file mode 100644
377 index 0000000..80991b3
378 --- /dev/null
379 +++ b/app-misc/lirc/files/lirc-0.9.0-usb_irtoy.patch
380 @@ -0,0 +1,772 @@
381 +diff --git c/configure.ac w/configure.ac
382 +index 052908b..2cd46ff 100644
383 +--- c/configure.ac
384 ++++ w/configure.ac
385 +@@ -154,6 +154,7 @@ possible_drivers="(none) \
386 + (uirt2) \
387 + (uirt2_raw) \
388 + (usb_uirt_raw) \
389 ++ (usb_irtoy) \
390 + (usbx) \
391 + (udp)"
392 +
393 +@@ -446,7 +447,7 @@ AC_ARG_WITH(driver,
394 + srm7500libusb, tekram,
395 + tekram_bt829, tira, tira_raw, ttusbir,
396 + tuxbox, tvbox, udp, uirt2, uirt2_raw,
397 +- usb_uirt_raw, usbx, wpc8769l],
398 ++ usb_uirt_raw, usb_irtoy, usbx, wpc8769l],
399 + driver=${withval},
400 + driver="unset"
401 + )
402 +@@ -680,6 +681,9 @@ if test "$driver" = "userspace" -o "$driver" = "all"; then
403 + uirt2_raw|usb_uirt_raw)
404 + hw_module="${hw_module} hw_uirt2_raw.o hw_uirt2_common.o serial.o receive.o transmit.o"
405 + ;;
406 ++ usb_irtoy)
407 ++ hw_module="${hw_module} hw_usbirtoy.o serial.o receive.o transmit.o"
408 ++ ;;
409 + usbx)
410 + hw_module="${hw_module} hw_usbx.o serial.o"
411 + ;;
412 +@@ -1391,6 +1395,11 @@ if test "$driver" = "uirt2_raw"; then
413 + hw_module="hw_uirt2_raw.o hw_uirt2_common.o serial.o receive.o transmit.o"
414 + HW_DEFAULT="hw_uirt2_raw"
415 + fi
416 ++if test "$driver" = "usb_irtoy"; then
417 ++ lirc_driver="none"
418 ++ hw_module="hw_usbirtoy.o serial.o receive.o transmit.o"
419 ++ HW_DEFAULT="hw_usbirtoy"
420 ++fi
421 + if test "$driver" = "usb_uirt_raw"; then
422 + lirc_driver="none"
423 + hw_module="hw_uirt2_raw.o hw_uirt2_common.o serial.o receive.o transmit.o"
424 +diff --git c/daemons/hw-types.c w/daemons/hw-types.c
425 +index 0536ea2..b11cbdf 100644
426 +--- c/daemons/hw-types.c
427 ++++ w/daemons/hw-types.c
428 +@@ -58,6 +58,7 @@ extern struct hardware hw_udp;
429 + extern struct hardware hw_uirt2;
430 + extern struct hardware hw_uirt2_raw;
431 + extern struct hardware hw_usb_uirt_raw;
432 ++extern struct hardware hw_usbirtoy;
433 + extern struct hardware hw_usbx;
434 +
435 + #ifndef HW_DEFAULT
436 +diff --git c/daemons/hw_usbirtoy.c w/daemons/hw_usbirtoy.c
437 +new file mode 100644
438 +index 0000000..ed2df85
439 +--- /dev/null
440 ++++ w/daemons/hw_usbirtoy.c
441 +@@ -0,0 +1,607 @@
442 ++/****************************************************************************
443 ++ ** hw_usbirtoy.c **********************************************************
444 ++ ****************************************************************************
445 ++ *
446 ++ * Routines for USB Infrared Toy receiver/transmitter in sampling mode
447 ++ *
448 ++ * Copyright (C) 2011 Peter Kooiman <pkooiman@×××××.com>
449 ++ *
450 ++ * This program is free software; you can redistribute it and/or modify
451 ++ * it under the terms of the GNU General Public License as published by
452 ++ * the Free Software Foundation; either version 2 of the License, or
453 ++ * (at your option) any later version.
454 ++ *
455 ++ * This program is distributed in the hope that it will be useful,
456 ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
457 ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
458 ++ * GNU Library General Public License for more details.
459 ++ *
460 ++ * You should have received a copy of the GNU General Public License
461 ++ * along with this program; if not, write to the Free Software
462 ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
463 ++ */
464 ++
465 ++#ifdef HAVE_CONFIG_H
466 ++ #include <config.h>
467 ++#endif
468 ++
469 ++
470 ++#include <stdio.h>
471 ++#include <stdlib.h>
472 ++#include <stdarg.h>
473 ++#include <fcntl.h>
474 ++#include <unistd.h>
475 ++#include <limits.h>
476 ++#include <signal.h>
477 ++#include <sys/stat.h>
478 ++#include <sys/types.h>
479 ++#include <sys/ioctl.h>
480 ++#include <errno.h>
481 ++
482 ++
483 ++#include "hardware.h"
484 ++#include "serial.h"
485 ++#include "ir_remote.h"
486 ++#include "lircd.h"
487 ++#include "receive.h"
488 ++#include "transmit.h"
489 ++
490 ++#define IRTOY_MINFWVERSION 20
491 ++
492 ++#define IRTOY_UNIT 21.3333
493 ++#define IRTOY_LONGSPACE 1000000
494 ++
495 ++
496 ++const unsigned char IRTOY_COMMAND_TXSTART[] = {0x24, 0x25, 0x26, 0x03};
497 ++#define IRTOY_COMMAND_RESET 0
498 ++#define IRTOY_COMMAND_SMODE_ENTER 's'
499 ++#define IRTOY_COMMAND_VERSION 'v'
500 ++
501 ++#define IRTOY_REPLY_XMITCOUNT 't'
502 ++#define IRTOY_REPLY_XMITSUCCESS 'C'
503 ++#define IRTOY_REPLY_VERSION 'V'
504 ++#define IRTOY_REPLY_SAMPLEMODEPROTO 'S'
505 ++
506 ++#define IRTOY_LEN_XMITRES 4
507 ++#define IRTOY_LEN_VERSION 4
508 ++#define IRTOY_LEN_SAMPLEMODEPROTO 3
509 ++
510 ++#define IRTOY_TIMEOUT_READYFORDATA 1000000
511 ++#define IRTOY_TIMEOUT_FLUSH 20000
512 ++#define IRTOY_TIMEOUT_SMODE_ENTER 500000
513 ++#define IRTOY_TIMEOUT_VERSION 500000
514 ++
515 ++
516 ++struct tag_irtoy_t {
517 ++ int hwVersion;
518 ++ int swVersion;
519 ++ int protoVersion;
520 ++ int fd;
521 ++ int awaitingNewSig;
522 ++ int pulse;
523 ++};
524 ++
525 ++typedef struct tag_irtoy_t irtoy_t;
526 ++
527 ++static irtoy_t *dev;
528 ++
529 ++unsigned char rawSB[WBUF_SIZE * 2 + 2];
530 ++
531 ++/* exported functions */
532 ++static int irtoy_init(void);
533 ++static int irtoy_deinit(void);
534 ++static int irtoy_send(struct ir_remote *remote, struct ir_ncode *code);
535 ++static char *irtoy_rec(struct ir_remote *remotes);
536 ++static int irtoy_decode(struct ir_remote *remote, ir_code * prep, ir_code * codep, ir_code * postp,
537 ++ int *repeat_flagp, lirc_t * min_remaining_gapp, lirc_t * max_remaining_gapp);
538 ++static lirc_t irtoy_readdata(lirc_t timeout);
539 ++
540 ++
541 ++struct hardware hw_usbirtoy = {
542 ++#ifndef LIRC_IRTTY
543 ++ "/dev/ttyACM0",
544 ++#else
545 ++ LIRC_IRTTY, /* default device */
546 ++#endif
547 ++ -1, /* fd */
548 ++ LIRC_CAN_REC_MODE2 | LIRC_CAN_SEND_PULSE, /* features */
549 ++ LIRC_MODE_PULSE, /* send_mode */
550 ++ LIRC_MODE_MODE2, /* rec_mode */
551 ++ 0, /* code_length */
552 ++ irtoy_init, /* init_func */
553 ++ irtoy_deinit, /* deinit_func */
554 ++ irtoy_send, /* send_func */
555 ++ irtoy_rec, /* rec_func */
556 ++ irtoy_decode, /* decode_func */
557 ++ NULL, /* ioctl_func */
558 ++ irtoy_readdata, /* readdata */
559 ++ "usb_irtoy"
560 ++};
561 ++
562 ++
563 ++static int irtoy_decode(struct ir_remote *remote, ir_code * prep, ir_code * codep, ir_code * postp,
564 ++ int *repeat_flagp, lirc_t * min_remaining_gapp, lirc_t * max_remaining_gapp)
565 ++{
566 ++ int res;
567 ++
568 ++ LOGPRINTF(1, "irtoy_decode: enter");
569 ++
570 ++ res = receive_decode(remote, prep, codep, postp, repeat_flagp, min_remaining_gapp, max_remaining_gapp);
571 ++
572 ++ LOGPRINTF(1, "irtoy_decode: %d", res);
573 ++
574 ++ return res;
575 ++}
576 ++
577 ++
578 ++
579 ++
580 ++static ssize_t read_with_timeout(int fd, void *buf, size_t count, long to_usec)
581 ++{
582 ++ ssize_t rc;
583 ++ size_t numread = 0;
584 ++ struct timeval timeout;
585 ++ fd_set fds;
586 ++
587 ++ timeout.tv_sec = 0;
588 ++ timeout.tv_usec = to_usec;
589 ++
590 ++ rc = read(fd, (char *) buf, count);
591 ++
592 ++ if (rc > 0) {
593 ++ numread += rc;
594 ++ }
595 ++
596 ++ while ((rc == -1 && errno == EAGAIN) || (rc >= 0 && numread < count)) {
597 ++ FD_ZERO(&fds);
598 ++ FD_SET(fd, &fds);
599 ++
600 ++ rc = select(fd + 1, &fds, NULL, NULL, &timeout);
601 ++
602 ++ if (rc == 0) {
603 ++ /* timeout */
604 ++ break;
605 ++ } else if (rc == -1) {
606 ++ /* continue for EAGAIN case */
607 ++ continue;
608 ++ }
609 ++
610 ++ rc = read(fd, ((char *)buf) + numread, count - numread);
611 ++
612 ++ if (rc > 0) {
613 ++ numread += rc;
614 ++ }
615 ++
616 ++ }
617 ++
618 ++ return(numread == 0) ? -1 : numread;
619 ++}
620 ++
621 ++
622 ++static int irtoy_readflush(irtoy_t * dev, long timeout)
623 ++{
624 ++ int res;
625 ++ char c;
626 ++
627 ++ while ((res = read_with_timeout(dev->fd, &c, 1, timeout)) == 1)
628 ++ ;
629 ++
630 ++ if (res != 0)
631 ++ return -1;
632 ++ else
633 ++ return 0;
634 ++}
635 ++
636 ++static lirc_t irtoy_read(irtoy_t * dev, lirc_t timeout)
637 ++{
638 ++
639 ++ lirc_t data;
640 ++ int res;
641 ++ unsigned char dur[2];
642 ++
643 ++ if (!waitfordata(timeout))
644 ++ return 0;
645 ++
646 ++ // lircd expects a space as start of the next transmission, not just at the end of the last one
647 ++ // irrecord however likes to see a space at the end of the signal
648 ++ // We remember if we saw the 0xFFFF timeout from the usbtoy and send a long space both after last signal and at start of next signal
649 ++ // From usb irtoy: <signal...><lastpulse> [usbtoy timeout duration] 0xFFFF [however long it takes before next signal] <firstpulse><signal..>
650 ++ // We return: <signal><lastpulse> [usbtoy timeout duration] LONGSPACE [however long it takes before next signal] LONGSPACE <firstpulse><signal>
651 ++ if (dev->awaitingNewSig) {
652 ++
653 ++ LOGPRINTF(1, "new signal after large space");
654 ++ dev->pulse = 1;
655 ++ dev->awaitingNewSig = 0;
656 ++ return IRTOY_LONGSPACE;
657 ++ }
658 ++
659 ++ res = read_with_timeout(dev->fd, dur, 2, 0);
660 ++
661 ++ if (res != 2) {
662 ++ logprintf(LOG_ERR, "irtoy_read: could not get 2 bytes");
663 ++ return 0;
664 ++ }
665 ++
666 ++
667 ++
668 ++ LOGPRINTF(3, "read_raw %02x%02x", dur[0], dur[1]);
669 ++
670 ++
671 ++ if (dur[0] == 0xff && dur[1] == 0xff) {
672 ++ dev->awaitingNewSig = 1;
673 ++ return IRTOY_LONGSPACE;
674 ++ }
675 ++
676 ++
677 ++ data = (lirc_t) (IRTOY_UNIT * (double) (256 * dur[0] + dur[1]));
678 ++
679 ++ LOGPRINTF(3, "read_raw %d", data);
680 ++
681 ++
682 ++ if (dev->pulse) {
683 ++ data = data | PULSE_BIT;
684 ++ }
685 ++
686 ++ dev->pulse = ! (dev->pulse);
687 ++
688 ++
689 ++ return data;
690 ++}
691 ++
692 ++static lirc_t irtoy_readdata(lirc_t timeout)
693 ++{
694 ++ lirc_t data = irtoy_read(dev, timeout);
695 ++
696 ++ if (data) {
697 ++ LOGPRINTF(1, "irtoy_readdata %d %d", !!(data & PULSE_BIT), data & PULSE_MASK);
698 ++
699 ++ }
700 ++
701 ++ return(data);
702 ++}
703 ++
704 ++static int irtoy_getversion(irtoy_t *dev)
705 ++{
706 ++ int res;
707 ++ unsigned char buf[16];
708 ++ int vNum;
709 ++
710 ++ irtoy_readflush(dev, IRTOY_TIMEOUT_FLUSH);
711 ++
712 ++
713 ++ buf[0] = IRTOY_COMMAND_VERSION;
714 ++ res = write(dev->fd, buf, 1);
715 ++
716 ++ if (res != 1) {
717 ++ logprintf(LOG_ERR, "irtoy_getversion: couldn't write command");
718 ++ return 0;
719 ++ }
720 ++
721 ++
722 ++ res = read_with_timeout(dev->fd, buf, IRTOY_LEN_VERSION, IRTOY_TIMEOUT_VERSION);
723 ++
724 ++ if (res != IRTOY_LEN_VERSION) {
725 ++ logprintf(LOG_ERR, "irtoy_getversion: couldn't read version");
726 ++ logprintf(LOG_ERR, "please make sure you are using firmware v20 or higher");
727 ++ return 0;
728 ++ }
729 ++
730 ++ buf[IRTOY_LEN_VERSION] = 0;
731 ++
732 ++ LOGPRINTF(1, "irtoy_getversion: Got version %s", buf);
733 ++
734 ++ if (buf[0] != IRTOY_REPLY_VERSION) {
735 ++ logprintf(LOG_ERR, "irtoy_getversion: invalid response %02X", buf[0]);
736 ++ logprintf(LOG_ERR, "please make sure you are using firmware v20 or higher");
737 ++ return 0;
738 ++ }
739 ++
740 ++ vNum = atoi(buf + 1);
741 ++ dev->hwVersion = vNum / 100;
742 ++ dev->swVersion = vNum % 100;
743 ++ return 1;
744 ++}
745 ++
746 ++static int irtoy_reset(irtoy_t *dev)
747 ++{
748 ++ int res;
749 ++ unsigned char buf[16];
750 ++
751 ++ buf[0] = IRTOY_COMMAND_RESET;
752 ++ res = write(dev->fd, buf, 1);
753 ++
754 ++ if (res != 1) {
755 ++ logprintf(LOG_ERR, "irtoy_reset: couldn't write command");
756 ++ return 0;
757 ++ }
758 ++
759 ++ irtoy_readflush(dev, IRTOY_TIMEOUT_FLUSH);
760 ++
761 ++ return 1;
762 ++}
763 ++
764 ++static int irtoy_enter_samplemode(irtoy_t *dev)
765 ++{
766 ++
767 ++ int res;
768 ++ unsigned char buf[16];
769 ++
770 ++ buf[0] = IRTOY_COMMAND_SMODE_ENTER;
771 ++ res = write(dev->fd, buf, 1);
772 ++
773 ++ if (res != 1) {
774 ++ logprintf(LOG_ERR, "irtoy_enter_samplemode: couldn't write command");
775 ++ return 0;
776 ++ }
777 ++
778 ++
779 ++ res = read_with_timeout(dev->fd, buf, IRTOY_LEN_SAMPLEMODEPROTO, IRTOY_TIMEOUT_SMODE_ENTER);
780 ++
781 ++ if (res != IRTOY_LEN_SAMPLEMODEPROTO) {
782 ++ logprintf(LOG_ERR, "irtoy_enter_samplemode: couldn't read command result");
783 ++ return 0;
784 ++ }
785 ++
786 ++ buf[IRTOY_LEN_SAMPLEMODEPROTO] = 0;
787 ++
788 ++ if (buf[0] != IRTOY_REPLY_SAMPLEMODEPROTO) {
789 ++ logprintf(LOG_ERR, "irtoy_enter_samplemode: invalid response %02X", buf[0]);
790 ++ return 0;
791 ++ }
792 ++
793 ++
794 ++ LOGPRINTF(1, "irtoy_reset: Got protocol %s", buf);
795 ++
796 ++ dev->protoVersion = atoi(buf + 1);
797 ++ return 1;
798 ++}
799 ++
800 ++
801 ++static irtoy_t *irtoy_hw_init(int fd)
802 ++{
803 ++
804 ++
805 ++ irtoy_t *dev = (irtoy_t *) malloc(sizeof(irtoy_t));
806 ++
807 ++ if (dev == NULL) {
808 ++ logprintf(LOG_ERR, "irtoy_init: out of memory");
809 ++ return NULL;
810 ++ }
811 ++
812 ++ memset(dev, 0, sizeof(irtoy_t));
813 ++
814 ++ dev->awaitingNewSig = 1;
815 ++ dev->fd = fd;
816 ++ dev->pulse = 1;
817 ++
818 ++ irtoy_readflush(dev, IRTOY_TIMEOUT_FLUSH);
819 ++
820 ++ if (!irtoy_reset(dev) || !irtoy_getversion(dev) || !irtoy_enter_samplemode(dev)) {
821 ++ free(dev);
822 ++ dev = NULL;
823 ++ return NULL;
824 ++ }
825 ++
826 ++ return dev;
827 ++}
828 ++
829 ++
830 ++
831 ++
832 ++static int irtoy_init(void)
833 ++{
834 ++
835 ++
836 ++
837 ++ if (!tty_create_lock(hw.device)) {
838 ++ logprintf(LOG_ERR, "usb_irtoy: could not create lock files");
839 ++ return(0);
840 ++ }
841 ++
842 ++ if ((hw.fd = open(hw.device, O_RDWR | O_NONBLOCK | O_NOCTTY)) < 0) {
843 ++ logprintf(LOG_ERR, "usb_irtoy: could not open %s", hw.device);
844 ++ tty_delete_lock();
845 ++ return(0);
846 ++ }
847 ++
848 ++ if (!tty_reset(hw.fd)) {
849 ++ logprintf(LOG_ERR, "usb_irtoy: could not reset tty");
850 ++ close(hw.fd);
851 ++ tty_delete_lock();
852 ++ return(0);
853 ++ }
854 ++
855 ++
856 ++ if (!tty_setbaud(hw.fd, 115200)) {
857 ++ logprintf(LOG_ERR, "usb_irtoy: could not set baud rate");
858 ++ close(hw.fd);
859 ++ tty_delete_lock();
860 ++ return(0);
861 ++ }
862 ++
863 ++ if (!tty_setcsize(hw.fd, 8)) {
864 ++ logprintf(LOG_ERR, "usb_irtoy: could not set csize");
865 ++ close(hw.fd);
866 ++ tty_delete_lock();
867 ++ return(0);
868 ++ }
869 ++
870 ++ if (!tty_setrtscts(hw.fd, 1)) {
871 ++ logprintf(LOG_ERR, "usb_irtoy: could not enable hardware flow");
872 ++ close(hw.fd);
873 ++ tty_delete_lock();
874 ++ return(0);
875 ++ }
876 ++
877 ++ if ((dev = irtoy_hw_init(hw.fd)) == NULL) {
878 ++ logprintf(LOG_ERR, "usb_irtoy: No USB Irtoy device found at %s", hw.device);
879 ++ close(hw.fd);
880 ++ tty_delete_lock();
881 ++ return(0);
882 ++ }
883 ++
884 ++ LOGPRINTF(1, "Version hw %d, sw %d, protocol %d\n", dev->hwVersion, dev->swVersion, dev->protoVersion);
885 ++
886 ++ if (dev->swVersion < IRTOY_MINFWVERSION) {
887 ++ logprintf(LOG_ERR, "usb_irtoy: Need firmware V%02d or higher, this firmware: %02d", IRTOY_MINFWVERSION, dev->swVersion);
888 ++ free(dev);
889 ++ return 0;
890 ++ }
891 ++
892 ++ init_rec_buffer();
893 ++ init_send_buffer();
894 ++
895 ++
896 ++
897 ++ return(1);
898 ++}
899 ++
900 ++static int irtoy_deinit(void)
901 ++{
902 ++
903 ++ // IMPORTANT do not remove this reset. it is vital to return the irtoy to IRMAN mode.
904 ++ // If we leave the irtoy in sample mode while no-one has the tty open, the linux cdc_acm driver will fail on the next open.
905 ++ // This is apparently due to data being sent while the tty is not open and fairly well known (google for "tty_port_close_start: tty->count = 1 port count = 0")
906 ++ // IRMAN mode will wait until a signal is actually read before sending the next one, while sample mode will keep streaming (and under fluorescent light it WILL stream..)
907 ++ // triggering the problem
908 ++ irtoy_reset(dev);
909 ++
910 ++ free(dev);
911 ++ dev = NULL;
912 ++
913 ++
914 ++ close(hw.fd);
915 ++ hw.fd = -1;
916 ++ tty_delete_lock();
917 ++ return 1;
918 ++}
919 ++
920 ++static char *irtoy_rec(struct ir_remote *remotes)
921 ++{
922 ++ LOGPRINTF(1, "irtoy_raw_rec");
923 ++
924 ++
925 ++ if (!clear_rec_buffer())
926 ++ return(NULL);
927 ++
928 ++ return decode_all(remotes);
929 ++
930 ++
931 ++}
932 ++
933 ++static int irtoy_send_double_buffered(unsigned char * signals, int length)
934 ++{
935 ++ int numToXmit = length;
936 ++ int numThisTime;
937 ++ int res;
938 ++ unsigned char irToyBufLen;
939 ++ unsigned char *txPtr;
940 ++ unsigned char reply[16];
941 ++ int irtoyXmit;
942 ++
943 ++
944 ++ res = write(dev->fd, IRTOY_COMMAND_TXSTART, sizeof(IRTOY_COMMAND_TXSTART));
945 ++
946 ++ if (res != sizeof(IRTOY_COMMAND_TXSTART)) {
947 ++ logprintf(LOG_ERR, "irtoy_send: couldn't write command");
948 ++ return 0;
949 ++ }
950 ++
951 ++ res = read_with_timeout(dev->fd, &irToyBufLen, 1, IRTOY_TIMEOUT_READYFORDATA);
952 ++
953 ++ if (res != 1) {
954 ++ logprintf(LOG_ERR, "irtoy_send: couldn't read command result");
955 ++ return -1;
956 ++ }
957 ++
958 ++ LOGPRINTF(1, "irtoy ready for %d bytes\n", irToyBufLen);
959 ++
960 ++ txPtr = signals;
961 ++
962 ++ while (numToXmit) {
963 ++ numThisTime = (numToXmit < irToyBufLen) ? numToXmit : irToyBufLen;
964 ++ res = write(dev->fd, txPtr, numThisTime);
965 ++
966 ++ if (res != numThisTime) {
967 ++ logprintf(LOG_ERR, "irtoy_send: couldn't write command");
968 ++ return 0;
969 ++ }
970 ++
971 ++ txPtr += numThisTime;
972 ++ numToXmit -= numThisTime;
973 ++
974 ++
975 ++ res = read_with_timeout(dev->fd, &irToyBufLen, 1, IRTOY_TIMEOUT_READYFORDATA);
976 ++
977 ++ if (res != 1) {
978 ++ logprintf(LOG_ERR, "irtoy_send: couldn't read command result");
979 ++ return -1;
980 ++ }
981 ++
982 ++ LOGPRINTF(1, "irtoy ready for %d bytes\n", irToyBufLen);
983 ++
984 ++
985 ++ }
986 ++
987 ++
988 ++ res = read_with_timeout(dev->fd, reply, IRTOY_LEN_XMITRES, IRTOY_TIMEOUT_READYFORDATA);
989 ++
990 ++ if (res != IRTOY_LEN_XMITRES) {
991 ++ logprintf(LOG_ERR, "irtoy_send: couldn't read command result");
992 ++ return -1;
993 ++ }
994 ++
995 ++ LOGPRINTF(1, "%c %02X %02X %c\n", reply[0], reply[1], reply[2], reply[3]);
996 ++
997 ++ if (reply[0] != IRTOY_REPLY_XMITCOUNT) {
998 ++ logprintf(LOG_ERR, "irtoy_send: invalid byte count indicator received: %02X", reply[0]);
999 ++ return 0;
1000 ++ }
1001 ++
1002 ++ irtoyXmit = (reply[1] << 8) | reply[2];
1003 ++ if (length != irtoyXmit) {
1004 ++ logprintf(LOG_ERR, "irtoy_send: incorrect byte count received: %d expected: %d", irtoyXmit, length);
1005 ++ return 0;
1006 ++ }
1007 ++
1008 ++ if (reply[3] != IRTOY_REPLY_XMITSUCCESS) {
1009 ++ logprintf(LOG_ERR, "irtoy_send: received error status %02X", reply[3]);
1010 ++ return 0;
1011 ++ }
1012 ++
1013 ++ return 1;
1014 ++
1015 ++}
1016 ++
1017 ++static int irtoy_send(struct ir_remote *remote, struct ir_ncode *code)
1018 ++{
1019 ++ int length;
1020 ++ lirc_t *signals;
1021 ++ int res = 0;
1022 ++
1023 ++ int numToXmit;
1024 ++ int i;
1025 ++ lirc_t val;
1026 ++
1027 ++
1028 ++ if (!init_send(remote, code)) {
1029 ++ return 0;
1030 ++ }
1031 ++
1032 ++ length = send_buffer.wptr;
1033 ++ signals = send_buffer.data;
1034 ++
1035 ++ for (i = 0; i < length; i++) {
1036 ++ val = (lirc_t)(((double) signals[i]) / IRTOY_UNIT);
1037 ++ rawSB[2*i] = val >> 8;
1038 ++ rawSB[2*i + 1] = val & 0xFF;
1039 ++ }
1040 ++
1041 ++ rawSB[2 * length] = 0xFF;
1042 ++ rawSB[2 * length + 1] = 0xFF;
1043 ++
1044 ++ numToXmit = 2 * length + 2;
1045 ++ return irtoy_send_double_buffered(rawSB, numToXmit);
1046 ++}
1047 ++
1048 ++
1049 +diff --git c/setup.data w/setup.data
1050 +index 407d6b2..99be615 100644
1051 +--- c/setup.data
1052 ++++ w/setup.data
1053 +@@ -119,6 +119,7 @@ hw_menu_entry: @hw-usb
1054 + awlibusb: "Awox RF/IR Remote (userspace)"
1055 + sb0540: "Creative USB IR Receiver (SB0540)"
1056 + commandir: "CommandIR Multi-IR Transceiver (userspace)"
1057 ++ usb_irtoy: "Dangerous Prototypes USB Infrared Toy"
1058 + dfclibusb: "DFC USB InfraRed Remote Control (userspace)"
1059 + sasem: "Dign HV5 HTPC IR/VFD Module"
1060 + dvico: "DViCO USB Remote"
1061 +@@ -147,6 +148,7 @@ hw_menu_entry: @hw-usb
1062 + mplay: "VLSystem MPlay Blast"
1063 + mplay: "VLSystem MPlay Mini"
1064 +
1065 ++
1066 + param_type: \
1067 + act200l \
1068 + act220l \
1069 +@@ -190,6 +192,9 @@ param_type: \
1070 + usbx
1071 + ttyUSB:
1072 +
1073 ++param_type: usb_irtoy
1074 ++ ttyACM:
1075 ++
1076 + param_type: \
1077 + adaptec \
1078 + alsa_usb \
1079 +@@ -390,6 +395,10 @@ default_param: \
1080 + usbx
1081 + ttyUSB1:
1082 +
1083 ++default_param: usb_irtoy
1084 ++ ttyACM1:
1085 ++
1086 ++
1087 + remote: \
1088 + hauppauge \
1089 + hauppauge_dvb \
1090 +@@ -424,6 +433,7 @@ remote: \
1091 + ttusbir \
1092 + uirt2_raw \
1093 + udp \
1094 ++ usb_irtoy \
1095 + usb_uirt_raw \
1096 + wpc8769l
1097 + any:
1098 +diff --git c/setup.sh w/setup.sh
1099 +index 342f32d..a3546b5 100755
1100 +--- c/setup.sh
1101 ++++ w/setup.sh
1102 +@@ -65,6 +65,10 @@ GetSelectedDriver ()
1103 + elif test "$DRIVER_PARAMETER" = "ttyUSB2"; then COM2="on"; IRTTY="/dev/ttyUSB1"; LIRC_PORT="none"; LIRC_IRQ="none"
1104 + elif test "$DRIVER_PARAMETER" = "ttyUSB3"; then COM3="on"; IRTTY="/dev/ttyUSB2"; LIRC_PORT="none"; LIRC_IRQ="none"
1105 + elif test "$DRIVER_PARAMETER" = "ttyUSB4"; then COM4="on"; IRTTY="/dev/ttyUSB3"; LIRC_PORT="none"; LIRC_IRQ="none"
1106 ++ elif test "$DRIVER_PARAMETER" = "ttyACM1"; then COM1="on"; IRTTY="/dev/ttyACM0"; LIRC_PORT="none"; LIRC_IRQ="none"
1107 ++ elif test "$DRIVER_PARAMETER" = "ttyACM2"; then COM2="on"; IRTTY="/dev/ttyACM1"; LIRC_PORT="none"; LIRC_IRQ="none"
1108 ++ elif test "$DRIVER_PARAMETER" = "ttyACM3"; then COM3="on"; IRTTY="/dev/ttyACM2"; LIRC_PORT="none"; LIRC_IRQ="none"
1109 ++ elif test "$DRIVER_PARAMETER" = "ttyACM4"; then COM4="on"; IRTTY="/dev/ttyACM3"; LIRC_PORT="none"; LIRC_IRQ="none"
1110 + elif test "$DRIVER_PARAMETER" = "com1"; then COM1="on"; LIRC_PORT=$COM1_PORT; LIRC_IRQ=$COM1_IRQ
1111 + elif test "$DRIVER_PARAMETER" = "com2"; then COM2="on"; LIRC_PORT=$COM2_PORT; LIRC_IRQ=$COM2_IRQ
1112 + elif test "$DRIVER_PARAMETER" = "com3"; then COM3="on"; LIRC_PORT=$COM3_PORT; LIRC_IRQ=$COM3_IRQ
1113 +@@ -207,6 +211,30 @@ SetPortAndIrq ()
1114 + else
1115 + return 1;
1116 + fi
1117 ++ elif test "$DRIVER_PARAM_TYPE" = "ttyACM"; then
1118 ++ {
1119 ++ dialog --clear --backtitle "$BACKTITLE" \
1120 ++ --title "Select tty to use" \
1121 ++ --radiolist "$SET_TTY_TEXT" 13 74 6 \
1122 ++ 1 "/dev/ttyACM0" $COM1 \
1123 ++ 2 "/dev/ttyACM1" $COM2 \
1124 ++ 3 "/dev/ttyACM2" $COM3 \
1125 ++ 4 "/dev/ttyACM3" $COM4 \
1126 ++ 2> $TEMP
1127 ++ }
1128 ++ if test "$?" = "0"; then
1129 ++ {
1130 ++ set `cat $TEMP`
1131 ++ if test "$1" = "1"; then DRIVER_PARAMETER="ttyACM1"
1132 ++ elif test "$1" = "2"; then DRIVER_PARAMETER="ttyACM2"
1133 ++ elif test "$1" = "3"; then DRIVER_PARAMETER="ttyACM3"
1134 ++ elif test "$1" = "4"; then DRIVER_PARAMETER="ttyACM4"
1135 ++ fi
1136 ++ GetSelectedDriver
1137 ++ }
1138 ++ else
1139 ++ return 1;
1140 ++ fi
1141 + fi
1142 + return 0;
1143 + }
1144 +@@ -347,7 +375,7 @@ SaveConfig ()
1145 + else echo "--without-timer \\" >>$START;
1146 + fi
1147 + }
1148 +- elif test "$DRIVER_PARAM_TYPE" = "tty" -o "$DRIVER_PARAM_TYPE" = "ttyUSB" -o "$LIRC_DRIVER" = "bte"; then
1149 ++ elif test "$DRIVER_PARAM_TYPE" = "tty" -o "$DRIVER_PARAM_TYPE" = "ttyUSB" -o "$DRIVER_PARAM_TYPE" = "ttyACM" -o "$LIRC_DRIVER" = "bte"; then
1150 + {
1151 + echo "--with-tty=$IRTTY \\" >>$START
1152 + }
1153
1154 diff --git a/app-misc/lirc/files/lircd-0.8.3 b/app-misc/lirc/files/lircd-0.8.3
1155 new file mode 100644
1156 index 0000000..8cd7a0a
1157 --- /dev/null
1158 +++ b/app-misc/lirc/files/lircd-0.8.3
1159 @@ -0,0 +1,23 @@
1160 +#!/sbin/runscript
1161 +# Copyright 1999-2004 Gentoo Foundation
1162 +# Distributed under the terms of the GNU General Public License v2
1163 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/files/lircd-0.8.3,v 1.1 2008/05/05 09:53:19 zzam Exp $
1164 +
1165 +PIDFILE=/var/run/${SVCNAME}.pid
1166 +
1167 +depend() {
1168 + provide lirc
1169 +}
1170 +
1171 +start() {
1172 + ebegin "Starting lircd"
1173 + start-stop-daemon --start --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd -- \
1174 + -P "${PIDFILE}" ${LIRCD_OPTS}
1175 + eend $?
1176 +}
1177 +
1178 +stop() {
1179 + ebegin "Stopping lircd"
1180 + start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd
1181 + eend $?
1182 +}
1183
1184 diff --git a/app-misc/lirc/files/lircd-0.8.6 b/app-misc/lirc/files/lircd-0.8.6
1185 new file mode 100644
1186 index 0000000..dbf7a47
1187 --- /dev/null
1188 +++ b/app-misc/lirc/files/lircd-0.8.6
1189 @@ -0,0 +1,41 @@
1190 +#!/sbin/runscript
1191 +# Copyright 1999-2004 Gentoo Foundation
1192 +# Distributed under the terms of the GNU General Public License v2
1193 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/files/lircd-0.8.6,v 1.2 2010/05/21 02:32:36 beandog Exp $
1194 +
1195 +PIDFILE=/var/run/lirc/${SVCNAME}.pid
1196 +LIRCD_SYMLINKFILE=/dev/lircd
1197 +LIRCD_SOCKET=/var/run/lirc/lircd
1198 +
1199 +depend() {
1200 + need localmount
1201 + use modules
1202 + provide lirc
1203 +}
1204 +
1205 +start() {
1206 + local retval
1207 + ebegin "Starting lircd"
1208 + rm -f ${LIRCD_SOCKET} && ln -s ${LIRCD_SOCKET} ${LIRCD_SYMLINKFILE}
1209 + if [ $? -ne 0 ]; then
1210 + eend $? "Unable to create symbolic link ${LIRCD_SYMLINKFILE}"
1211 + return 1
1212 + fi
1213 +
1214 + start-stop-daemon --start --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd -- \
1215 + -P "${PIDFILE}" ${LIRCD_OPTS}
1216 + retval=$?
1217 +
1218 + if [ ${retval} -ne 0 ]; then
1219 + rm -f ${LIRCD_SOCKET}
1220 + fi
1221 +
1222 + eend ${retval}
1223 +}
1224 +
1225 +stop() {
1226 + ebegin "Stopping lircd"
1227 + rm -f ${LIRCD_SYMLINKFILE}
1228 + start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd
1229 + eend $?
1230 +}
1231
1232 diff --git a/app-misc/lirc/files/lircd-0.8.6-r2 b/app-misc/lirc/files/lircd-0.8.6-r2
1233 new file mode 100644
1234 index 0000000..e651f19
1235 --- /dev/null
1236 +++ b/app-misc/lirc/files/lircd-0.8.6-r2
1237 @@ -0,0 +1,52 @@
1238 +#!/sbin/runscript
1239 +# Copyright 1999-2012 Gentoo Foundation
1240 +# Distributed under the terms of the GNU General Public License v2
1241 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/files/lircd-0.8.6-r2,v 1.1 2012/07/19 19:52:17 axs Exp $
1242 +
1243 +PIDFILE=/var/run/lirc/${SVCNAME}.pid
1244 +: ${LIRCD_SYMLINKFILE:=/dev/lircd}
1245 +: ${LIRCD_SOCKET:=/var/run/lirc/lircd}
1246 +
1247 +depend() {
1248 + need localmount
1249 + use modules
1250 + provide lirc
1251 +}
1252 +
1253 +start() {
1254 + local retval
1255 +
1256 + ebegin "Starting lircd"
1257 +
1258 + for retval in ${LIRCD_SET_SYSCLASSRCS} ; do
1259 + if [ -e /sys/class/rc/${retval}/protocols ] && \
1260 + grep 'lirc' /sys/class/rc/${retval}/protocols &>/dev/null ; then
1261 + einfo "Setting lirc protocol active for ${retval}"
1262 + echo lirc >/sys/class/rc/${retval}/protocols
1263 + fi
1264 + done
1265 +
1266 + checkpath -q -d -m 0755 -o root:root /var/run/lirc
1267 + rm -Rf ${LIRCD_SOCKET} && ln -s ${LIRCD_SOCKET} ${LIRCD_SYMLINKFILE}
1268 + if [ $? -ne 0 ]; then
1269 + eend $? "Unable to create symbolic link ${LIRCD_SYMLINKFILE}"
1270 + return 1
1271 + fi
1272 +
1273 + start-stop-daemon --start --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd -- \
1274 + -P "${PIDFILE}" ${LIRCD_OPTS}
1275 + retval=$?
1276 +
1277 + if [ ${retval} -ne 0 ]; then
1278 + rm -Rf ${LIRCD_SOCKET}
1279 + fi
1280 +
1281 + eend ${retval}
1282 +}
1283 +
1284 +stop() {
1285 + ebegin "Stopping lircd"
1286 + rm -f ${LIRCD_SYMLINKFILE}
1287 + start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd
1288 + eend $?
1289 +}
1290
1291 diff --git a/app-misc/lirc/files/lircd.conf.2 b/app-misc/lirc/files/lircd.conf.2
1292 new file mode 100644
1293 index 0000000..cfda2b8
1294 --- /dev/null
1295 +++ b/app-misc/lirc/files/lircd.conf.2
1296 @@ -0,0 +1,10 @@
1297 +# Options to pass to the lircd process
1298 +
1299 +# for devices with lirc-kernel-module
1300 +#LIRCD_OPTS="-d /dev/lirc0"
1301 +#LIRCD_OPTS="-d /dev/lirc"
1302 +
1303 +# for devices using the input-layer
1304 +#LIRCD_OPTS="-H devinput -d /dev/input/by-path/pci-0000:00:0a.0--event-ir"
1305 +# This should work, Bug #235107
1306 +#LIRCD_OPTS="-H devinput -d name=*DVB*"
1307
1308 diff --git a/app-misc/lirc/files/lircd.conf.4 b/app-misc/lirc/files/lircd.conf.4
1309 new file mode 100644
1310 index 0000000..f59c5f2
1311 --- /dev/null
1312 +++ b/app-misc/lirc/files/lircd.conf.4
1313 @@ -0,0 +1,22 @@
1314 +# Options to pass to the lircd process
1315 +
1316 +# for devices with lirc-kernel-module
1317 +#LIRCD_OPTS="-d /dev/lirc0"
1318 +#LIRCD_OPTS="-d /dev/lirc"
1319 +
1320 +# for devices using the input-layer
1321 +#LIRCD_OPTS="-H devinput -d /dev/input/by-path/pci-0000:00:0a.0--event-ir"
1322 +# This should work, Bug #235107
1323 +#LIRCD_OPTS="-H devinput -d name=*DVB*"
1324 +
1325 +# set default protocol to 'lirc' for in-kernel IR decoding
1326 +# for the following entries in /sys/class/rc/
1327 +# (space-separated list if there is more than one)
1328 +LIRCD_SET_SYSCLASSRCS="rc0"
1329 +
1330 +# If running mulitple instances of lircd, the following
1331 +# can be used to override the default socket path and
1332 +# socket symlink
1333 +#LIRCD_SOCKET="/var/run/lirc/lircd"
1334 +#LIRCD_SYMLINKFILE="/dev/lircd"
1335 +
1336
1337 diff --git a/app-misc/lirc/files/lircmd b/app-misc/lirc/files/lircmd
1338 new file mode 100644
1339 index 0000000..d383778
1340 --- /dev/null
1341 +++ b/app-misc/lirc/files/lircmd
1342 @@ -0,0 +1,20 @@
1343 +#!/sbin/runscript
1344 +# Copyright 1999-2004 Gentoo Foundation
1345 +# Distributed under the terms of the GNU General Public License v2
1346 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/files/lircmd,v 1.2 2004/09/28 00:22:15 swegener Exp $
1347 +
1348 +depend() {
1349 + need lircd
1350 +}
1351 +
1352 +start() {
1353 + ebegin "Starting lircmd"
1354 + start-stop-daemon --start --quiet --exec /usr/sbin/lircmd
1355 + eend $?
1356 +}
1357 +
1358 +stop() {
1359 + ebegin "Stopping lircmd"
1360 + start-stop-daemon --stop --quiet --exec /usr/sbin/lircmd
1361 + eend $?
1362 +}
1363
1364 diff --git a/app-misc/lirc/files/modprobed.lirc b/app-misc/lirc/files/modprobed.lirc
1365 new file mode 100644
1366 index 0000000..2ed9558
1367 --- /dev/null
1368 +++ b/app-misc/lirc/files/modprobed.lirc
1369 @@ -0,0 +1,22 @@
1370 +#
1371 +# For first serial receivers:
1372 +#
1373 +#options lirc_serial irq=4 io=0x3f8
1374 +#options lirc_sir irq=4 io=0x3f8
1375 +
1376 +#
1377 +# Detach first serial port from serial-driver.
1378 +# Use this when you have your serial-port-driver statically
1379 +# compiled into your kernel, or as a module but loaded before
1380 +# the lirc-module.
1381 +#
1382 +#install lirc_serial setserial /dev/ttyS0 uart none; modprobe --ignore-install lirc_serial
1383 +#
1384 +#install lirc_sir setserial /dev/ttyS0 uart none; modprobe --ignore-install lirc_sir
1385 +
1386 +
1387 +#
1388 +# For parallel receivers:
1389 +#
1390 +#options lirc_parallel irq=7 io=0x3bc
1391 +
1392
1393 diff --git a/app-misc/lirc/files/modulesd.lirc b/app-misc/lirc/files/modulesd.lirc
1394 new file mode 100644
1395 index 0000000..d1838c5
1396 --- /dev/null
1397 +++ b/app-misc/lirc/files/modulesd.lirc
1398 @@ -0,0 +1,22 @@
1399 +#
1400 +# For first serial receivers:
1401 +#
1402 +#options lirc_serial irq=4 io=0x3f8
1403 +#options lirc_sir irq=4 io=0x3f8
1404 +
1405 +#
1406 +# Detach first serial port from serial-driver.
1407 +# Use this when you have your serial-port-driver statically
1408 +# compiled into your kernel, or as a module but loaded before
1409 +# the lirc-module.
1410 +#
1411 +#pre-install lirc_serial setserial /dev/ttyS0 uart none
1412 +#
1413 +#pre-install lirc_sir setserial /dev/ttyS0 uart none
1414 +
1415 +
1416 +#
1417 +# For parallel receivers:
1418 +#
1419 +#options lirc_parallel irq=7 io=0x3bc
1420 +
1421
1422 diff --git a/app-misc/lirc/lirc-0.9.0-r3.ebuild b/app-misc/lirc/lirc-0.9.0-r3.ebuild
1423 new file mode 100644
1424 index 0000000..8fb3ab2
1425 --- /dev/null
1426 +++ b/app-misc/lirc/lirc-0.9.0-r3.ebuild
1427 @@ -0,0 +1,428 @@
1428 +# Copyright 1999-2013 Gentoo Foundation
1429 +# Distributed under the terms of the GNU General Public License v2
1430 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/lirc-0.9.0-r2.ebuild,v 1.9 2013/04/02 20:55:44 ago Exp $
1431 +
1432 +EAPI=4
1433 +
1434 +inherit eutils linux-mod linux-info toolchain-funcs flag-o-matic autotools
1435 +
1436 +DESCRIPTION="decode and send infra-red signals of many commonly used remote controls"
1437 +HOMEPAGE="http://www.lirc.org/"
1438 +
1439 +MY_P=${PN}-${PV/_/}
1440 +
1441 +if [[ "${PV/_pre/}" = "${PV}" ]]; then
1442 + SRC_URI="mirror://sourceforge/lirc/${MY_P}.tar.bz2"
1443 +else
1444 + SRC_URI="http://www.lirc.org/software/snapshots/${MY_P}.tar.bz2"
1445 +fi
1446 +
1447 +LICENSE="GPL-2"
1448 +SLOT="0"
1449 +KEYWORDS="amd64 ppc ppc64 x86"
1450 +IUSE="debug doc hardware-carrier transmitter static-libs X"
1451 +
1452 +S="${WORKDIR}/${MY_P}"
1453 +
1454 +RDEPEND="
1455 + X? (
1456 + x11-libs/libX11
1457 + x11-libs/libSM
1458 + x11-libs/libICE
1459 + )
1460 + lirc_devices_alsa_usb? ( media-libs/alsa-lib )
1461 + lirc_devices_audio? ( >media-libs/portaudio-18 )
1462 + lirc_devices_irman? ( media-libs/libirman )"
1463 +
1464 +# 2012-07-17, Ian Stakenvicius
1465 +# A helper script that scrapes out values for nearly all of the variables below
1466 +# from lirc's configure.ac is available at
1467 +# http://dev.gentoo.org/~axs/helper-for-lirc-iuse.sh
1468 +
1469 +# This are drivers with names matching the
1470 +# parameter --with-driver=NAME
1471 +IUSE_LIRC_DEVICES_DIRECT="
1472 + all userspace accent act200l act220l
1473 + adaptec alsa_usb animax asusdh atilibusb
1474 + atiusb audio audio_alsa avermedia avermedia_vdomate
1475 + avermedia98 awlibusb bestbuy bestbuy2 breakoutbox
1476 + bte bw6130 caraca chronos commandir
1477 + cph06x creative creative_infracd
1478 + devinput digimatrix dsp dvico ea65 ene0100
1479 + exaudio flyvideo ftdi gvbctv5pci hauppauge
1480 + hauppauge_dvb hercules_smarttv_stereo i2cuser
1481 + igorplugusb iguanaIR imon imon_24g imon_knob
1482 + imon_lcd imon_pad imon_rsc irdeo irdeo_remote
1483 + irlink irman irreal it87 ite8709
1484 + knc_one kworld leadtek_0007 leadtek_0010
1485 + leadtek_pvr2000 livedrive_midi
1486 + livedrive_seq logitech macmini
1487 + mediafocusI mouseremote
1488 + mouseremote_ps2 mp3anywhere mplay nslu2
1489 + packard_bell parallel pcmak pcmak_usb
1490 + pctv pixelview_bt878 pixelview_pak
1491 + pixelview_pro provideo realmagic
1492 + remotemaster sa1100 samsung sasem sb0540 serial
1493 + silitek sir slinke streamzap tekram
1494 + tekram_bt829 tira ttusbir tuxbox tvbox udp uirt2
1495 + uirt2_raw usb_irtoy usb_uirt_raw usbx wpc8769l"
1496 +
1497 +# drivers that need special handling and
1498 +# must have another name specified for
1499 +# parameter --with-driver=NAME
1500 +IUSE_LIRC_DEVICES_SPECIAL="
1501 + serial_igor_cesko
1502 + remote_wonder_plus xboxusb usbirboy inputlirc"
1503 +
1504 +IUSE_LIRC_DEVICES="${IUSE_LIRC_DEVICES_DIRECT} ${IUSE_LIRC_DEVICES_SPECIAL}"
1505 +
1506 +# The following are lists which are used to provide ewarns on incompatibilities
1507 +# with the kernel:
1508 +
1509 +#drivers that do not build kernel modules
1510 +NO_KMOD_BUILT_FOR_DEV="
1511 + accent bte creative creative_infracd devinput dsp ea65 exaudio
1512 + ftdi i2cuser irlink irreal livedrive_midi livedrive_seq logitech
1513 + mediafocusI mouseremote mouseremote_ps2 mp3anywhere mplay mplay2
1514 + pcmak pcmak_usb pctv realmagic remotemaster silitek tira tira_raw
1515 + tuxbox udp uirt2 uirt2_raw usb_irtoy usb_uirt_raw usbx"
1516 +
1517 +#drivers that build lirc_dev and so will conflict with kernel lirc_dev
1518 +LIRCDEV_BUILT_FOR_DEV="all
1519 + act200l act220l adaptec animax atiusb breakoutbox hauppauge
1520 + hauppauge_dvb hercules_smarttv_stereo igorplugusb imon imon_24g
1521 + imon_knob imon_lcd imon_pad imon_rsc irdeo irdeo_remote knc_one
1522 + leadtek_pvr2000 nslu2 packard_bell parallel pixelview_bt878
1523 + provideo sa1100 sasem serial sir tekram tekram_bt829 ttusbir
1524 + tvbox wpc8769l"
1525 +
1526 +#lirc_gpio drivers, which cannot be supported on kernel >= 2.6.22
1527 +LIRC_GPIO_DEV="
1528 + avermedia avermedia98 avermedia_vdomate bestbuy bestbuy2 chronos
1529 + cph03x cph06x flyvideo gvbctv5pci kworld leadtek_0007 leadtek_0010
1530 + pixelview_pak pixelview_pro"
1531 +
1532 +#device-driver which use libusb
1533 +LIBUSB_USED_BY_DEV="
1534 + all atilibusb awlibusb sasem igorplugusb imon imon_lcd imon_pad
1535 + imon_rsc streamzap xboxusb irlink commandir"
1536 +
1537 +for dev in ${LIBUSB_USED_BY_DEV}; do
1538 + DEPEND="${DEPEND} lirc_devices_${dev}? ( virtual/libusb:0 )"
1539 +done
1540 +
1541 +# adding only compile-time depends
1542 +DEPEND="${RDEPEND} ${DEPEND}
1543 + virtual/linux-sources
1544 + lirc_devices_ftdi? ( dev-embedded/libftdi )
1545 + lirc_devices_all? ( dev-embedded/libftdi )"
1546 +
1547 +# adding only run-time depends
1548 +RDEPEND="${RDEPEND}
1549 + lirc_devices_usbirboy? ( app-misc/usbirboy )
1550 + lirc_devices_inputlirc? ( app-misc/inputlircd )
1551 + lirc_devices_iguanaIR? ( app-misc/iguanaIR )"
1552 +
1553 +# add all devices to IUSE
1554 +# and ensure lirc_devices_all is not set alongside lirc_devices_*
1555 +REQUIRED_USE="lirc_devices_all? ("
1556 +for dev in ${IUSE_LIRC_DEVICES}; do
1557 + IUSE="${IUSE} lirc_devices_${dev}"
1558 + if [[ "${dev}" != "all" ]]; then
1559 + REQUIRED_USE="${REQUIRED_USE} !lirc_devices_${dev}"
1560 + fi
1561 +done
1562 +REQUIRED_USE="${REQUIRED_USE} )"
1563 +
1564 +add_device() {
1565 + local dev="${1}"
1566 + local desc="device ${dev}"
1567 + if [[ -n "${2}" ]]; then
1568 + desc="${2}"
1569 + fi
1570 +
1571 + # Bug #187418
1572 + if kernel_is ge 2 6 22 && [[ " ${LIRC_GPIO_DEV} " == *" ${dev} "* ]]; then
1573 + eerror "${desc} uses lirc_gpio which fails with kernel 2.6.22 or above. Not building."
1574 + eerror "Use 'devinput' instead, or use 'userspace' along with in-kernel drivers"
1575 + return 0
1576 + fi
1577 + : ${lirc_device_count:=0}
1578 + ((lirc_device_count++))
1579 +
1580 + elog "Compiling support for ${desc}"
1581 +
1582 + if [[ " ${LIRCDEV_BUILT_FOR_DEV} " == *" ${dev} "* ]] ; then
1583 + if linux_chkconfig_present LIRC ; then
1584 + ewarn "${desc} builds lirc_dev and CONFIG_LIRC is set in the kernel -- this may conflict."
1585 + fi
1586 + if ! linux_chkconfig_present MODULE_UNLOAD ; then
1587 + ewarn "${desc} builds modules and CONFIG_MODULE_UNLOAD is unset in kernel."
1588 + ewarn "You will need MODULE_UNLOAD support in your kernel."
1589 + fi
1590 + fi
1591 + if [[ " ${NO_KMOD_BUILT_FOR_DEV} " == *" ${dev} "* ]] && ! linux_chkconfig_present IR_LIRC_CODEC ; then
1592 + ewarn "${desc} builds no kernel module and CONFIG_IR_LIRC_CODEC is unset in kernel."
1593 + fi
1594 +
1595 + if [[ ${lirc_device_count} -eq 2 ]] ; then
1596 + ewarn
1597 + ewarn "LIRC_DEVICES has more than one entry."
1598 + ewarn "When selecting multiple devices for lirc to be supported,"
1599 + ewarn "it can not be guaranteed that the drivers play nice together."
1600 + ewarn "If this is not intended, then please adjust LIRC_DEVICES"
1601 + ewarn "and re-emerge."
1602 + ewarn
1603 + fi
1604 +
1605 + MY_OPTS="${MY_OPTS} --with-driver=${dev}"
1606 +}
1607 +
1608 +pkg_pretend() {
1609 + if [[ -n "${LIRC_OPTS}" ]] ; then
1610 + ewarn
1611 + ewarn "LIRC_OPTS is deprecated from lirc-0.8.0-r1 on."
1612 + ewarn
1613 + ewarn "Please use LIRC_DEVICES from now on."
1614 + ewarn "e.g. LIRC_DEVICES=\"serial sir\""
1615 + ewarn
1616 + ewarn "Flags are now set per use-flags."
1617 + ewarn "e.g. transmitter, hardware-carrier"
1618 +
1619 + local opt
1620 + local unsupported_opts=""
1621 +
1622 + # test for allowed options for LIRC_OPTS
1623 + for opt in ${LIRC_OPTS}; do
1624 + case ${opt} in
1625 + --with-port=*|--with-irq=*|--with-timer=*|--with-tty=*)
1626 + MY_OPTS="${MY_OPTS} ${opt}"
1627 + ;;
1628 + *)
1629 + unsupported_opts="${unsupported_opts} ${opt}"
1630 + ;;
1631 + esac
1632 + done
1633 + if [[ -n ${unsupported_opts} ]]; then
1634 + eerror "These options are no longer allowed to be set"
1635 + eerror "with LIRC_OPTS: ${unsupported_opts}"
1636 + die "LIRC_OPTS is no longer supported, use LIRC_DEVICES."
1637 + fi
1638 + fi
1639 +}
1640 +
1641 +pkg_setup() {
1642 + linux-mod_pkg_setup
1643 +
1644 + # set default configure options
1645 + MY_OPTS=""
1646 + LIRC_DRIVER_DEVICE="/dev/lirc0"
1647 +
1648 + if use lirc_devices_all; then
1649 + # compile in drivers for a lot of devices
1650 + add_device all "a lot of devices"
1651 + else
1652 + # compile in only requested drivers
1653 + local dev
1654 + for dev in ${IUSE_LIRC_DEVICES_DIRECT}; do
1655 + if use lirc_devices_${dev}; then
1656 + add_device ${dev}
1657 + fi
1658 + done
1659 +
1660 + if use lirc_devices_remote_wonder_plus; then
1661 + add_device atiusb "device Remote Wonder Plus (atiusb-based)"
1662 + fi
1663 +
1664 + if use lirc_devices_serial_igor_cesko; then
1665 + add_device serial "serial with Igor Cesko design"
1666 + MY_OPTS="${MY_OPTS} --with-igor"
1667 + fi
1668 +
1669 + if use lirc_devices_imon_pad; then
1670 + ewarn "The imon_pad driver has incorporated the previous pad2keys patch"
1671 + ewarn "and removed the pad2keys_active option for the lirc_imon module"
1672 + ewarn "because it is always active."
1673 + ewarn "If you have an older imon VFD device, you may need to add the module"
1674 + ewarn "option display_type=1 to override autodetection and force VFD mode."
1675 + fi
1676 +
1677 + if use lirc_devices_xboxusb; then
1678 + add_device atiusb "device xboxusb"
1679 + fi
1680 +
1681 + if use lirc_devices_usbirboy; then
1682 + add_device userspace "device usbirboy"
1683 + LIRC_DRIVER_DEVICE="/dev/usbirboy"
1684 + fi
1685 +
1686 + if [[ "${MY_OPTS}" == "" ]]; then
1687 + if [[ "${PROFILE_ARCH}" == "xbox" ]]; then
1688 + # on xbox: use special driver
1689 + add_device atiusb "device xboxusb"
1690 + else
1691 + # no driver requested
1692 + elog
1693 + elog "Compiling only the lirc-applications, but no drivers."
1694 + elog "Enable drivers with LIRC_DEVICES if you need them."
1695 + MY_OPTS="--with-driver=none"
1696 + fi
1697 + fi
1698 + fi
1699 +
1700 + use hardware-carrier && MY_OPTS="${MY_OPTS} --without-soft-carrier"
1701 + use transmitter && MY_OPTS="${MY_OPTS} --with-transmitter"
1702 +
1703 + einfo
1704 + einfo "lirc-configure-opts: ${MY_OPTS}"
1705 + elog "Setting default lirc-device to ${LIRC_DRIVER_DEVICE}"
1706 +
1707 + filter-flags -Wl,-O1
1708 +
1709 + # force non-parallel make, Bug 196134 (confirmed valid for 0.9.0-r2)
1710 + MAKEOPTS="${MAKEOPTS} -j1"
1711 +}
1712 +
1713 +src_prepare() {
1714 + # Rip out dos CRLF
1715 + edos2unix contrib/lirc.rules
1716 +
1717 + # Apply patches needed for some special device-types
1718 + use lirc_devices_audio || epatch "${FILESDIR}"/lirc-0.8.4-portaudio_check.patch
1719 + use lirc_devices_remote_wonder_plus && epatch "${FILESDIR}"/lirc-0.8.3_pre1-remotewonderplus.patch
1720 +
1721 + use lirc_devices_usb_irtoy && epatch "${FILESDIR}"/lirc-0.9.0-usb_irtoy.patch
1722 +
1723 + # Apply fixes for kernel-2.6.39 and above
1724 + epatch "${FILESDIR}"/${P}-kernel-2.6.39-fixes.patch
1725 + # Slightly massaged upstream patch to fix kfifo issues >=2.6.38
1726 + # for bug 377033
1727 + epatch "${FILESDIR}"/${P}-atiusb_kfifo.patch
1728 + # Apply fixes for kernel-3.3 and above (bug 439538)
1729 + epatch "${FILESDIR}"/${P}-kernel-3.3.0-fixes.patch
1730 + # Apply fix for missing err() in usb.h for kernel 3.5+ (bug 444736)
1731 + epatch "${FILESDIR}"/${P}-kernel-3.5-err-fix.patch
1732 +
1733 + # Do not build drivers from the top-level Makefile
1734 + sed -i -e 's:\(SUBDIRS =\) drivers\(.*\):\1\2:' Makefile.am
1735 +
1736 + # remove parallel driver on SMP systems
1737 + if linux_chkconfig_present SMP ; then
1738 + sed -i -e "s:lirc_parallel\.o::" drivers/lirc_parallel/Makefile.am
1739 + fi
1740 +
1741 + # Bug #187418 - only need this part for lirc_devices_all as others die in pkg_setup
1742 + if use lirc_devices_all && kernel_is ge 2 6 22 ; then
1743 + ewarn "Disabling lirc_gpio driver as it does no longer work Kernel 2.6.22+"
1744 + sed -i -e "s:lirc_gpio\.o::" drivers/lirc_gpio/Makefile.am
1745 + fi
1746 +
1747 + # respect CFLAGS
1748 + sed -i -e 's:CFLAGS="-O2:CFLAGS=""\n#CFLAGS="-O2:' configure.ac
1749 +
1750 + # setting default device-node
1751 + local f
1752 + for f in configure.ac acconfig.h; do
1753 + [[ -f "$f" ]] && sed -i -e '/#define LIRC_DRIVER_DEVICE/d' "$f"
1754 + done
1755 + echo "#define LIRC_DRIVER_DEVICE \"${LIRC_DRIVER_DEVICE}\"" >> acconfig.h
1756 +
1757 + eautoreconf
1758 +}
1759 +
1760 +src_configure() {
1761 + econf \
1762 + --localstatedir=/var \
1763 + --with-syslog=LOG_DAEMON \
1764 + --enable-sandboxed \
1765 + --with-kerneldir="${KV_DIR}" \
1766 + --with-moduledir="/lib/modules/${KV_FULL}/misc" \
1767 + $(use_enable debug) \
1768 + $(use_enable static-libs static) \
1769 + $(use_with X x) \
1770 + ${MY_OPTS} \
1771 + ABI="${KERNEL_ABI}" \
1772 + ARCH="$(tc-arch-kernel)"
1773 +}
1774 +
1775 +src_compile() {
1776 + emake
1777 +
1778 + MODULE_NAMES="lirc(misc:${S}/drivers)"
1779 + BUILD_TARGETS="all"
1780 + linux-mod_src_compile
1781 +}
1782 +
1783 +src_install() {
1784 + emake DESTDIR="${D}" install
1785 + emake -C drivers DESTDIR="${D}" install
1786 +
1787 + newinitd "${FILESDIR}"/lircd-0.8.6-r2 lircd
1788 + newinitd "${FILESDIR}"/lircmd lircmd
1789 + newconfd "${FILESDIR}"/lircd.conf.4 lircd
1790 +
1791 + insinto /etc/modprobe.d/
1792 + newins "${FILESDIR}"/modprobed.lirc lirc.conf
1793 +
1794 + newinitd "${FILESDIR}"/irexec-initd-0.8.6-r2 irexec
1795 + newconfd "${FILESDIR}"/irexec-confd irexec
1796 +
1797 + if use doc ; then
1798 + dohtml doc/html/*.html
1799 + insinto /usr/share/doc/${PF}/images
1800 + doins doc/images/*
1801 + fi
1802 +
1803 + insinto /usr/share/lirc/remotes
1804 + doins -r remotes/*
1805 +
1806 + keepdir /etc/lirc
1807 + if [[ -e "${D}"/etc/lirc/lircd.conf ]]; then
1808 + newdoc "${D}"/etc/lirc/lircd.conf lircd.conf.example
1809 + fi
1810 +
1811 + use static-libs || rm "${D}/usr/$(get_libdir)/liblirc_client.la"
1812 +}
1813 +
1814 +pkg_preinst() {
1815 + linux-mod_pkg_preinst
1816 +
1817 + local dir="${EROOT}/etc/modprobe.d"
1818 + if [[ -a "${dir}"/lirc && ! -a "${dir}"/lirc.conf ]]; then
1819 + elog "Renaming ${dir}/lirc to lirc.conf"
1820 + mv -f "${dir}/lirc" "${dir}/lirc.conf"
1821 + fi
1822 +
1823 + # copy the first file that can be found
1824 + if [[ -f "${EROOT}"/etc/lirc/lircd.conf ]]; then
1825 + cp "${EROOT}"/etc/lirc/lircd.conf "${T}"/lircd.conf
1826 + elif [[ -f "${EROOT}"/etc/lircd.conf ]]; then
1827 + cp "${EROOT}"/etc/lircd.conf "${T}"/lircd.conf
1828 + MOVE_OLD_LIRCD_CONF=1
1829 + elif [[ -f "${D}"/etc/lirc/lircd.conf ]]; then
1830 + cp "${D}"/etc/lirc/lircd.conf "${T}"/lircd.conf
1831 + fi
1832 +
1833 + # stop portage from touching the config file
1834 + if [[ -e "${D}"/etc/lirc/lircd.conf ]]; then
1835 + rm -f "${D}"/etc/lirc/lircd.conf
1836 + fi
1837 +}
1838 +
1839 +pkg_postinst() {
1840 + linux-mod_pkg_postinst
1841 +
1842 + # copy config file to new location
1843 + # without portage knowing about it
1844 + # so it will not delete it on unmerge or ever touch it again
1845 + if [[ -e "${T}"/lircd.conf ]]; then
1846 + cp "${T}"/lircd.conf "${EROOT}"/etc/lirc/lircd.conf
1847 + if [[ "$MOVE_OLD_LIRCD_CONF" = "1" ]]; then
1848 + elog "Moved /etc/lircd.conf to /etc/lirc/lircd.conf"
1849 + rm -f "${EROOT}"/etc/lircd.conf
1850 + fi
1851 + fi
1852 +
1853 + einfo "The new default location for lircd.conf is inside of"
1854 + einfo "/etc/lirc/ directory"
1855 +}