summaryrefslogtreecommitdiff
path: root/app-misc/lirc/files
diff options
context:
space:
mode:
Diffstat (limited to 'app-misc/lirc/files')
-rw-r--r--app-misc/lirc/files/irexec-confd9
-rwxr-xr-xapp-misc/lirc/files/irexec-initd28
-rwxr-xr-xapp-misc/lirc/files/irexec-initd-0.8.6-r228
-rw-r--r--app-misc/lirc/files/lirc-0.8.3_pre1-remotewonderplus.patch26
-rw-r--r--app-misc/lirc/files/lirc-0.8.4-portaudio_check.patch18
-rw-r--r--app-misc/lirc/files/lirc-0.9.0-atiusb_kfifo.patch14
-rw-r--r--app-misc/lirc/files/lirc-0.9.0-kernel-2.6.39-fixes.patch67
-rw-r--r--app-misc/lirc/files/lirc-0.9.0-usb_irtoy.patch772
-rw-r--r--app-misc/lirc/files/lircd-0.8.323
-rw-r--r--app-misc/lirc/files/lircd-0.8.641
-rw-r--r--app-misc/lirc/files/lircd-0.8.6-r252
-rw-r--r--app-misc/lirc/files/lircd.conf.210
-rw-r--r--app-misc/lirc/files/lircd.conf.422
-rw-r--r--app-misc/lirc/files/lircmd20
-rw-r--r--app-misc/lirc/files/modprobed.lirc22
-rw-r--r--app-misc/lirc/files/modulesd.lirc22
16 files changed, 1174 insertions, 0 deletions
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 <mad@cc.fh-lippe.de>
+# 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 <mad@cc.fh-lippe.de>
+# 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 <linux/slab.h>
+ #include <linux/module.h>
+ #include <linux/kmod.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
+ #include <linux/smp_lock.h>
++#endif
+ #include <linux/completion.h>
+ #include <linux/uaccess.h>
+ #include <linux/usb.h>
+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 <pkooiman@gmail.com>
++ *
++ * 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 <config.h>
++#endif
++
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <stdarg.h>
++#include <fcntl.h>
++#include <unistd.h>
++#include <limits.h>
++#include <signal.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#include <sys/ioctl.h>
++#include <errno.h>
++
++
++#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: <signal...><lastpulse> [usbtoy timeout duration] 0xFFFF [however long it takes before next signal] <firstpulse><signal..>
++ // We return: <signal><lastpulse> [usbtoy timeout duration] LONGSPACE [however long it takes before next signal] LONGSPACE <firstpulse><signal>
++ 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
+