From 178fdceb0f95e7d00327051a88324a40b61ad2b6 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 7 Oct 2012 18:08:54 +0100 Subject: lirc w/ USB IR Toy patch --- app-misc/lirc/Manifest | 18 + app-misc/lirc/files/irexec-confd | 9 + app-misc/lirc/files/irexec-initd | 28 + app-misc/lirc/files/irexec-initd-0.8.6-r2 | 28 + .../files/lirc-0.8.3_pre1-remotewonderplus.patch | 26 + .../lirc/files/lirc-0.8.4-portaudio_check.patch | 18 + app-misc/lirc/files/lirc-0.9.0-atiusb_kfifo.patch | 14 + .../files/lirc-0.9.0-kernel-2.6.39-fixes.patch | 67 ++ app-misc/lirc/files/lirc-0.9.0-usb_irtoy.patch | 772 +++++++++++++++++++++ app-misc/lirc/files/lircd-0.8.3 | 23 + app-misc/lirc/files/lircd-0.8.6 | 41 ++ app-misc/lirc/files/lircd-0.8.6-r2 | 52 ++ app-misc/lirc/files/lircd.conf.2 | 10 + app-misc/lirc/files/lircd.conf.4 | 22 + app-misc/lirc/files/lircmd | 20 + app-misc/lirc/files/modprobed.lirc | 22 + app-misc/lirc/files/modulesd.lirc | 22 + app-misc/lirc/lirc-0.9.0-r3.ebuild | 424 +++++++++++ 18 files changed, 1616 insertions(+) create mode 100644 app-misc/lirc/Manifest create mode 100644 app-misc/lirc/files/irexec-confd create mode 100755 app-misc/lirc/files/irexec-initd create mode 100755 app-misc/lirc/files/irexec-initd-0.8.6-r2 create mode 100644 app-misc/lirc/files/lirc-0.8.3_pre1-remotewonderplus.patch create mode 100644 app-misc/lirc/files/lirc-0.8.4-portaudio_check.patch create mode 100644 app-misc/lirc/files/lirc-0.9.0-atiusb_kfifo.patch create mode 100644 app-misc/lirc/files/lirc-0.9.0-kernel-2.6.39-fixes.patch create mode 100644 app-misc/lirc/files/lirc-0.9.0-usb_irtoy.patch create mode 100644 app-misc/lirc/files/lircd-0.8.3 create mode 100644 app-misc/lirc/files/lircd-0.8.6 create mode 100644 app-misc/lirc/files/lircd-0.8.6-r2 create mode 100644 app-misc/lirc/files/lircd.conf.2 create mode 100644 app-misc/lirc/files/lircd.conf.4 create mode 100644 app-misc/lirc/files/lircmd create mode 100644 app-misc/lirc/files/modprobed.lirc create mode 100644 app-misc/lirc/files/modulesd.lirc create mode 100644 app-misc/lirc/lirc-0.9.0-r3.ebuild diff --git a/app-misc/lirc/Manifest b/app-misc/lirc/Manifest new file mode 100644 index 0000000..a724741 --- /dev/null +++ b/app-misc/lirc/Manifest @@ -0,0 +1,18 @@ +AUX irexec-confd 280 SHA256 c404ad3b624004cab25bd3a89593cdeb0abbc25771d6e52caf2f37cb4f7b2b79 SHA512 2b33e1044086d11fd6e1f9a204ce925182a3a2b92ef4399610e01702f9c2c8fbc87cae52961123297171eef3d40468ac17437b4281b26a5f3b256c9cebc612ac WHIRLPOOL ff0e09a0babe7f434252416f3c7d0fb27b95215c62e582c1cd4670130c48c74dcf1e565e4aa7c5705fe39f67922b0abdc28a1938a9288ef3476979bd99609377 +AUX irexec-initd 808 SHA256 9325419aa45d80c205bc1cd47fe839b178da74bca5dd928cbe3ae17423b92493 SHA512 6d9535cfc6469d62f2b09bc5d12ff7c792c279dab6d58d3847625ac995f20945309765c3b9781bd51dbd9d2986465f0b96818c3f4162a689807bf5e3936a4067 WHIRLPOOL be2ef1c89803a6a7c3f533c075a6a60be550d84c9b1812673d79df400305518df2b5329c6726c4aece88cf113dd2db051d1c6d6e5ea7e37e16eb463c38694690 +AUX irexec-initd-0.8.6-r2 816 SHA256 5e5a31fbd93294a6e210499a880fcab371b23706824c9d60d827b0187d7bade4 SHA512 b90226e8dc29ed1769275a010e0b1f5376b91d4f3cfd7bb9dd135bdee31c0f7849f31a885baafe4cbbf9f11b548712e1d78198b44252c779ffeccc5e47730054 WHIRLPOOL 00936357f3df1f63821d7da4f4452ba25a5368d4d128c088e421be2fff2e50d1a190522a9aac6712da2867e827492e674806e5871f797eacf12d333091991f96 +AUX lirc-0.8.3_pre1-remotewonderplus.patch 943 SHA256 547efbfa30f282ba9100495044e3b720c8f74c44f9a4e34db934d2ac7976fe29 SHA512 f1c5b03eafb8fb9d4190e438fb4ca734cac102c7f3a097f193a0a1ac7cdee33b01fb1d794959e00be16c78bb66e34d113f3ff8fb87678e99f82670ec0306e3ca WHIRLPOOL 999b01a1c2860457bf9ed68891cbb497595d58fe57627bc87d5f6401835ee5586ebcf124e1f563264ba64df22e38c7a6ccfbaf628123c5a2419bb0f57f74f19a +AUX lirc-0.8.4-portaudio_check.patch 769 SHA256 01e2034aaa6a7eb039e5c0e6c3b4a6ed38860614d3d0b0005d99a4aac2b3827e SHA512 a4e63da5d03f1fbb072679c3a415ae55767d601512f158c5e2fc52a045b632a055b94dca4e9d0d236ceeeb367daf22d4cc71f542229edb4fb13410512a8e4f0b WHIRLPOOL 0717efa4d7934c9736b220ec4416d1827397267b34bc3343a16a5963729fcfaa4871bb4e47b1aebbb310ea5bcc2bfaa7c675a451f5db46d979f0e4438e84a37e +AUX lirc-0.9.0-atiusb_kfifo.patch 437 SHA256 b7950ee185588a3626b8024cb22c0e67c8514362f5c9cb74bfcead8018e11b02 SHA512 d072ecd94ed4b7f1662441106650b7eb329cbe62887819c1e607ae87375a17dedea02a3a5dcf6956a1151743fd652ec5884577c595771740eef509daab8dbd02 WHIRLPOOL f0013dd75d6cf3486cddbea4e97e7ca9962af882befc5e994f258d1eb5e77e09379c4ca246e407f4c7ad5438b860e0e3b0abb2cade6f04b101525f060188ed03 +AUX lirc-0.9.0-kernel-2.6.39-fixes.patch 2175 SHA256 f5f48c867716288835a73b8d29aa9b1fcc4905a723e1f99e35fe396b2c759957 SHA512 a502b815cec565a49382e9ad0e7237a9bc7da431f41e94db42d214655577212606500ea2651a298db8cd3a68ce706461e6a773b0d9e3316ac7d49b2038fda354 WHIRLPOOL f1968f51cc29ce4f630c59c964d106e024f4cb3e5938ea80b271800a65d130a42531db5fe6e220ae20577cd4f1998de09e5dbdf52ff1cf6f3839922dd9ece114 +AUX lirc-0.9.0-usb_irtoy.patch 19871 SHA256 17af4972d3194476314d3f10c8997a04734139b7245dd6cd9b2be27dcd03fbc8 SHA512 30fba8e5e4d2604b10d15029a7f46dd6dc9f71b12f949a5fbd44c3f5030f098c4fab892bf649a0bd168ae5e64ead280aae7cbd0fe67562377b5d31409939d9ad WHIRLPOOL 1969843afa953713e2d44f6758bc1fdebdcfbd28d5623c3aad9febf3ce8fb71e725d184a657838a823abadfb6541558f360457c5f86b41a646a7675e8f44fe80 +AUX lircd-0.8.3 581 SHA256 9ba3c5a8c0ca5966729dc5e2c7a5960bbf12b443d91e9e319a0277f153df1b1f SHA512 d0f652df31fa1583232e3b29b5fc95d21fc76564df9f5e54881ee849c7a6fa0d697f15335c2e3f1b8ab0b29b7cddef605bd15073f394c29df9e5704854b0017a WHIRLPOOL 69c23cc6584ec435ce50689df223b27244a8deda351dbf048646f05021eba6893c22be24e167930cbb786f15e79cbfa97cf335de8b311ff9543c0e50a853a503 +AUX lircd-0.8.6 973 SHA256 473cf04b2f6addf7c86d23103b1eff68bf3758fda2bf25401ff0631c568c7805 SHA512 9992b629073d9d9c05388b6063d1a7eff6a47514ccc1af2739638c8375b284cd6252c1a825d172d160acee9983f7bd59fdde6dd282c62597e8d6d7a149f06f69 WHIRLPOOL ccb99a3df8e52f3b6abeddebd727aa734c547fafb3db19b4fd266fc7f69d0b0674f937a21bb11d8d338d59c019d870797715993eb781de1f15f4bef1cfe9927d +AUX lircd-0.8.6-r2 1317 SHA256 40d1b609e54327d40e0f4314e31ea58aa029bf95f9f27f311da1260fef2fa416 SHA512 c896b229c6b025d4f2cc3684c0905b83e8e6663f11f35fc705636445846f069cbe6ea1b03bd2e7dab136b0d4895ad35b2b940d713caee3204a97bc8c8080c2f3 WHIRLPOOL dda8fdee434778dcefb90778485845e1c7f724e292d6d11c26c5ac951b232b1bc87b75faa236c48bc3ffd4abb68b74bacbb5564173215c8d944906c542eaa232 +AUX lircd.conf.2 317 SHA256 694d96ffc0c5b8d258592d89c0221aa9b10d69ce024a69a0cc935d899e0b855e SHA512 59779104301e96b377999aad9980f2a915ee9d817e0ba33c172602ea868b49450cd198fe26cf6da4dd8690684768f4d5cd6132a66fec5fea486fbd7a5a8c3a7b WHIRLPOOL 353f5e9e17a831bc124124316f043063ee9c4a13f29f44cf66d236cfcd7d30e756392f18ad761343c723e0e4079541638d1ea7b921074e75a8449f0a5388d179 +AUX lircd.conf.4 699 SHA256 d36ff77fa193a065d25e373723e03f1a9471205151b82c73a6574cce4f095962 SHA512 1fb1778f4cc72fc9c11b13a704b3abe80bcce5b3770b69b6b6bea8571e5293adad8c6968779b812e611b67734462c9a577cc71c6b16da3a5bfe31b8007300a62 WHIRLPOOL c9d3b5845b4d395abed932f4553808c0eff66f2be2b6d6ab302c98b11eb2ffc0fcd752e2862982896a4c935425ae03a545cdeb4a6c0da91141d1622178263053 +AUX lircmd 466 SHA256 d47f22a33a83c14a4a0c333d6a445c40e550c491899fb0c6d323e23fe1eac7b7 SHA512 d3cf896f1a2229a51670d5c658c04d5c0aa078a3f8ea15211d655f8883366f9d4102e93941a75957ab3095faa5f598fb1242bfd03f534bb8af134f542d077c6e WHIRLPOOL 39880900b60f44277f41db990841620deefae03f2698122949038187a36631a14e90dba07323e5bf9b6e14cf05f28fe5a3b944ee802e56286ccbf58194ab3d35 +AUX modprobed.lirc 549 SHA256 b4951252321ea326d3ec401e5ff1112716c5aaf5b2ca94d9f5e187e22ad35c44 SHA512 a64cac97e21ab53c247d8dd3e518b3caee5eeb9c3558727eba8a04684894c6be1695ce681e71d559474f4e78bbb39130d97f843eae18e56b3d3eb70f1fbefc63 WHIRLPOOL a45ec8b3cd725f9b4c6b991cf6d4fec7869a07911a2ac82535dca665a0dd99a66b40d85faf0beea780001e9260a8a17c1ccec880c05a271a138c1e0501f7727c +AUX modulesd.lirc 482 SHA256 3906b61951e1245cb3c9b16e81255a735f7bcdbbfcbedcdf44cd53236e2a3f28 SHA512 07ae7c7288878f65857962bb3a343b83d58eca6447299253dd297dec6443b95d89f46ebcbe1f1ac66ec5062f8134a2e19ecc3ce397b2f8d0d27f203a2a103fcc WHIRLPOOL 2bc4c45d3fd314cc88d50f79974b2aafa4e55a7df7383cbd2f3ddf5b66e144b5700f8d411f79ea458caec0da3e47d5e0db2c34e1efcc2d748c473fe2c5ae7389 +DIST lirc-0.9.0.tar.bz2 857286 SHA256 6323afae6ad498d4369675f77ec3dbb680fe661bea586aa296e67f2e2daba4ff SHA512 e91534c63e6065bd7da3b15e1676edf1672b8beb21864a6825df86247d7d165bf2dee6f8191732933e24e42a406e46afc55559948e4061eed2de7b08fac13431 WHIRLPOOL 0a1c00b07898aa7a5d78865fb73c6d26c6331dd0a4945773a801d29e40298b365eb58cae113a95fcf73be678a24ac082ad0868e8051303d732882fb82a859a7b +EBUILD lirc-0.9.0-r3.ebuild 12895 SHA256 3c413e62975a799d7c5e99640b0a67561f4e6cf6dee80ba2a48f2021c1e728de SHA512 708b79d0d3be5730b7c69c94259a7d19af206f766a6bd30c3f7812f7cffbffa68238b7a905dcfea9a44513a370f12504531f7d746360e844b2a042b4ee21c8c7 WHIRLPOOL 26cc54ec8b102216f52e8753bf57952099b6b6dffad6f0d7d0fb3e5e7f8f87e4d43d9ce19cdec1f47f5c116d73e10adfa4d756b45739599a8a61dc87acd78f0c diff --git a/app-misc/lirc/files/irexec-confd b/app-misc/lirc/files/irexec-confd new file mode 100644 index 0000000..48eb8dd --- /dev/null +++ b/app-misc/lirc/files/irexec-confd @@ -0,0 +1,9 @@ +# Options to pass to the irexec process +IREXEC_OPTS="/etc/lircrc" + +# User to execute irexec as. +# Warning: Running irexec as root can open security holes +#IREXEC_USER="root" + +# Use this to disable the warning printed when starting irexec as root +# IREXEC_DISABLE_ROOT_WARNING=yes diff --git a/app-misc/lirc/files/irexec-initd b/app-misc/lirc/files/irexec-initd new file mode 100755 index 0000000..e1defee --- /dev/null +++ b/app-misc/lirc/files/irexec-initd @@ -0,0 +1,28 @@ +#!/sbin/runscript +# Copyright 2003 Martin Hierling +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/files/irexec-initd,v 1.3 2007/05/24 20:12:16 zzam Exp $ + +: ${IREXEC_USER:=root} + +depend() { + need lircd +} + +start() { + if [ "x${IREXEC_USER}" = "xroot" -a "x${IREXEC_DISABLE_ROOT_WARNING}" != "xyes" ]; then + ewarn "Warning: Running irexec as root can open security holes" + fi + + ebegin "Starting irexec" + start-stop-daemon --start --chuid ${IREXEC_USER} --user ${IREXEC_USER} --chdir / \ + --exec /usr/bin/irexec -- --daemon ${IREXEC_OPTS} + eend $? "Failed to start irexec." +} + +stop() { + ebegin "Stopping irexec" + start-stop-daemon --stop --exec /usr/bin/irexec --user ${IREXEC_USER} + eend $? "Failed to stop irexec." +} + diff --git a/app-misc/lirc/files/irexec-initd-0.8.6-r2 b/app-misc/lirc/files/irexec-initd-0.8.6-r2 new file mode 100755 index 0000000..567322a --- /dev/null +++ b/app-misc/lirc/files/irexec-initd-0.8.6-r2 @@ -0,0 +1,28 @@ +#!/sbin/runscript +# Copyright 2003 Martin Hierling +# Distributed under the terms of the GNU General Public License v2 +# $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 $ + +: ${IREXEC_USER:=root} + +depend() { + need lirc +} + +start() { + if [ "x${IREXEC_USER}" = "xroot" -a "x${IREXEC_DISABLE_ROOT_WARNING}" != "xyes" ]; then + ewarn "Warning: Running irexec as root can open security holes" + fi + + ebegin "Starting irexec" + start-stop-daemon --start --chuid ${IREXEC_USER} --user ${IREXEC_USER} --chdir / \ + --exec /usr/bin/irexec -- --daemon ${IREXEC_OPTS} + eend $? "Failed to start irexec." +} + +stop() { + ebegin "Stopping irexec" + start-stop-daemon --stop --exec /usr/bin/irexec --user ${IREXEC_USER} + eend $? "Failed to stop irexec." +} + 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 new file mode 100644 index 0000000..66527bc --- /dev/null +++ b/app-misc/lirc/files/lirc-0.8.3_pre1-remotewonderplus.patch @@ -0,0 +1,26 @@ +--- lirc-0.8.0/drivers/lirc_atiusb/lirc_atiusb.c.orig 2005-10-29 08:18:53.000000000 -0600 ++++ lirc-0.8.0/drivers/lirc_atiusb/lirc_atiusb.c 2006-04-01 14:31:05.000000000 -0700 +@@ -147,8 +147,9 @@ + /* init strings */ + #define USB_OUTLEN 7 + +-static char init1[] = {0x01, 0x00, 0x20, 0x14}; +-static char init2[] = {0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20}; ++static char init1[] = {0x80, 0x05, 0x1b, 0x15, 0x14, 0x20, 0x24, 0x15}; ++static char init2[] = {0x83, 0x03}; ++static char init3[] = {0x84, 0xd7, 0x020}; + + struct in_endpt { + /* inner link in list of endpoints for the remote specified by ir */ +@@ -1034,8 +1034,9 @@ + usb_sndintpipe(ir->usbdev, oep->ep->bEndpointAddress), oep->buf, + USB_OUTLEN, usb_remote_send, oep, oep->ep->bInterval); + +- send_packet(oep, 0x8004, init1); +- send_packet(oep, 0x8007, init2); ++ send_packet(oep, 0x8007, init1); ++ send_packet(oep, 0x8002, init2); ++ send_packet(oep, 0x8003, init3); + } + } + 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 new file mode 100644 index 0000000..36f5f36 --- /dev/null +++ b/app-misc/lirc/files/lirc-0.8.4-portaudio_check.patch @@ -0,0 +1,18 @@ +Portaudio is only needed for LIRC_DEVICES=audio, so not checking for Portaudio when the device is disabled will prevent automagic dependencies. +--- configure.ac.orig 2009-03-13 10:02:50.000000000 +0100 ++++ configure.ac 2009-03-13 10:04:00.000000000 +0100 +@@ -336,14 +336,6 @@ + AC_DEFINE(HAVE_LIBIRMAN_SW) + possible_drivers="${possible_drivers} (irman_sw)" + ) +-dnl audio driver requires PortAudio library installed and some linker flags +-AC_CHECK_HEADERS(portaudio.h,[ +- AC_CHECK_LIB(portaudio, Pa_Initialize,[ +- AC_DEFINE(HAVE_LIBPORTAUDIO) +- possible_drivers="${possible_drivers} (audio)" +- ],,${portaudio_lib_other} +- )] +-) + dnl audio_alsa driver requires ALSA library installed and some linker flags + have_alsa=no + AC_CHECK_HEADERS(alsa/asoundlib.h,[ 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 new file mode 100644 index 0000000..32edb24 --- /dev/null +++ b/app-misc/lirc/files/lirc-0.9.0-atiusb_kfifo.patch @@ -0,0 +1,14 @@ +--- a/drivers/lirc_atiusb/lirc_atiusb.c 2012-07-17 16:04:39.000000000 -0400 ++++ b/drivers/lirc_atiusb/lirc_atiusb.c 2012-07-17 16:19:06.000000000 -0400 +@@ -1050,7 +1050,11 @@ + goto new_irctl_failure_check; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38) + if (lirc_buffer_init(driver->rbuf, dclen, 1)) { ++#else ++ if (lirc_buffer_init(driver->rbuf, dclen, 2)) { ++#endif + mem_failure = 4; + goto new_irctl_failure_check; + } 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 new file mode 100644 index 0000000..6247370 --- /dev/null +++ b/app-misc/lirc/files/lirc-0.9.0-kernel-2.6.39-fixes.patch @@ -0,0 +1,67 @@ +diff -u a/drivers/lirc_atiusb/lirc_atiusb.c b/drivers/lirc_atiusb/lirc_atiusb.c +--- a/drivers/lirc_atiusb/lirc_atiusb.c ++++ b/drivers/lirc_atiusb/lirc_atiusb.c +@@ -48,7 +48,9 @@ + #include + #include + #include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) + #include ++#endif + #include + #include + #include +diff -u a/drivers/lirc_i2c/lirc_i2c.c b/drivers/lirc_i2c/lirc_i2c.c +--- a/drivers/lirc_i2c/lirc_i2c.c ++++ b/drivers/lirc_i2c/lirc_i2c.c +@@ -555,8 +555,8 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) + kfree(ir); + return -EINVAL; + } +- printk(KERN_INFO "lirc_i2c: chip 0x%x found @ 0x%02x (%s)\n", +- adap->id, addr, ir->c.name); ++ printk(KERN_INFO "lirc_i2c: chip found @ 0x%02x (%s)\n", ++ addr, ir->c.name); + + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) + /* register device */ +diff -u a/drivers/lirc_wpc8769l/lirc_wpc8769l.c b/drivers/lirc_wpc8769l/lirc_wpc8769l.c +--- a/drivers/lirc_wpc8769l/lirc_wpc8769l.c ++++ b/drivers/lirc_wpc8769l/lirc_wpc8769l.c +@@ -361,14 +361,22 @@ static irqreturn_t irq_handler(int irqno, void *blah, struct pt_regs *regs) + size = count << 3; + + ldata = (unsigned long *) data_buf; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) + next_one = generic_find_next_le_bit(ldata, size, 0); ++#else ++ next_one = find_next_zero_bit_le(ldata, size, 0); ++#endif + + if (next_one > 0) + put_pulse_bit(next_one + * WPC8769L_USECS_PER_BIT); + + while (next_one < size) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) + next_zero = generic_find_next_zero_le_bit(ldata, ++#else ++ next_zero = find_next_zero_bit_le(ldata, ++#endif + size, next_one + 1); + + put_space_bit( +@@ -376,7 +384,11 @@ static irqreturn_t irq_handler(int irqno, void *blah, struct pt_regs *regs) + * WPC8769L_USECS_PER_BIT); + + if (next_zero < size) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) + next_one = generic_find_next_le_bit(ldata, ++#else ++ next_one = find_next_bit_le(ldata, ++#endif + size, next_zero + 1); + + put_pulse_bit( +-- +1.7.5.4 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 new file mode 100644 index 0000000..80991b3 --- /dev/null +++ b/app-misc/lirc/files/lirc-0.9.0-usb_irtoy.patch @@ -0,0 +1,772 @@ +diff --git c/configure.ac w/configure.ac +index 052908b..2cd46ff 100644 +--- c/configure.ac ++++ w/configure.ac +@@ -154,6 +154,7 @@ possible_drivers="(none) \ + (uirt2) \ + (uirt2_raw) \ + (usb_uirt_raw) \ ++ (usb_irtoy) \ + (usbx) \ + (udp)" + +@@ -446,7 +447,7 @@ AC_ARG_WITH(driver, + srm7500libusb, tekram, + tekram_bt829, tira, tira_raw, ttusbir, + tuxbox, tvbox, udp, uirt2, uirt2_raw, +- usb_uirt_raw, usbx, wpc8769l], ++ usb_uirt_raw, usb_irtoy, usbx, wpc8769l], + driver=${withval}, + driver="unset" + ) +@@ -680,6 +681,9 @@ if test "$driver" = "userspace" -o "$driver" = "all"; then + uirt2_raw|usb_uirt_raw) + hw_module="${hw_module} hw_uirt2_raw.o hw_uirt2_common.o serial.o receive.o transmit.o" + ;; ++ usb_irtoy) ++ hw_module="${hw_module} hw_usbirtoy.o serial.o receive.o transmit.o" ++ ;; + usbx) + hw_module="${hw_module} hw_usbx.o serial.o" + ;; +@@ -1391,6 +1395,11 @@ if test "$driver" = "uirt2_raw"; then + hw_module="hw_uirt2_raw.o hw_uirt2_common.o serial.o receive.o transmit.o" + HW_DEFAULT="hw_uirt2_raw" + fi ++if test "$driver" = "usb_irtoy"; then ++ lirc_driver="none" ++ hw_module="hw_usbirtoy.o serial.o receive.o transmit.o" ++ HW_DEFAULT="hw_usbirtoy" ++fi + if test "$driver" = "usb_uirt_raw"; then + lirc_driver="none" + hw_module="hw_uirt2_raw.o hw_uirt2_common.o serial.o receive.o transmit.o" +diff --git c/daemons/hw-types.c w/daemons/hw-types.c +index 0536ea2..b11cbdf 100644 +--- c/daemons/hw-types.c ++++ w/daemons/hw-types.c +@@ -58,6 +58,7 @@ extern struct hardware hw_udp; + extern struct hardware hw_uirt2; + extern struct hardware hw_uirt2_raw; + extern struct hardware hw_usb_uirt_raw; ++extern struct hardware hw_usbirtoy; + extern struct hardware hw_usbx; + + #ifndef HW_DEFAULT +diff --git c/daemons/hw_usbirtoy.c w/daemons/hw_usbirtoy.c +new file mode 100644 +index 0000000..ed2df85 +--- /dev/null ++++ w/daemons/hw_usbirtoy.c +@@ -0,0 +1,607 @@ ++/**************************************************************************** ++ ** hw_usbirtoy.c ********************************************************** ++ **************************************************************************** ++ * ++ * Routines for USB Infrared Toy receiver/transmitter in sampling mode ++ * ++ * Copyright (C) 2011 Peter Kooiman ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++ #include ++#endif ++ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ ++#include "hardware.h" ++#include "serial.h" ++#include "ir_remote.h" ++#include "lircd.h" ++#include "receive.h" ++#include "transmit.h" ++ ++#define IRTOY_MINFWVERSION 20 ++ ++#define IRTOY_UNIT 21.3333 ++#define IRTOY_LONGSPACE 1000000 ++ ++ ++const unsigned char IRTOY_COMMAND_TXSTART[] = {0x24, 0x25, 0x26, 0x03}; ++#define IRTOY_COMMAND_RESET 0 ++#define IRTOY_COMMAND_SMODE_ENTER 's' ++#define IRTOY_COMMAND_VERSION 'v' ++ ++#define IRTOY_REPLY_XMITCOUNT 't' ++#define IRTOY_REPLY_XMITSUCCESS 'C' ++#define IRTOY_REPLY_VERSION 'V' ++#define IRTOY_REPLY_SAMPLEMODEPROTO 'S' ++ ++#define IRTOY_LEN_XMITRES 4 ++#define IRTOY_LEN_VERSION 4 ++#define IRTOY_LEN_SAMPLEMODEPROTO 3 ++ ++#define IRTOY_TIMEOUT_READYFORDATA 1000000 ++#define IRTOY_TIMEOUT_FLUSH 20000 ++#define IRTOY_TIMEOUT_SMODE_ENTER 500000 ++#define IRTOY_TIMEOUT_VERSION 500000 ++ ++ ++struct tag_irtoy_t { ++ int hwVersion; ++ int swVersion; ++ int protoVersion; ++ int fd; ++ int awaitingNewSig; ++ int pulse; ++}; ++ ++typedef struct tag_irtoy_t irtoy_t; ++ ++static irtoy_t *dev; ++ ++unsigned char rawSB[WBUF_SIZE * 2 + 2]; ++ ++/* exported functions */ ++static int irtoy_init(void); ++static int irtoy_deinit(void); ++static int irtoy_send(struct ir_remote *remote, struct ir_ncode *code); ++static char *irtoy_rec(struct ir_remote *remotes); ++static int irtoy_decode(struct ir_remote *remote, ir_code * prep, ir_code * codep, ir_code * postp, ++ int *repeat_flagp, lirc_t * min_remaining_gapp, lirc_t * max_remaining_gapp); ++static lirc_t irtoy_readdata(lirc_t timeout); ++ ++ ++struct hardware hw_usbirtoy = { ++#ifndef LIRC_IRTTY ++ "/dev/ttyACM0", ++#else ++ LIRC_IRTTY, /* default device */ ++#endif ++ -1, /* fd */ ++ LIRC_CAN_REC_MODE2 | LIRC_CAN_SEND_PULSE, /* features */ ++ LIRC_MODE_PULSE, /* send_mode */ ++ LIRC_MODE_MODE2, /* rec_mode */ ++ 0, /* code_length */ ++ irtoy_init, /* init_func */ ++ irtoy_deinit, /* deinit_func */ ++ irtoy_send, /* send_func */ ++ irtoy_rec, /* rec_func */ ++ irtoy_decode, /* decode_func */ ++ NULL, /* ioctl_func */ ++ irtoy_readdata, /* readdata */ ++ "usb_irtoy" ++}; ++ ++ ++static int irtoy_decode(struct ir_remote *remote, ir_code * prep, ir_code * codep, ir_code * postp, ++ int *repeat_flagp, lirc_t * min_remaining_gapp, lirc_t * max_remaining_gapp) ++{ ++ int res; ++ ++ LOGPRINTF(1, "irtoy_decode: enter"); ++ ++ res = receive_decode(remote, prep, codep, postp, repeat_flagp, min_remaining_gapp, max_remaining_gapp); ++ ++ LOGPRINTF(1, "irtoy_decode: %d", res); ++ ++ return res; ++} ++ ++ ++ ++ ++static ssize_t read_with_timeout(int fd, void *buf, size_t count, long to_usec) ++{ ++ ssize_t rc; ++ size_t numread = 0; ++ struct timeval timeout; ++ fd_set fds; ++ ++ timeout.tv_sec = 0; ++ timeout.tv_usec = to_usec; ++ ++ rc = read(fd, (char *) buf, count); ++ ++ if (rc > 0) { ++ numread += rc; ++ } ++ ++ while ((rc == -1 && errno == EAGAIN) || (rc >= 0 && numread < count)) { ++ FD_ZERO(&fds); ++ FD_SET(fd, &fds); ++ ++ rc = select(fd + 1, &fds, NULL, NULL, &timeout); ++ ++ if (rc == 0) { ++ /* timeout */ ++ break; ++ } else if (rc == -1) { ++ /* continue for EAGAIN case */ ++ continue; ++ } ++ ++ rc = read(fd, ((char *)buf) + numread, count - numread); ++ ++ if (rc > 0) { ++ numread += rc; ++ } ++ ++ } ++ ++ return(numread == 0) ? -1 : numread; ++} ++ ++ ++static int irtoy_readflush(irtoy_t * dev, long timeout) ++{ ++ int res; ++ char c; ++ ++ while ((res = read_with_timeout(dev->fd, &c, 1, timeout)) == 1) ++ ; ++ ++ if (res != 0) ++ return -1; ++ else ++ return 0; ++} ++ ++static lirc_t irtoy_read(irtoy_t * dev, lirc_t timeout) ++{ ++ ++ lirc_t data; ++ int res; ++ unsigned char dur[2]; ++ ++ if (!waitfordata(timeout)) ++ return 0; ++ ++ // lircd expects a space as start of the next transmission, not just at the end of the last one ++ // irrecord however likes to see a space at the end of the signal ++ // 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 ++ // From usb irtoy: [usbtoy timeout duration] 0xFFFF [however long it takes before next signal] ++ // We return: [usbtoy timeout duration] LONGSPACE [however long it takes before next signal] LONGSPACE ++ if (dev->awaitingNewSig) { ++ ++ LOGPRINTF(1, "new signal after large space"); ++ dev->pulse = 1; ++ dev->awaitingNewSig = 0; ++ return IRTOY_LONGSPACE; ++ } ++ ++ res = read_with_timeout(dev->fd, dur, 2, 0); ++ ++ if (res != 2) { ++ logprintf(LOG_ERR, "irtoy_read: could not get 2 bytes"); ++ return 0; ++ } ++ ++ ++ ++ LOGPRINTF(3, "read_raw %02x%02x", dur[0], dur[1]); ++ ++ ++ if (dur[0] == 0xff && dur[1] == 0xff) { ++ dev->awaitingNewSig = 1; ++ return IRTOY_LONGSPACE; ++ } ++ ++ ++ data = (lirc_t) (IRTOY_UNIT * (double) (256 * dur[0] + dur[1])); ++ ++ LOGPRINTF(3, "read_raw %d", data); ++ ++ ++ if (dev->pulse) { ++ data = data | PULSE_BIT; ++ } ++ ++ dev->pulse = ! (dev->pulse); ++ ++ ++ return data; ++} ++ ++static lirc_t irtoy_readdata(lirc_t timeout) ++{ ++ lirc_t data = irtoy_read(dev, timeout); ++ ++ if (data) { ++ LOGPRINTF(1, "irtoy_readdata %d %d", !!(data & PULSE_BIT), data & PULSE_MASK); ++ ++ } ++ ++ return(data); ++} ++ ++static int irtoy_getversion(irtoy_t *dev) ++{ ++ int res; ++ unsigned char buf[16]; ++ int vNum; ++ ++ irtoy_readflush(dev, IRTOY_TIMEOUT_FLUSH); ++ ++ ++ buf[0] = IRTOY_COMMAND_VERSION; ++ res = write(dev->fd, buf, 1); ++ ++ if (res != 1) { ++ logprintf(LOG_ERR, "irtoy_getversion: couldn't write command"); ++ return 0; ++ } ++ ++ ++ res = read_with_timeout(dev->fd, buf, IRTOY_LEN_VERSION, IRTOY_TIMEOUT_VERSION); ++ ++ if (res != IRTOY_LEN_VERSION) { ++ logprintf(LOG_ERR, "irtoy_getversion: couldn't read version"); ++ logprintf(LOG_ERR, "please make sure you are using firmware v20 or higher"); ++ return 0; ++ } ++ ++ buf[IRTOY_LEN_VERSION] = 0; ++ ++ LOGPRINTF(1, "irtoy_getversion: Got version %s", buf); ++ ++ if (buf[0] != IRTOY_REPLY_VERSION) { ++ logprintf(LOG_ERR, "irtoy_getversion: invalid response %02X", buf[0]); ++ logprintf(LOG_ERR, "please make sure you are using firmware v20 or higher"); ++ return 0; ++ } ++ ++ vNum = atoi(buf + 1); ++ dev->hwVersion = vNum / 100; ++ dev->swVersion = vNum % 100; ++ return 1; ++} ++ ++static int irtoy_reset(irtoy_t *dev) ++{ ++ int res; ++ unsigned char buf[16]; ++ ++ buf[0] = IRTOY_COMMAND_RESET; ++ res = write(dev->fd, buf, 1); ++ ++ if (res != 1) { ++ logprintf(LOG_ERR, "irtoy_reset: couldn't write command"); ++ return 0; ++ } ++ ++ irtoy_readflush(dev, IRTOY_TIMEOUT_FLUSH); ++ ++ return 1; ++} ++ ++static int irtoy_enter_samplemode(irtoy_t *dev) ++{ ++ ++ int res; ++ unsigned char buf[16]; ++ ++ buf[0] = IRTOY_COMMAND_SMODE_ENTER; ++ res = write(dev->fd, buf, 1); ++ ++ if (res != 1) { ++ logprintf(LOG_ERR, "irtoy_enter_samplemode: couldn't write command"); ++ return 0; ++ } ++ ++ ++ res = read_with_timeout(dev->fd, buf, IRTOY_LEN_SAMPLEMODEPROTO, IRTOY_TIMEOUT_SMODE_ENTER); ++ ++ if (res != IRTOY_LEN_SAMPLEMODEPROTO) { ++ logprintf(LOG_ERR, "irtoy_enter_samplemode: couldn't read command result"); ++ return 0; ++ } ++ ++ buf[IRTOY_LEN_SAMPLEMODEPROTO] = 0; ++ ++ if (buf[0] != IRTOY_REPLY_SAMPLEMODEPROTO) { ++ logprintf(LOG_ERR, "irtoy_enter_samplemode: invalid response %02X", buf[0]); ++ return 0; ++ } ++ ++ ++ LOGPRINTF(1, "irtoy_reset: Got protocol %s", buf); ++ ++ dev->protoVersion = atoi(buf + 1); ++ return 1; ++} ++ ++ ++static irtoy_t *irtoy_hw_init(int fd) ++{ ++ ++ ++ irtoy_t *dev = (irtoy_t *) malloc(sizeof(irtoy_t)); ++ ++ if (dev == NULL) { ++ logprintf(LOG_ERR, "irtoy_init: out of memory"); ++ return NULL; ++ } ++ ++ memset(dev, 0, sizeof(irtoy_t)); ++ ++ dev->awaitingNewSig = 1; ++ dev->fd = fd; ++ dev->pulse = 1; ++ ++ irtoy_readflush(dev, IRTOY_TIMEOUT_FLUSH); ++ ++ if (!irtoy_reset(dev) || !irtoy_getversion(dev) || !irtoy_enter_samplemode(dev)) { ++ free(dev); ++ dev = NULL; ++ return NULL; ++ } ++ ++ return dev; ++} ++ ++ ++ ++ ++static int irtoy_init(void) ++{ ++ ++ ++ ++ if (!tty_create_lock(hw.device)) { ++ logprintf(LOG_ERR, "usb_irtoy: could not create lock files"); ++ return(0); ++ } ++ ++ if ((hw.fd = open(hw.device, O_RDWR | O_NONBLOCK | O_NOCTTY)) < 0) { ++ logprintf(LOG_ERR, "usb_irtoy: could not open %s", hw.device); ++ tty_delete_lock(); ++ return(0); ++ } ++ ++ if (!tty_reset(hw.fd)) { ++ logprintf(LOG_ERR, "usb_irtoy: could not reset tty"); ++ close(hw.fd); ++ tty_delete_lock(); ++ return(0); ++ } ++ ++ ++ if (!tty_setbaud(hw.fd, 115200)) { ++ logprintf(LOG_ERR, "usb_irtoy: could not set baud rate"); ++ close(hw.fd); ++ tty_delete_lock(); ++ return(0); ++ } ++ ++ if (!tty_setcsize(hw.fd, 8)) { ++ logprintf(LOG_ERR, "usb_irtoy: could not set csize"); ++ close(hw.fd); ++ tty_delete_lock(); ++ return(0); ++ } ++ ++ if (!tty_setrtscts(hw.fd, 1)) { ++ logprintf(LOG_ERR, "usb_irtoy: could not enable hardware flow"); ++ close(hw.fd); ++ tty_delete_lock(); ++ return(0); ++ } ++ ++ if ((dev = irtoy_hw_init(hw.fd)) == NULL) { ++ logprintf(LOG_ERR, "usb_irtoy: No USB Irtoy device found at %s", hw.device); ++ close(hw.fd); ++ tty_delete_lock(); ++ return(0); ++ } ++ ++ LOGPRINTF(1, "Version hw %d, sw %d, protocol %d\n", dev->hwVersion, dev->swVersion, dev->protoVersion); ++ ++ if (dev->swVersion < IRTOY_MINFWVERSION) { ++ logprintf(LOG_ERR, "usb_irtoy: Need firmware V%02d or higher, this firmware: %02d", IRTOY_MINFWVERSION, dev->swVersion); ++ free(dev); ++ return 0; ++ } ++ ++ init_rec_buffer(); ++ init_send_buffer(); ++ ++ ++ ++ return(1); ++} ++ ++static int irtoy_deinit(void) ++{ ++ ++ // IMPORTANT do not remove this reset. it is vital to return the irtoy to IRMAN mode. ++ // 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. ++ // 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") ++ // 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..) ++ // triggering the problem ++ irtoy_reset(dev); ++ ++ free(dev); ++ dev = NULL; ++ ++ ++ close(hw.fd); ++ hw.fd = -1; ++ tty_delete_lock(); ++ return 1; ++} ++ ++static char *irtoy_rec(struct ir_remote *remotes) ++{ ++ LOGPRINTF(1, "irtoy_raw_rec"); ++ ++ ++ if (!clear_rec_buffer()) ++ return(NULL); ++ ++ return decode_all(remotes); ++ ++ ++} ++ ++static int irtoy_send_double_buffered(unsigned char * signals, int length) ++{ ++ int numToXmit = length; ++ int numThisTime; ++ int res; ++ unsigned char irToyBufLen; ++ unsigned char *txPtr; ++ unsigned char reply[16]; ++ int irtoyXmit; ++ ++ ++ res = write(dev->fd, IRTOY_COMMAND_TXSTART, sizeof(IRTOY_COMMAND_TXSTART)); ++ ++ if (res != sizeof(IRTOY_COMMAND_TXSTART)) { ++ logprintf(LOG_ERR, "irtoy_send: couldn't write command"); ++ return 0; ++ } ++ ++ res = read_with_timeout(dev->fd, &irToyBufLen, 1, IRTOY_TIMEOUT_READYFORDATA); ++ ++ if (res != 1) { ++ logprintf(LOG_ERR, "irtoy_send: couldn't read command result"); ++ return -1; ++ } ++ ++ LOGPRINTF(1, "irtoy ready for %d bytes\n", irToyBufLen); ++ ++ txPtr = signals; ++ ++ while (numToXmit) { ++ numThisTime = (numToXmit < irToyBufLen) ? numToXmit : irToyBufLen; ++ res = write(dev->fd, txPtr, numThisTime); ++ ++ if (res != numThisTime) { ++ logprintf(LOG_ERR, "irtoy_send: couldn't write command"); ++ return 0; ++ } ++ ++ txPtr += numThisTime; ++ numToXmit -= numThisTime; ++ ++ ++ res = read_with_timeout(dev->fd, &irToyBufLen, 1, IRTOY_TIMEOUT_READYFORDATA); ++ ++ if (res != 1) { ++ logprintf(LOG_ERR, "irtoy_send: couldn't read command result"); ++ return -1; ++ } ++ ++ LOGPRINTF(1, "irtoy ready for %d bytes\n", irToyBufLen); ++ ++ ++ } ++ ++ ++ res = read_with_timeout(dev->fd, reply, IRTOY_LEN_XMITRES, IRTOY_TIMEOUT_READYFORDATA); ++ ++ if (res != IRTOY_LEN_XMITRES) { ++ logprintf(LOG_ERR, "irtoy_send: couldn't read command result"); ++ return -1; ++ } ++ ++ LOGPRINTF(1, "%c %02X %02X %c\n", reply[0], reply[1], reply[2], reply[3]); ++ ++ if (reply[0] != IRTOY_REPLY_XMITCOUNT) { ++ logprintf(LOG_ERR, "irtoy_send: invalid byte count indicator received: %02X", reply[0]); ++ return 0; ++ } ++ ++ irtoyXmit = (reply[1] << 8) | reply[2]; ++ if (length != irtoyXmit) { ++ logprintf(LOG_ERR, "irtoy_send: incorrect byte count received: %d expected: %d", irtoyXmit, length); ++ return 0; ++ } ++ ++ if (reply[3] != IRTOY_REPLY_XMITSUCCESS) { ++ logprintf(LOG_ERR, "irtoy_send: received error status %02X", reply[3]); ++ return 0; ++ } ++ ++ return 1; ++ ++} ++ ++static int irtoy_send(struct ir_remote *remote, struct ir_ncode *code) ++{ ++ int length; ++ lirc_t *signals; ++ int res = 0; ++ ++ int numToXmit; ++ int i; ++ lirc_t val; ++ ++ ++ if (!init_send(remote, code)) { ++ return 0; ++ } ++ ++ length = send_buffer.wptr; ++ signals = send_buffer.data; ++ ++ for (i = 0; i < length; i++) { ++ val = (lirc_t)(((double) signals[i]) / IRTOY_UNIT); ++ rawSB[2*i] = val >> 8; ++ rawSB[2*i + 1] = val & 0xFF; ++ } ++ ++ rawSB[2 * length] = 0xFF; ++ rawSB[2 * length + 1] = 0xFF; ++ ++ numToXmit = 2 * length + 2; ++ return irtoy_send_double_buffered(rawSB, numToXmit); ++} ++ ++ +diff --git c/setup.data w/setup.data +index 407d6b2..99be615 100644 +--- c/setup.data ++++ w/setup.data +@@ -119,6 +119,7 @@ hw_menu_entry: @hw-usb + awlibusb: "Awox RF/IR Remote (userspace)" + sb0540: "Creative USB IR Receiver (SB0540)" + commandir: "CommandIR Multi-IR Transceiver (userspace)" ++ usb_irtoy: "Dangerous Prototypes USB Infrared Toy" + dfclibusb: "DFC USB InfraRed Remote Control (userspace)" + sasem: "Dign HV5 HTPC IR/VFD Module" + dvico: "DViCO USB Remote" +@@ -147,6 +148,7 @@ hw_menu_entry: @hw-usb + mplay: "VLSystem MPlay Blast" + mplay: "VLSystem MPlay Mini" + ++ + param_type: \ + act200l \ + act220l \ +@@ -190,6 +192,9 @@ param_type: \ + usbx + ttyUSB: + ++param_type: usb_irtoy ++ ttyACM: ++ + param_type: \ + adaptec \ + alsa_usb \ +@@ -390,6 +395,10 @@ default_param: \ + usbx + ttyUSB1: + ++default_param: usb_irtoy ++ ttyACM1: ++ ++ + remote: \ + hauppauge \ + hauppauge_dvb \ +@@ -424,6 +433,7 @@ remote: \ + ttusbir \ + uirt2_raw \ + udp \ ++ usb_irtoy \ + usb_uirt_raw \ + wpc8769l + any: +diff --git c/setup.sh w/setup.sh +index 342f32d..a3546b5 100755 +--- c/setup.sh ++++ w/setup.sh +@@ -65,6 +65,10 @@ GetSelectedDriver () + elif test "$DRIVER_PARAMETER" = "ttyUSB2"; then COM2="on"; IRTTY="/dev/ttyUSB1"; LIRC_PORT="none"; LIRC_IRQ="none" + elif test "$DRIVER_PARAMETER" = "ttyUSB3"; then COM3="on"; IRTTY="/dev/ttyUSB2"; LIRC_PORT="none"; LIRC_IRQ="none" + elif test "$DRIVER_PARAMETER" = "ttyUSB4"; then COM4="on"; IRTTY="/dev/ttyUSB3"; LIRC_PORT="none"; LIRC_IRQ="none" ++ elif test "$DRIVER_PARAMETER" = "ttyACM1"; then COM1="on"; IRTTY="/dev/ttyACM0"; LIRC_PORT="none"; LIRC_IRQ="none" ++ elif test "$DRIVER_PARAMETER" = "ttyACM2"; then COM2="on"; IRTTY="/dev/ttyACM1"; LIRC_PORT="none"; LIRC_IRQ="none" ++ elif test "$DRIVER_PARAMETER" = "ttyACM3"; then COM3="on"; IRTTY="/dev/ttyACM2"; LIRC_PORT="none"; LIRC_IRQ="none" ++ elif test "$DRIVER_PARAMETER" = "ttyACM4"; then COM4="on"; IRTTY="/dev/ttyACM3"; LIRC_PORT="none"; LIRC_IRQ="none" + elif test "$DRIVER_PARAMETER" = "com1"; then COM1="on"; LIRC_PORT=$COM1_PORT; LIRC_IRQ=$COM1_IRQ + elif test "$DRIVER_PARAMETER" = "com2"; then COM2="on"; LIRC_PORT=$COM2_PORT; LIRC_IRQ=$COM2_IRQ + elif test "$DRIVER_PARAMETER" = "com3"; then COM3="on"; LIRC_PORT=$COM3_PORT; LIRC_IRQ=$COM3_IRQ +@@ -207,6 +211,30 @@ SetPortAndIrq () + else + return 1; + fi ++ elif test "$DRIVER_PARAM_TYPE" = "ttyACM"; then ++ { ++ dialog --clear --backtitle "$BACKTITLE" \ ++ --title "Select tty to use" \ ++ --radiolist "$SET_TTY_TEXT" 13 74 6 \ ++ 1 "/dev/ttyACM0" $COM1 \ ++ 2 "/dev/ttyACM1" $COM2 \ ++ 3 "/dev/ttyACM2" $COM3 \ ++ 4 "/dev/ttyACM3" $COM4 \ ++ 2> $TEMP ++ } ++ if test "$?" = "0"; then ++ { ++ set `cat $TEMP` ++ if test "$1" = "1"; then DRIVER_PARAMETER="ttyACM1" ++ elif test "$1" = "2"; then DRIVER_PARAMETER="ttyACM2" ++ elif test "$1" = "3"; then DRIVER_PARAMETER="ttyACM3" ++ elif test "$1" = "4"; then DRIVER_PARAMETER="ttyACM4" ++ fi ++ GetSelectedDriver ++ } ++ else ++ return 1; ++ fi + fi + return 0; + } +@@ -347,7 +375,7 @@ SaveConfig () + else echo "--without-timer \\" >>$START; + fi + } +- elif test "$DRIVER_PARAM_TYPE" = "tty" -o "$DRIVER_PARAM_TYPE" = "ttyUSB" -o "$LIRC_DRIVER" = "bte"; then ++ elif test "$DRIVER_PARAM_TYPE" = "tty" -o "$DRIVER_PARAM_TYPE" = "ttyUSB" -o "$DRIVER_PARAM_TYPE" = "ttyACM" -o "$LIRC_DRIVER" = "bte"; then + { + echo "--with-tty=$IRTTY \\" >>$START + } diff --git a/app-misc/lirc/files/lircd-0.8.3 b/app-misc/lirc/files/lircd-0.8.3 new file mode 100644 index 0000000..8cd7a0a --- /dev/null +++ b/app-misc/lirc/files/lircd-0.8.3 @@ -0,0 +1,23 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/files/lircd-0.8.3,v 1.1 2008/05/05 09:53:19 zzam Exp $ + +PIDFILE=/var/run/${SVCNAME}.pid + +depend() { + provide lirc +} + +start() { + ebegin "Starting lircd" + start-stop-daemon --start --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd -- \ + -P "${PIDFILE}" ${LIRCD_OPTS} + eend $? +} + +stop() { + ebegin "Stopping lircd" + start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd + eend $? +} diff --git a/app-misc/lirc/files/lircd-0.8.6 b/app-misc/lirc/files/lircd-0.8.6 new file mode 100644 index 0000000..dbf7a47 --- /dev/null +++ b/app-misc/lirc/files/lircd-0.8.6 @@ -0,0 +1,41 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/files/lircd-0.8.6,v 1.2 2010/05/21 02:32:36 beandog Exp $ + +PIDFILE=/var/run/lirc/${SVCNAME}.pid +LIRCD_SYMLINKFILE=/dev/lircd +LIRCD_SOCKET=/var/run/lirc/lircd + +depend() { + need localmount + use modules + provide lirc +} + +start() { + local retval + ebegin "Starting lircd" + rm -f ${LIRCD_SOCKET} && ln -s ${LIRCD_SOCKET} ${LIRCD_SYMLINKFILE} + if [ $? -ne 0 ]; then + eend $? "Unable to create symbolic link ${LIRCD_SYMLINKFILE}" + return 1 + fi + + start-stop-daemon --start --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd -- \ + -P "${PIDFILE}" ${LIRCD_OPTS} + retval=$? + + if [ ${retval} -ne 0 ]; then + rm -f ${LIRCD_SOCKET} + fi + + eend ${retval} +} + +stop() { + ebegin "Stopping lircd" + rm -f ${LIRCD_SYMLINKFILE} + start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd + eend $? +} diff --git a/app-misc/lirc/files/lircd-0.8.6-r2 b/app-misc/lirc/files/lircd-0.8.6-r2 new file mode 100644 index 0000000..e651f19 --- /dev/null +++ b/app-misc/lirc/files/lircd-0.8.6-r2 @@ -0,0 +1,52 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $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 $ + +PIDFILE=/var/run/lirc/${SVCNAME}.pid +: ${LIRCD_SYMLINKFILE:=/dev/lircd} +: ${LIRCD_SOCKET:=/var/run/lirc/lircd} + +depend() { + need localmount + use modules + provide lirc +} + +start() { + local retval + + ebegin "Starting lircd" + + for retval in ${LIRCD_SET_SYSCLASSRCS} ; do + if [ -e /sys/class/rc/${retval}/protocols ] && \ + grep 'lirc' /sys/class/rc/${retval}/protocols &>/dev/null ; then + einfo "Setting lirc protocol active for ${retval}" + echo lirc >/sys/class/rc/${retval}/protocols + fi + done + + checkpath -q -d -m 0755 -o root:root /var/run/lirc + rm -Rf ${LIRCD_SOCKET} && ln -s ${LIRCD_SOCKET} ${LIRCD_SYMLINKFILE} + if [ $? -ne 0 ]; then + eend $? "Unable to create symbolic link ${LIRCD_SYMLINKFILE}" + return 1 + fi + + start-stop-daemon --start --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd -- \ + -P "${PIDFILE}" ${LIRCD_OPTS} + retval=$? + + if [ ${retval} -ne 0 ]; then + rm -Rf ${LIRCD_SOCKET} + fi + + eend ${retval} +} + +stop() { + ebegin "Stopping lircd" + rm -f ${LIRCD_SYMLINKFILE} + start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" --exec /usr/sbin/lircd + eend $? +} diff --git a/app-misc/lirc/files/lircd.conf.2 b/app-misc/lirc/files/lircd.conf.2 new file mode 100644 index 0000000..cfda2b8 --- /dev/null +++ b/app-misc/lirc/files/lircd.conf.2 @@ -0,0 +1,10 @@ +# Options to pass to the lircd process + +# for devices with lirc-kernel-module +#LIRCD_OPTS="-d /dev/lirc0" +#LIRCD_OPTS="-d /dev/lirc" + +# for devices using the input-layer +#LIRCD_OPTS="-H devinput -d /dev/input/by-path/pci-0000:00:0a.0--event-ir" +# This should work, Bug #235107 +#LIRCD_OPTS="-H devinput -d name=*DVB*" diff --git a/app-misc/lirc/files/lircd.conf.4 b/app-misc/lirc/files/lircd.conf.4 new file mode 100644 index 0000000..f59c5f2 --- /dev/null +++ b/app-misc/lirc/files/lircd.conf.4 @@ -0,0 +1,22 @@ +# Options to pass to the lircd process + +# for devices with lirc-kernel-module +#LIRCD_OPTS="-d /dev/lirc0" +#LIRCD_OPTS="-d /dev/lirc" + +# for devices using the input-layer +#LIRCD_OPTS="-H devinput -d /dev/input/by-path/pci-0000:00:0a.0--event-ir" +# This should work, Bug #235107 +#LIRCD_OPTS="-H devinput -d name=*DVB*" + +# set default protocol to 'lirc' for in-kernel IR decoding +# for the following entries in /sys/class/rc/ +# (space-separated list if there is more than one) +LIRCD_SET_SYSCLASSRCS="rc0" + +# If running mulitple instances of lircd, the following +# can be used to override the default socket path and +# socket symlink +#LIRCD_SOCKET="/var/run/lirc/lircd" +#LIRCD_SYMLINKFILE="/dev/lircd" + diff --git a/app-misc/lirc/files/lircmd b/app-misc/lirc/files/lircmd new file mode 100644 index 0000000..d383778 --- /dev/null +++ b/app-misc/lirc/files/lircmd @@ -0,0 +1,20 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/files/lircmd,v 1.2 2004/09/28 00:22:15 swegener Exp $ + +depend() { + need lircd +} + +start() { + ebegin "Starting lircmd" + start-stop-daemon --start --quiet --exec /usr/sbin/lircmd + eend $? +} + +stop() { + ebegin "Stopping lircmd" + start-stop-daemon --stop --quiet --exec /usr/sbin/lircmd + eend $? +} diff --git a/app-misc/lirc/files/modprobed.lirc b/app-misc/lirc/files/modprobed.lirc new file mode 100644 index 0000000..2ed9558 --- /dev/null +++ b/app-misc/lirc/files/modprobed.lirc @@ -0,0 +1,22 @@ +# +# For first serial receivers: +# +#options lirc_serial irq=4 io=0x3f8 +#options lirc_sir irq=4 io=0x3f8 + +# +# Detach first serial port from serial-driver. +# Use this when you have your serial-port-driver statically +# compiled into your kernel, or as a module but loaded before +# the lirc-module. +# +#install lirc_serial setserial /dev/ttyS0 uart none; modprobe --ignore-install lirc_serial +# +#install lirc_sir setserial /dev/ttyS0 uart none; modprobe --ignore-install lirc_sir + + +# +# For parallel receivers: +# +#options lirc_parallel irq=7 io=0x3bc + diff --git a/app-misc/lirc/files/modulesd.lirc b/app-misc/lirc/files/modulesd.lirc new file mode 100644 index 0000000..d1838c5 --- /dev/null +++ b/app-misc/lirc/files/modulesd.lirc @@ -0,0 +1,22 @@ +# +# For first serial receivers: +# +#options lirc_serial irq=4 io=0x3f8 +#options lirc_sir irq=4 io=0x3f8 + +# +# Detach first serial port from serial-driver. +# Use this when you have your serial-port-driver statically +# compiled into your kernel, or as a module but loaded before +# the lirc-module. +# +#pre-install lirc_serial setserial /dev/ttyS0 uart none +# +#pre-install lirc_sir setserial /dev/ttyS0 uart none + + +# +# For parallel receivers: +# +#options lirc_parallel irq=7 io=0x3bc + diff --git a/app-misc/lirc/lirc-0.9.0-r3.ebuild b/app-misc/lirc/lirc-0.9.0-r3.ebuild new file mode 100644 index 0000000..a938d98 --- /dev/null +++ b/app-misc/lirc/lirc-0.9.0-r3.ebuild @@ -0,0 +1,424 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/lirc-0.9.0-r2.ebuild,v 1.3 2012/09/15 15:08:36 ago Exp $ + +EAPI=4 + +inherit eutils linux-mod linux-info toolchain-funcs flag-o-matic autotools + +DESCRIPTION="decode and send infra-red signals of many commonly used remote controls" +HOMEPAGE="http://www.lirc.org/" + +MY_P=${PN}-${PV/_/} + +if [[ "${PV/_pre/}" = "${PV}" ]]; then + SRC_URI="mirror://sourceforge/lirc/${MY_P}.tar.bz2" +else + SRC_URI="http://www.lirc.org/software/snapshots/${MY_P}.tar.bz2" +fi + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 ~ppc ~x86" +IUSE="debug doc hardware-carrier transmitter static-libs X" + +S="${WORKDIR}/${MY_P}" + +RDEPEND=" + X? ( + x11-libs/libX11 + x11-libs/libSM + x11-libs/libICE + ) + lirc_devices_alsa_usb? ( media-libs/alsa-lib ) + lirc_devices_audio? ( >media-libs/portaudio-18 ) + lirc_devices_irman? ( media-libs/libirman )" + +# 2012-07-17, Ian Stakenvicius +# A helper script that scrapes out values for nearly all of the variables below +# from lirc's configure.ac is available at +# http://dev.gentoo.org/~axs/helper-for-lirc-iuse.sh + +# This are drivers with names matching the +# parameter --with-driver=NAME +IUSE_LIRC_DEVICES_DIRECT=" + all userspace accent act200l act220l + adaptec alsa_usb animax asusdh atilibusb + atiusb audio audio_alsa avermedia avermedia_vdomate + avermedia98 awlibusb bestbuy bestbuy2 breakoutbox + bte bw6130 caraca chronos commandir + cph06x creative creative_infracd + devinput digimatrix dsp dvico ea65 ene0100 + exaudio flyvideo ftdi gvbctv5pci hauppauge + hauppauge_dvb hercules_smarttv_stereo i2cuser + igorplugusb iguanaIR imon imon_24g imon_knob + imon_lcd imon_pad imon_rsc irdeo irdeo_remote + irlink irman irreal it87 ite8709 + knc_one kworld leadtek_0007 leadtek_0010 + leadtek_pvr2000 livedrive_midi + livedrive_seq logitech macmini + mediafocusI mouseremote + mouseremote_ps2 mp3anywhere mplay nslu2 + packard_bell parallel pcmak pcmak_usb + pctv pixelview_bt878 pixelview_pak + pixelview_pro provideo realmagic + remotemaster sa1100 samsung sasem sb0540 serial + silitek sir slinke streamzap tekram + tekram_bt829 tira ttusbir tuxbox tvbox udp uirt2 + uirt2_raw usb_irtoy usb_uirt_raw usbx wpc8769l" + +# drivers that need special handling and +# must have another name specified for +# parameter --with-driver=NAME +IUSE_LIRC_DEVICES_SPECIAL=" + serial_igor_cesko + remote_wonder_plus xboxusb usbirboy inputlirc" + +IUSE_LIRC_DEVICES="${IUSE_LIRC_DEVICES_DIRECT} ${IUSE_LIRC_DEVICES_SPECIAL}" + +# The following are lists which are used to provide ewarns on incompatibilities +# with the kernel: + +#drivers that do not build kernel modules +NO_KMOD_BUILT_FOR_DEV=" + accent bte creative creative_infracd devinput dsp ea65 exaudio + ftdi i2cuser irlink irreal livedrive_midi livedrive_seq logitech + mediafocusI mouseremote mouseremote_ps2 mp3anywhere mplay mplay2 + pcmak pcmak_usb pctv realmagic remotemaster silitek tira tira_raw + tuxbox udp uirt2 uirt2_raw usb_irtoy usb_uirt_raw usbx" + +#drivers that build lirc_dev and so will conflict with kernel lirc_dev +LIRCDEV_BUILT_FOR_DEV="all + act200l act220l adaptec animax atiusb breakoutbox hauppauge + hauppauge_dvb hercules_smarttv_stereo igorplugusb imon imon_24g + imon_knob imon_lcd imon_pad imon_rsc irdeo irdeo_remote knc_one + leadtek_pvr2000 nslu2 packard_bell parallel pixelview_bt878 + provideo sa1100 sasem serial sir tekram tekram_bt829 ttusbir + tvbox wpc8769l" + +#lirc_gpio drivers, which cannot be supported on kernel >= 2.6.22 +LIRC_GPIO_DEV=" + avermedia avermedia98 avermedia_vdomate bestbuy bestbuy2 chronos + cph03x cph06x flyvideo gvbctv5pci kworld leadtek_0007 leadtek_0010 + pixelview_pak pixelview_pro" + +#device-driver which use libusb +LIBUSB_USED_BY_DEV=" + all atilibusb awlibusb sasem igorplugusb imon imon_lcd imon_pad + imon_rsc streamzap xboxusb irlink commandir" + +for dev in ${LIBUSB_USED_BY_DEV}; do + DEPEND="${DEPEND} lirc_devices_${dev}? ( virtual/libusb:0 )" +done + +# adding only compile-time depends +DEPEND="${RDEPEND} ${DEPEND} + virtual/linux-sources + lirc_devices_ftdi? ( dev-embedded/libftdi ) + lirc_devices_all? ( dev-embedded/libftdi )" + +# adding only run-time depends +RDEPEND="${RDEPEND} + lirc_devices_usbirboy? ( app-misc/usbirboy ) + lirc_devices_inputlirc? ( app-misc/inputlircd ) + lirc_devices_iguanaIR? ( app-misc/iguanaIR )" + +# add all devices to IUSE +# and ensure lirc_devices_all is not set alongside lirc_devices_* +REQUIRED_USE="lirc_devices_all? (" +for dev in ${IUSE_LIRC_DEVICES}; do + IUSE="${IUSE} lirc_devices_${dev}" + if [[ "${dev}" != "all" ]]; then + REQUIRED_USE="${REQUIRED_USE} !lirc_devices_${dev}" + fi +done +REQUIRED_USE="${REQUIRED_USE} )" + +add_device() { + local dev="${1}" + local desc="device ${dev}" + if [[ -n "${2}" ]]; then + desc="${2}" + fi + + # Bug #187418 + if kernel_is ge 2 6 22 && [[ " ${LIRC_GPIO_DEV} " == *" ${dev} "* ]]; then + eerror "${desc} uses lirc_gpio which fails with kernel 2.6.22 or above. Not building." + eerror "Use 'devinput' instead, or use 'userspace' along with in-kernel drivers" + return 0 + fi + : ${lirc_device_count:=0} + ((lirc_device_count++)) + + elog "Compiling support for ${desc}" + + if [[ " ${LIRCDEV_BUILT_FOR_DEV} " == *" ${dev} "* ]] ; then + if linux_chkconfig_present LIRC ; then + ewarn "${desc} builds lirc_dev and CONFIG_LIRC is set in the kernel -- this may conflict." + fi + if ! linux_chkconfig_present MODULE_UNLOAD ; then + ewarn "${desc} builds modules and CONFIG_MODULE_UNLOAD is unset in kernel." + ewarn "You will need MODULE_UNLOAD support in your kernel." + fi + fi + if [[ " ${NO_KMOD_BUILT_FOR_DEV} " == *" ${dev} "* ]] && ! linux_chkconfig_present IR_LIRC_CODEC ; then + ewarn "${desc} builds no kernel module and CONFIG_IR_LIRC_CODEC is unset in kernel." + fi + + if [[ ${lirc_device_count} -eq 2 ]] ; then + ewarn + ewarn "LIRC_DEVICES has more than one entry." + ewarn "When selecting multiple devices for lirc to be supported," + ewarn "it can not be guaranteed that the drivers play nice together." + ewarn "If this is not intended, then please adjust LIRC_DEVICES" + ewarn "and re-emerge." + ewarn + fi + + MY_OPTS="${MY_OPTS} --with-driver=${dev}" +} + +pkg_pretend() { + if [[ -n "${LIRC_OPTS}" ]] ; then + ewarn + ewarn "LIRC_OPTS is deprecated from lirc-0.8.0-r1 on." + ewarn + ewarn "Please use LIRC_DEVICES from now on." + ewarn "e.g. LIRC_DEVICES=\"serial sir\"" + ewarn + ewarn "Flags are now set per use-flags." + ewarn "e.g. transmitter, hardware-carrier" + + local opt + local unsupported_opts="" + + # test for allowed options for LIRC_OPTS + for opt in ${LIRC_OPTS}; do + case ${opt} in + --with-port=*|--with-irq=*|--with-timer=*|--with-tty=*) + MY_OPTS="${MY_OPTS} ${opt}" + ;; + *) + unsupported_opts="${unsupported_opts} ${opt}" + ;; + esac + done + if [[ -n ${unsupported_opts} ]]; then + eerror "These options are no longer allowed to be set" + eerror "with LIRC_OPTS: ${unsupported_opts}" + die "LIRC_OPTS is no longer supported, use LIRC_DEVICES." + fi + fi +} + +pkg_setup() { + linux-mod_pkg_setup + + # set default configure options + MY_OPTS="" + LIRC_DRIVER_DEVICE="/dev/lirc0" + + if use lirc_devices_all; then + # compile in drivers for a lot of devices + add_device all "a lot of devices" + else + # compile in only requested drivers + local dev + for dev in ${IUSE_LIRC_DEVICES_DIRECT}; do + if use lirc_devices_${dev}; then + add_device ${dev} + fi + done + + if use lirc_devices_remote_wonder_plus; then + add_device atiusb "device Remote Wonder Plus (atiusb-based)" + fi + + if use lirc_devices_serial_igor_cesko; then + add_device serial "serial with Igor Cesko design" + MY_OPTS="${MY_OPTS} --with-igor" + fi + + if use lirc_devices_imon_pad; then + ewarn "The imon_pad driver has incorporated the previous pad2keys patch" + ewarn "and removed the pad2keys_active option for the lirc_imon module" + ewarn "because it is always active." + ewarn "If you have an older imon VFD device, you may need to add the module" + ewarn "option display_type=1 to override autodetection and force VFD mode." + fi + + if use lirc_devices_xboxusb; then + add_device atiusb "device xboxusb" + fi + + if use lirc_devices_usbirboy; then + add_device userspace "device usbirboy" + LIRC_DRIVER_DEVICE="/dev/usbirboy" + fi + + if [[ "${MY_OPTS}" == "" ]]; then + if [[ "${PROFILE_ARCH}" == "xbox" ]]; then + # on xbox: use special driver + add_device atiusb "device xboxusb" + else + # no driver requested + elog + elog "Compiling only the lirc-applications, but no drivers." + elog "Enable drivers with LIRC_DEVICES if you need them." + MY_OPTS="--with-driver=none" + fi + fi + fi + + use hardware-carrier && MY_OPTS="${MY_OPTS} --without-soft-carrier" + use transmitter && MY_OPTS="${MY_OPTS} --with-transmitter" + + einfo + einfo "lirc-configure-opts: ${MY_OPTS}" + elog "Setting default lirc-device to ${LIRC_DRIVER_DEVICE}" + + filter-flags -Wl,-O1 + + # force non-parallel make, Bug 196134 (confirmed valid for 0.9.0-r2) + MAKEOPTS="${MAKEOPTS} -j1" +} + +src_prepare() { + # Rip out dos CRLF + edos2unix contrib/lirc.rules + + # Apply patches needed for some special device-types + use lirc_devices_audio || epatch "${FILESDIR}"/lirc-0.8.4-portaudio_check.patch + use lirc_devices_remote_wonder_plus && epatch "${FILESDIR}"/lirc-0.8.3_pre1-remotewonderplus.patch + + use lirc_devices_usb_irtoy && epatch "${FILESDIR}"/lirc-0.9.0-usb_irtoy.patch + + # Apply fixes for kernel-2.6.39 and above + epatch "${FILESDIR}"/${P}-kernel-2.6.39-fixes.patch + # Slightly massaged upstream patch to fix kfifo issues >=2.6.38 + # for bug 377033 + epatch "${FILESDIR}"/${P}-atiusb_kfifo.patch + + # Do not build drivers from the top-level Makefile + sed -i -e 's:\(SUBDIRS =\) drivers\(.*\):\1\2:' Makefile.am + + # remove parallel driver on SMP systems + if linux_chkconfig_present SMP ; then + sed -i -e "s:lirc_parallel\.o::" drivers/lirc_parallel/Makefile.am + fi + + # Bug #187418 - only need this part for lirc_devices_all as others die in pkg_setup + if use lirc_devices_all && kernel_is ge 2 6 22 ; then + ewarn "Disabling lirc_gpio driver as it does no longer work Kernel 2.6.22+" + sed -i -e "s:lirc_gpio\.o::" drivers/lirc_gpio/Makefile.am + fi + + # respect CFLAGS + sed -i -e 's:CFLAGS="-O2:CFLAGS=""\n#CFLAGS="-O2:' configure.ac + + # setting default device-node + local f + for f in configure.ac acconfig.h; do + [[ -f "$f" ]] && sed -i -e '/#define LIRC_DRIVER_DEVICE/d' "$f" + done + echo "#define LIRC_DRIVER_DEVICE \"${LIRC_DRIVER_DEVICE}\"" >> acconfig.h + + eautoreconf +} + +src_configure() { + econf \ + --localstatedir=/var \ + --with-syslog=LOG_DAEMON \ + --enable-sandboxed \ + --with-kerneldir="${KV_DIR}" \ + --with-moduledir="/lib/modules/${KV_FULL}/misc" \ + $(use_enable debug) \ + $(use_enable static-libs static) \ + $(use_with X x) \ + ${MY_OPTS} \ + ABI="${KERNEL_ABI}" \ + ARCH="$(tc-arch-kernel)" +} + +src_compile() { + emake + + MODULE_NAMES="lirc(misc:${S}/drivers)" + BUILD_TARGETS="all" + linux-mod_src_compile +} + +src_install() { + emake DESTDIR="${D}" install + emake -C drivers DESTDIR="${D}" install + + newinitd "${FILESDIR}"/lircd-0.8.6-r2 lircd + newinitd "${FILESDIR}"/lircmd lircmd + newconfd "${FILESDIR}"/lircd.conf.4 lircd + + insinto /etc/modprobe.d/ + newins "${FILESDIR}"/modprobed.lirc lirc.conf + + newinitd "${FILESDIR}"/irexec-initd-0.8.6-r2 irexec + newconfd "${FILESDIR}"/irexec-confd irexec + + if use doc ; then + dohtml doc/html/*.html + insinto /usr/share/doc/${PF}/images + doins doc/images/* + fi + + insinto /usr/share/lirc/remotes + doins -r remotes/* + + keepdir /etc/lirc + if [[ -e "${D}"/etc/lirc/lircd.conf ]]; then + newdoc "${D}"/etc/lirc/lircd.conf lircd.conf.example + fi + + use static-libs || rm "${D}/usr/$(get_libdir)/liblirc_client.la" +} + +pkg_preinst() { + linux-mod_pkg_preinst + + local dir="${EROOT}/etc/modprobe.d" + if [[ -a "${dir}"/lirc && ! -a "${dir}"/lirc.conf ]]; then + elog "Renaming ${dir}/lirc to lirc.conf" + mv -f "${dir}/lirc" "${dir}/lirc.conf" + fi + + # copy the first file that can be found + if [[ -f "${EROOT}"/etc/lirc/lircd.conf ]]; then + cp "${EROOT}"/etc/lirc/lircd.conf "${T}"/lircd.conf + elif [[ -f "${EROOT}"/etc/lircd.conf ]]; then + cp "${EROOT}"/etc/lircd.conf "${T}"/lircd.conf + MOVE_OLD_LIRCD_CONF=1 + elif [[ -f "${D}"/etc/lirc/lircd.conf ]]; then + cp "${D}"/etc/lirc/lircd.conf "${T}"/lircd.conf + fi + + # stop portage from touching the config file + if [[ -e "${D}"/etc/lirc/lircd.conf ]]; then + rm -f "${D}"/etc/lirc/lircd.conf + fi +} + +pkg_postinst() { + linux-mod_pkg_postinst + + # copy config file to new location + # without portage knowing about it + # so it will not delete it on unmerge or ever touch it again + if [[ -e "${T}"/lircd.conf ]]; then + cp "${T}"/lircd.conf "${EROOT}"/etc/lirc/lircd.conf + if [[ "$MOVE_OLD_LIRCD_CONF" = "1" ]]; then + elog "Moved /etc/lircd.conf to /etc/lirc/lircd.conf" + rm -f "${EROOT}"/etc/lircd.conf + fi + fi + + einfo "The new default location for lircd.conf is inside of" + einfo "/etc/lirc/ directory" +} -- cgit v1.2.3