rpms/kernel/F-13 kernel.spec,1.1949,1.1950 lirc-2.6.33.patch,1.1,1.2

Jarod Wilson jwilson at fedoraproject.org
Wed Mar 17 14:10:30 UTC 2010


Author: jwilson

Update of /cvs/pkgs/rpms/kernel/F-13
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16742

Modified Files:
	kernel.spec lirc-2.6.33.patch 
Log Message:
* Wed Mar 17 2010 Jarod Wilson <jarod at redhat.com>
- lirc driver update:
  * fix lirc_i2c on cx2341x hauppauge cards (#573675)
  * fix null ptr deref in lirc_imon (#545599)
  * fix lirc_zilog on cx2341x hauppauge cards
  * adds a few new lirc_mceusb device ids
- imon input layer driver update, adds better support for 0xffdc
  devices and handles failed key lookups better



Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-13/kernel.spec,v
retrieving revision 1.1949
retrieving revision 1.1950
diff -u -p -r1.1949 -r1.1950
--- kernel.spec	16 Mar 2010 09:34:51 -0000	1.1949
+++ kernel.spec	17 Mar 2010 14:10:28 -0000	1.1950
@@ -1990,6 +1990,15 @@ fi
 # and build.
 
 %changelog
+* Wed Mar 17 2010 Jarod Wilson <jarod at redhat.com>
+- lirc driver update:
+  * fix lirc_i2c on cx2341x hauppauge cards (#573675)
+  * fix null ptr deref in lirc_imon (#545599)
+  * fix lirc_zilog on cx2341x hauppauge cards
+  * adds a few new lirc_mceusb device ids
+- imon input layer driver update, adds better support for 0xffdc
+  devices and handles failed key lookups better
+
 * Tue Mar 16 2010 Chuck Ebbert <cebbert at redhat.com>
 - Linux 2.6.33.1
 

lirc-2.6.33.patch:
 MAINTAINERS                           |    9 
 drivers/input/Kconfig                 |    2 
 drivers/input/Makefile                |    2 
 drivers/input/lirc/Kconfig            |  116 +
 drivers/input/lirc/Makefile           |   21 
 drivers/input/lirc/lirc_bt829.c       |  383 +++++
 drivers/input/lirc/lirc_dev.c         |  749 ++++++++++
 drivers/input/lirc/lirc_dev.h         |  228 +++
 drivers/input/lirc/lirc_ene0100.c     |  646 ++++++++
 drivers/input/lirc/lirc_ene0100.h     |  169 ++
 drivers/input/lirc/lirc_i2c.c         |  536 +++++++
 drivers/input/lirc/lirc_igorplugusb.c |  555 +++++++
 drivers/input/lirc/lirc_imon.c        | 1053 ++++++++++++++
 drivers/input/lirc/lirc_it87.c        | 1019 +++++++++++++
 drivers/input/lirc/lirc_it87.h        |  116 +
 drivers/input/lirc/lirc_ite8709.c     |  540 +++++++
 drivers/input/lirc/lirc_mceusb.c      | 1225 ++++++++++++++++
 drivers/input/lirc/lirc_parallel.c    |  709 +++++++++
 drivers/input/lirc/lirc_parallel.h    |   26 
 drivers/input/lirc/lirc_sasem.c       |  931 ++++++++++++
 drivers/input/lirc/lirc_serial.c      | 1317 +++++++++++++++++
 drivers/input/lirc/lirc_sir.c         | 1283 +++++++++++++++++
 drivers/input/lirc/lirc_streamzap.c   |  821 +++++++++++
 drivers/input/lirc/lirc_ttusbir.c     |  397 +++++
 drivers/input/lirc/lirc_zilog.c       | 1388 ++++++++++++++++++
 drivers/input/misc/Kconfig            |   12 
 drivers/input/misc/Makefile           |    1 
 drivers/input/misc/imon.c             | 2501 ++++++++++++++++++++++++++++++++++
 include/linux/lirc.h                  |  159 ++
 29 files changed, 16914 insertions(+)

Index: lirc-2.6.33.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-13/lirc-2.6.33.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- lirc-2.6.33.patch	12 Jan 2010 21:14:29 -0000	1.1
+++ lirc-2.6.33.patch	17 Mar 2010 14:10:29 -0000	1.2
@@ -1,133 +1,64 @@
- include/linux/lirc.h                  |   94 ++
+lirc drivers, 2010.03.17
+
+Generated against linus/master from the linux-2.6-lirc.git tree at
+http://git.kernel.org/?p=linux/kernel/git/jarod/linux-2.6-lirc.git;a=summary
+
+Also includes a pure input imon driver, which used to be part of lirc_imon...
+
+Signed-off-by: Jarod Wilson <jarod at redhat.com>
+
+---
+ MAINTAINERS                           |    9 +
  drivers/input/Kconfig                 |    2 +
  drivers/input/Makefile                |    2 +
  drivers/input/lirc/Kconfig            |  116 ++
  drivers/input/lirc/Makefile           |   21 +
- drivers/input/lirc/lirc_bt829.c       |  383 ++++++
- drivers/input/lirc/lirc_dev.c         |  736 ++++++++++
- drivers/input/lirc/lirc_dev.h         |  225 +++
+ drivers/input/lirc/lirc_bt829.c       |  383 +++++
+ drivers/input/lirc/lirc_dev.c         |  749 ++++++++++
+ drivers/input/lirc/lirc_dev.h         |  228 +++
  drivers/input/lirc/lirc_ene0100.c     |  646 +++++++++
  drivers/input/lirc/lirc_ene0100.h     |  169 +++
- drivers/input/lirc/lirc_i2c.c         |  536 ++++++++
- drivers/input/lirc/lirc_igorplugusb.c |  556 ++++++++
- drivers/input/lirc/lirc_imon.c        | 1054 ++++++++++++++
- drivers/input/lirc/lirc_it87.c        |  991 ++++++++++++++
+ drivers/input/lirc/lirc_i2c.c         |  536 +++++++
+ drivers/input/lirc/lirc_igorplugusb.c |  555 ++++++++
+ drivers/input/lirc/lirc_imon.c        | 1053 ++++++++++++++
+ drivers/input/lirc/lirc_it87.c        | 1019 ++++++++++++++
  drivers/input/lirc/lirc_it87.h        |  116 ++
- drivers/input/lirc/lirc_ite8709.c     |  540 ++++++++
- drivers/input/lirc/lirc_mceusb.c      | 1222 +++++++++++++++++
+ drivers/input/lirc/lirc_ite8709.c     |  540 +++++++
+ drivers/input/lirc/lirc_mceusb.c      | 1225 ++++++++++++++++
  drivers/input/lirc/lirc_parallel.c    |  709 ++++++++++
  drivers/input/lirc/lirc_parallel.h    |   26 +
- drivers/input/lirc/lirc_sasem.c       |  931 +++++++++++++
- drivers/input/lirc/lirc_serial.c      | 1317 ++++++++++++++++++
+ drivers/input/lirc/lirc_sasem.c       |  931 ++++++++++++
+ drivers/input/lirc/lirc_serial.c      | 1317 +++++++++++++++++
  drivers/input/lirc/lirc_sir.c         | 1283 +++++++++++++++++
- drivers/input/lirc/lirc_streamzap.c   |  794 +++++++++++
+ drivers/input/lirc/lirc_streamzap.c   |  821 +++++++++++
  drivers/input/lirc/lirc_ttusbir.c     |  397 ++++++
- drivers/input/lirc/lirc_zilog.c       | 1396 +++++++++++++++++++
+ drivers/input/lirc/lirc_zilog.c       | 1388 ++++++++++++++++++
  drivers/input/misc/Kconfig            |   12 +
  drivers/input/misc/Makefile           |    1 +
- drivers/input/misc/imon.c             | 2430 +++++++++++++++++++++++++++++++++
- 28 files changed, 16705 insertions(+), 0 deletions(-)
+ drivers/input/misc/imon.c             | 2501 +++++++++++++++++++++++++++++++++
+ include/linux/lirc.h                  |  159 +++
+ 29 files changed, 16914 insertions(+), 0 deletions(-)
 
-diff --git a/include/linux/lirc.h b/include/linux/lirc.h
-new file mode 100644
-index 0000000..8ae64fa
---- /dev/null
-+++ b/include/linux/lirc.h
-@@ -0,0 +1,94 @@
-+/*
-+ * lirc.h - linux infrared remote control header file
-+ * last modified 2007/09/27
-+ */
-+
-+#ifndef _LINUX_LIRC_H
-+#define _LINUX_LIRC_H
-+
-+#include <linux/types.h>
-+#include <linux/ioctl.h>
-+
-+#define PULSE_BIT  0x01000000
-+#define PULSE_MASK 0x00FFFFFF
-+
-+/*** lirc compatible hardware features ***/
-+
-+#define LIRC_MODE2SEND(x) (x)
-+#define LIRC_SEND2MODE(x) (x)
-+#define LIRC_MODE2REC(x) ((x) << 16)
-+#define LIRC_REC2MODE(x) ((x) >> 16)
-+
-+#define LIRC_MODE_RAW                  0x00000001
-+#define LIRC_MODE_PULSE                0x00000002
-+#define LIRC_MODE_MODE2                0x00000004
-+#define LIRC_MODE_LIRCCODE             0x00000010
-+
-+
-+#define LIRC_CAN_SEND_RAW              LIRC_MODE2SEND(LIRC_MODE_RAW)
-+#define LIRC_CAN_SEND_PULSE            LIRC_MODE2SEND(LIRC_MODE_PULSE)
-+#define LIRC_CAN_SEND_MODE2            LIRC_MODE2SEND(LIRC_MODE_MODE2)
-+#define LIRC_CAN_SEND_LIRCCODE         LIRC_MODE2SEND(LIRC_MODE_LIRCCODE)
-+
-+#define LIRC_CAN_SEND_MASK             0x0000003f
-+
-+#define LIRC_CAN_SET_SEND_CARRIER      0x00000100
-+#define LIRC_CAN_SET_SEND_DUTY_CYCLE   0x00000200
-+#define LIRC_CAN_SET_TRANSMITTER_MASK  0x00000400
-+
-+#define LIRC_CAN_REC_RAW               LIRC_MODE2REC(LIRC_MODE_RAW)
-+#define LIRC_CAN_REC_PULSE             LIRC_MODE2REC(LIRC_MODE_PULSE)
-+#define LIRC_CAN_REC_MODE2             LIRC_MODE2REC(LIRC_MODE_MODE2)
-+#define LIRC_CAN_REC_LIRCCODE          LIRC_MODE2REC(LIRC_MODE_LIRCCODE)
-+
-+#define LIRC_CAN_REC_MASK              LIRC_MODE2REC(LIRC_CAN_SEND_MASK)
-+
-+#define LIRC_CAN_SET_REC_CARRIER       (LIRC_CAN_SET_SEND_CARRIER << 16)
-+#define LIRC_CAN_SET_REC_DUTY_CYCLE    (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16)
-+
-+#define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000
-+#define LIRC_CAN_SET_REC_CARRIER_RANGE    0x80000000
-+#define LIRC_CAN_GET_REC_RESOLUTION       0x20000000
-+
-+#define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK)
-+#define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK)
-+
-+#define LIRC_CAN_NOTIFY_DECODE            0x01000000
-+
-+/*** IOCTL commands for lirc driver ***/
-+
-+#define LIRC_GET_FEATURES              _IOR('i', 0x00000000, uint64_t)
-+
-+#define LIRC_GET_SEND_MODE             _IOR('i', 0x00000001, uint64_t)
-+#define LIRC_GET_REC_MODE              _IOR('i', 0x00000002, uint64_t)
-+#define LIRC_GET_SEND_CARRIER          _IOR('i', 0x00000003, uint32_t)
-+#define LIRC_GET_REC_CARRIER           _IOR('i', 0x00000004, uint32_t)
-+#define LIRC_GET_SEND_DUTY_CYCLE       _IOR('i', 0x00000005, uint32_t)
-+#define LIRC_GET_REC_DUTY_CYCLE        _IOR('i', 0x00000006, uint32_t)
-+#define LIRC_GET_REC_RESOLUTION        _IOR('i', 0x00000007, uint32_t)
-+
-+/* code length in bits, currently only for LIRC_MODE_LIRCCODE */
-+#define LIRC_GET_LENGTH                _IOR('i', 0x0000000f, uint64_t)
-+
-+#define LIRC_SET_SEND_MODE             _IOW('i', 0x00000011, uint64_t)
-+#define LIRC_SET_REC_MODE              _IOW('i', 0x00000012, uint64_t)
-+/* Note: these can reset the according pulse_width */
-+#define LIRC_SET_SEND_CARRIER          _IOW('i', 0x00000013, uint32_t)
-+#define LIRC_SET_REC_CARRIER           _IOW('i', 0x00000014, uint32_t)
-+#define LIRC_SET_SEND_DUTY_CYCLE       _IOW('i', 0x00000015, uint32_t)
-+#define LIRC_SET_REC_DUTY_CYCLE        _IOW('i', 0x00000016, uint32_t)
-+#define LIRC_SET_TRANSMITTER_MASK      _IOW('i', 0x00000017, uint32_t)
-+
-+/*
-+ * to set a range use
-+ * LIRC_SET_REC_DUTY_CYCLE_RANGE/LIRC_SET_REC_CARRIER_RANGE with the
-+ * lower bound first and later
-+ * LIRC_SET_REC_DUTY_CYCLE/LIRC_SET_REC_CARRIER with the upper bound
-+ */
-+
-+#define LIRC_SET_REC_DUTY_CYCLE_RANGE  _IOW('i', 0x0000001e, uint32_t)
-+#define LIRC_SET_REC_CARRIER_RANGE     _IOW('i', 0x0000001f, uint32_t)
-+
-+#define LIRC_NOTIFY_DECODE             _IO('i', 0x00000020)
-+
-+#endif
+diff --git a/MAINTAINERS b/MAINTAINERS
+index 47cc449..ae38439 100644
+--- a/MAINTAINERS
++++ b/MAINTAINERS
+@@ -3427,6 +3427,15 @@ F:	arch/powerpc/platforms/pasemi/
+ F:	drivers/*/*pasemi*
+ F:	drivers/*/*/*pasemi*
+ 
++LINUX INFRARED REMOTE CONTROL DRIVERS (LIRC)
++P:	Jarod Wilson
++M:	jarod at redhat.com
++P:	Christoph Bartelmus
++M:	lirc at bartelmus.de
++W:	http://www.lirc.org/
++L:	lirc-list at lists.sourceforge.net
++S:	Maintained
++
+ LINUX SECURITY MODULE (LSM) FRAMEWORK
+ M:	Chris Wright <chrisw at sous-sol.org>
+ L:	linux-security-module at vger.kernel.org
 diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
 index 07c2cd4..ebc8743 100644
 --- a/drivers/input/Kconfig
@@ -691,10 +622,10 @@ index 0000000..0485884
 +MODULE_PARM_DESC(debug, "Debug enabled or not");
 diff --git a/drivers/input/lirc/lirc_dev.c b/drivers/input/lirc/lirc_dev.c
 new file mode 100644
-index 0000000..504e122
+index 0000000..6ce81bd
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_dev.c
-@@ -0,0 +1,736 @@
+@@ -0,0 +1,749 @@
 +/*
 + * LIRC base driver
 + *
@@ -732,7 +663,6 @@ index 0000000..504e122
 +#include <linux/bitops.h>
 +#include <linux/device.h>
 +#include <linux/cdev.h>
-+#include <linux/smp_lock.h>
 +
 +#include <linux/lirc.h>
 +#include "lirc_dev.h"
@@ -1257,6 +1187,20 @@ index 0000000..504e122
 +	case LIRC_GET_LENGTH:
 +		result = put_user(ir->d.code_length, (unsigned long *)arg);
 +		break;
++	case LIRC_GET_MIN_TIMEOUT:
++		if (!(ir->d.features & LIRC_CAN_SET_REC_TIMEOUT) ||
++		    ir->d.min_timeout == 0)
++			return -ENOSYS;
++
++		result = put_user(ir->d.min_timeout, (int *) arg);
++		break;
++	case LIRC_GET_MAX_TIMEOUT:
++		if (!(ir->d.features & LIRC_CAN_SET_REC_TIMEOUT) ||
++		    ir->d.max_timeout == 0)
++			return -ENOSYS;
++
++		result = put_user(ir->d.max_timeout, (int *) arg);
++		break;
 +	default:
 +		result = -EINVAL;
 +	}
@@ -1433,10 +1377,10 @@ index 0000000..504e122
 +MODULE_PARM_DESC(debug, "Enable debugging messages");
 diff --git a/drivers/input/lirc/lirc_dev.h b/drivers/input/lirc/lirc_dev.h
 new file mode 100644
-index 0000000..99d0442
+index 0000000..56020e8
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_dev.h
-@@ -0,0 +1,225 @@
+@@ -0,0 +1,228 @@
 +/*
 + * LIRC base driver
 + *
@@ -1458,6 +1402,7 @@ index 0000000..99d0442
 +#include <linux/ioctl.h>
 +#include <linux/poll.h>
 +#include <linux/kfifo.h>
++#include <linux/lirc.h>
 +
 +struct lirc_buffer {
 +	wait_queue_head_t wait_poll;
@@ -1571,6 +1516,8 @@ index 0000000..99d0442
 +	unsigned int chunk_size;
 +
 +	void *data;
++	int min_timeout;
++	int max_timeout;
 +	int (*add_to_buf) (void *data, struct lirc_buffer *buf);
 +	struct lirc_buffer *rbuf;
 +	int (*set_use_inc) (void *data);
@@ -3033,10 +2980,10 @@ index 0000000..f3f8c2e
 +module_exit(lirc_i2c_exit);
 diff --git a/drivers/input/lirc/lirc_igorplugusb.c b/drivers/input/lirc/lirc_igorplugusb.c
 new file mode 100644
-index 0000000..599037d
+index 0000000..d1c02c2
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_igorplugusb.c
-@@ -0,0 +1,556 @@
+@@ -0,0 +1,555 @@
 +/*
 + * lirc_igorplugusb - USB remote support for LIRC
 + *
@@ -3086,7 +3033,6 @@ index 0000000..599037d
 +#include <linux/errno.h>
 +#include <linux/fs.h>
 +#include <linux/usb.h>
-+#include <linux/smp_lock.h>
 +#include <linux/time.h>
 +
 +#include <linux/lirc.h>
@@ -3595,10 +3541,10 @@ index 0000000..599037d
 +
 diff --git a/drivers/input/lirc/lirc_imon.c b/drivers/input/lirc/lirc_imon.c
 new file mode 100644
-index 0000000..5bea43b
+index 0000000..af5eec8
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_imon.c
-@@ -0,0 +1,1054 @@
+@@ -0,0 +1,1053 @@
 +/*
 + *   lirc_imon.c:  LIRC/VFD/LCD driver for SoundGraph iMON IR/VFD/LCD
 + *		   including the iMON PAD model
@@ -3790,6 +3736,7 @@ index 0000000..5bea43b
 +
 +static void free_imon_context(struct imon_context *context)
 +{
++	struct device *dev = context->driver->dev;
 +	usb_free_urb(context->tx_urb);
 +	usb_free_urb(context->rx_urb);
 +	lirc_buffer_free(context->driver->rbuf);
@@ -3797,7 +3744,7 @@ index 0000000..5bea43b
 +	kfree(context->driver);
 +	kfree(context);
 +
-+	dev_dbg(context->driver->dev, "%s: iMON context freed\n", __func__);
++	dev_dbg(dev, "%s: iMON context freed\n", __func__);
 +}
 +
 +static void deregister_from_lirc(struct imon_context *context)
@@ -4315,7 +4262,6 @@ index 0000000..5bea43b
 +	struct urb *tx_urb = NULL;
 +	struct lirc_driver *driver = NULL;
 +	struct lirc_buffer *rbuf = NULL;
-+	struct usb_interface *first_if;
 +	struct device *dev = &interface->dev;
 +	int ifnum;
 +	int lirc_minor = 0;
@@ -4327,10 +4273,16 @@ index 0000000..5bea43b
 +	int vfd_proto_6p = 0;
 +	int code_length;
 +	struct imon_context *context = NULL;
-+	struct imon_context *first_if_context = NULL;
 +	int i;
 +	u16 vendor, product;
 +
++	context = kzalloc(sizeof(struct imon_context), GFP_KERNEL);
++	if (!context) {
++		err("%s: kzalloc failed for context", __func__);
++		alloc_status = 1;
++		goto alloc_status_switch;
++	}
++
 +	/*
 +	 * Try to auto-detect the type of display if the user hasn't set
 +	 * it by hand via the display_type modparam. Default is VFD.
@@ -4355,9 +4307,6 @@ index 0000000..5bea43b
 +	/* prevent races probing devices w/multiple interfaces */
 +	mutex_lock(&driver_lock);
 +
-+	first_if = usb_ifnum_to_if(usbdev, 0);
-+	first_if_context = (struct imon_context *)usb_get_intfdata(first_if);
-+
 +	/*
 +	 * Scan the endpoint list and set:
 +	 *	first input endpoint = IR endpoint
@@ -4401,7 +4350,8 @@ index 0000000..5bea43b
 +	if (!ir_ep_found) {
 +		err("%s: no valid input (IR) endpoint found.", __func__);
 +		retval = -ENODEV;
-+		goto exit;
++		alloc_status = 2;
++		goto alloc_status_switch;
 +	}
 +
 +	/* Determine if display requires 6 packets */
@@ -4413,12 +4363,6 @@ index 0000000..5bea43b
 +			__func__, vfd_proto_6p);
 +	}
 +
-+	context = kzalloc(sizeof(struct imon_context), GFP_KERNEL);
-+	if (!context) {
-+		err("%s: kzalloc failed for context", __func__);
-+		alloc_status = 1;
-+		goto alloc_status_switch;
-+	}
 +	driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
 +	if (!driver) {
 +		err("%s: kzalloc failed for lirc_driver", __func__);
@@ -4549,7 +4493,8 @@ index 0000000..5bea43b
 +		kfree(context);
 +		context = NULL;
 +	case 1:
-+		retval = -ENOMEM;
++		if (retval != -ENODEV)
++			retval = -ENOMEM;
 +		break;
 +	case 0:
 +		retval = 0;
@@ -4655,10 +4600,10 @@ index 0000000..5bea43b
 +module_exit(imon_exit);
 diff --git a/drivers/input/lirc/lirc_it87.c b/drivers/input/lirc/lirc_it87.c
 new file mode 100644
-index 0000000..c69662d
+index 0000000..f9cdbeb
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_it87.c
-@@ -0,0 +1,991 @@
+@@ -0,0 +1,1019 @@
 +/*
 + * LIRC driver for ITE IT8712/IT8705 CIR port
 + *
@@ -4702,7 +4647,6 @@ index 0000000..c69662d
 +#include <linux/interrupt.h>
 +#include <linux/ioport.h>
 +#include <linux/kernel.h>
-+#include <linux/serial_reg.h>
 +#include <linux/time.h>
 +#include <linux/string.h>
 +#include <linux/types.h>
@@ -4716,6 +4660,7 @@ index 0000000..c69662d
 +#include <linux/fcntl.h>
 +
 +#include <linux/timer.h>
++#include <linux/pnp.h>
 +
 +#include <linux/lirc.h>
 +#include "lirc_dev.h"
@@ -4776,6 +4721,8 @@ index 0000000..c69662d
 +unsigned int rx_tail, rx_head;
 +static int tx_buf[WBUF_LEN];
 +
++static struct pnp_driver it87_pnp_driver;
++
 +/* SECTION: Prototypes */
 +
 +/* Communication with user-space */
@@ -5588,15 +5535,26 @@ index 0000000..c69662d
 +{
 +	int retval;
 +
-+	retval = init_chrdev();
++	retval = pnp_register_driver(&it87_pnp_driver);
 +	if (retval < 0)
 +		return retval;
++
++	retval = init_chrdev();
++	if (retval < 0)
++		goto init_chrdev_failed;
++
 +	retval = init_lirc_it87();
-+	if (retval) {
-+		drop_chrdev();
-+		return retval;
-+	}
++	if (retval)
++		goto init_lirc_it87_failed;
++
 +	return 0;
++
++init_lirc_it87_failed:
++	drop_chrdev();
++
++init_chrdev_failed:
++	pnp_unregister_driver(&it87_pnp_driver);
++	return retval;
 +}
 +
 +
@@ -5605,9 +5563,24 @@ index 0000000..c69662d
 +	drop_hardware();
 +	drop_chrdev();
 +	drop_port();
++	pnp_unregister_driver(&it87_pnp_driver);
 +	printk(KERN_INFO LIRC_DRIVER_NAME ": Uninstalled.\n");
 +}
 +
++/* SECTION: PNP for ITE8704/18 */
++
++static const struct pnp_device_id pnp_dev_table[] = {
++	{"ITE8704", 0},
++	{}
++};
++
++MODULE_DEVICE_TABLE(pnp, pnp_dev_table);
++
++static struct pnp_driver it87_pnp_driver = {
++	.name           = LIRC_DRIVER_NAME,
++	.id_table       = pnp_dev_table,
++};
++
 +module_init(lirc_it87_init);
 +module_exit(lirc_it87_exit);
 +
@@ -5774,7 +5747,7 @@ index 0000000..cf021c8
 +/********************************* ITE IT87xx ************************/
 diff --git a/drivers/input/lirc/lirc_ite8709.c b/drivers/input/lirc/lirc_ite8709.c
 new file mode 100644
-index 0000000..6210847
+index 0000000..4c3d3ad
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_ite8709.c
 @@ -0,0 +1,540 @@
@@ -6187,8 +6160,8 @@ index 0000000..6210847
 +	ite8709_dev->use_count = 0;
 +	ite8709_dev->irq = pnp_irq(dev, 0);
 +	ite8709_dev->io = pnp_port_start(dev, 2);
-+	ite8709_dev->hardware_lock = __SPIN_LOCK_UNLOCKED(
-+					ite8709_dev->hardware_lock);
++	ite8709_dev->hardware_lock =
++		__SPIN_LOCK_UNLOCKED(ite8709_dev->hardware_lock);
 +	ite8709_dev->acc_pulse = 0;
 +	ite8709_dev->acc_space = 0;
 +	ite8709_dev->lastbit = 0;
@@ -6320,10 +6293,10 @@ index 0000000..6210847
 +MODULE_PARM_DESC(debug, "Enable debugging messages");
 diff --git a/drivers/input/lirc/lirc_mceusb.c b/drivers/input/lirc/lirc_mceusb.c
 new file mode 100644
-index 0000000..8b404e2
+index 0000000..c8f0983
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_mceusb.c
-@@ -0,0 +1,1222 @@
+@@ -0,0 +1,1225 @@
 +/*
 + * LIRC driver for Windows Media Center Edition USB Infrared Transceivers
 + *
@@ -6488,6 +6461,8 @@ index 0000000..8b404e2
 +	{ USB_DEVICE(VENDOR_TOPSEED, 0x0008) },
 +	/* Topseed eHome Infrared Transceiver */
 +	{ USB_DEVICE(VENDOR_TOPSEED, 0x000a) },
++	/* Topseed eHome Infrared Transceiver */
++	{ USB_DEVICE(VENDOR_TOPSEED, 0x0011) },
 +	/* Ricavision internal Infrared Transceiver */
 +	{ USB_DEVICE(VENDOR_RICAVISION, 0x0010) },
 +	/* Itron ione Libra Q-11 */
@@ -6553,6 +6528,7 @@ index 0000000..8b404e2
 +	{ USB_DEVICE(VENDOR_TOPSEED, 0x0007) },
 +	{ USB_DEVICE(VENDOR_TOPSEED, 0x0008) },
 +	{ USB_DEVICE(VENDOR_TOPSEED, 0x000a) },
++	{ USB_DEVICE(VENDOR_TOPSEED, 0x0011) },
 +	{ USB_DEVICE(VENDOR_PINNACLE, 0x0225) },
 +	{}
 +};
@@ -11844,10 +11820,10 @@ index 0000000..4a471d6
 +MODULE_PARM_DESC(debug, "Enable debugging messages");
 diff --git a/drivers/input/lirc/lirc_streamzap.c b/drivers/input/lirc/lirc_streamzap.c
 new file mode 100644
-index 0000000..f4374e8
+index 0000000..87db864
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_streamzap.c
-@@ -0,0 +1,794 @@
+@@ -0,0 +1,821 @@
 +/*
 + * Streamzap Remote Control driver
 + *
@@ -11920,6 +11896,7 @@ index 0000000..f4374e8
 +
 +#define STREAMZAP_PULSE_MASK 0xf0
 +#define STREAMZAP_SPACE_MASK 0x0f
++#define STREAMZAP_TIMEOUT    0xff
 +#define STREAMZAP_RESOLUTION 256
 +
 +/* number of samples buffered */
@@ -11990,6 +11967,7 @@ index 0000000..f4374e8
 +	struct timer_list	flush_timer;
 +	int			flush;
 +	int			in_use;
++	int			timeout_enabled;
 +};
 +
 +
@@ -12138,12 +12116,14 @@ index 0000000..f4374e8
 +
 +		deltv = sz->signal_start.tv_sec-sz->signal_last.tv_sec;
 +		if (deltv > 15) {
-+			tmp = PULSE_MASK; /* really long time */
++			/* really long time */
++			tmp = LIRC_SPACE(LIRC_VALUE_MASK);
 +		} else {
 +			tmp = (int) (deltv*1000000+
 +					sz->signal_start.tv_usec -
 +					sz->signal_last.tv_usec);
 +			tmp -= sz->sum;
++			tmp = LIRC_SPACE(tmp);
 +		}
 +		dprintk("ls %u", sz->driver->minor, tmp);
 +		push(sz, (char *)&tmp);
@@ -12155,7 +12135,7 @@ index 0000000..f4374e8
 +	pulse = ((int) value) * STREAMZAP_RESOLUTION;
 +	pulse += STREAMZAP_RESOLUTION / 2;
 +	sz->sum += pulse;
-+	pulse |= PULSE_BIT;
++	pulse = LIRC_PULSE(pulse);
 +
 +	dprintk("p %u", sz->driver->minor, pulse & PULSE_MASK);
 +	push(sz, (char *)&pulse);
@@ -12175,6 +12155,7 @@ index 0000000..f4374e8
 +	space = ((int) value)*STREAMZAP_RESOLUTION;
 +	space += STREAMZAP_RESOLUTION/2;
 +	sz->sum += space;
++	space = LIRC_SPACE(space);
 +	dprintk("s %u", sz->driver->minor, space);
 +	push(sz, (char *)&space);
 +}
@@ -12243,9 +12224,16 @@ index 0000000..f4374e8
 +				sz->decoder_state = IgnorePulse;
 +				break;
 +			case FullSpace:
-+				if (sz->buf_in[i] == 0xff) {
++				if (sz->buf_in[i] == STREAMZAP_TIMEOUT) {
 +					sz->idle = 1;
 +					stop_timer(sz);
++					if (sz->timeout_enabled) {
++						int timeout =
++							LIRC_TIMEOUT
++							(STREAMZAP_TIMEOUT *
++							STREAMZAP_RESOLUTION);
++						push(sz, (char *)&timeout);
++					}
 +					flush_delay_buffer(sz);
 +				} else
 +					push_full_space(sz, sz->buf_in[i]);
@@ -12375,8 +12363,12 @@ index 0000000..f4374e8
 +	sz->driver->minor = -1;
 +	sz->driver->sample_rate = 0;
 +	sz->driver->code_length = sizeof(int) * 8;
-+	sz->driver->features = LIRC_CAN_REC_MODE2 | LIRC_CAN_GET_REC_RESOLUTION;
++	sz->driver->features = LIRC_CAN_REC_MODE2 |
++		LIRC_CAN_GET_REC_RESOLUTION |
++		LIRC_CAN_SET_REC_TIMEOUT;
 +	sz->driver->data = sz;
++	sz->driver->min_timeout = STREAMZAP_TIMEOUT * STREAMZAP_RESOLUTION;
++	sz->driver->max_timeout = STREAMZAP_TIMEOUT * STREAMZAP_RESOLUTION;
 +	sz->driver->rbuf = lirc_buf;
 +	sz->delay_buf = delay_buf;
 +	sz->driver->set_use_inc = &streamzap_use_inc;
@@ -12507,18 +12499,29 @@ index 0000000..f4374e8
 +static int streamzap_ioctl(struct inode *node, struct file *filep,
 +			   unsigned int cmd, unsigned long arg)
 +{
-+	int result;
++	int result = 0;
++	int val;
++	struct usb_streamzap *sz = lirc_get_pdata(filep);
 +
 +	switch (cmd) {
 +	case LIRC_GET_REC_RESOLUTION:
 +		result = put_user(STREAMZAP_RESOLUTION, (unsigned int *) arg);
-+		if (result)
-+			return result;
++		break;
++	case LIRC_SET_REC_TIMEOUT:
++		result = get_user(val, (int *)arg);
++		if (result == 0) {
++			if (val == STREAMZAP_TIMEOUT * STREAMZAP_RESOLUTION)
++				sz->timeout_enabled = 1;
++			else if (val == 0)
++				sz->timeout_enabled = 0;
++			else
++				result = -EINVAL;
++		}
 +		break;
 +	default:
 +		return lirc_dev_fop_ioctl(node, filep, cmd, arg);
 +	}
-+	return 0;
++	return result;
 +}
 +
 +/**
@@ -13047,10 +13050,10 @@ index 0000000..b0a4e8b
 +module_exit(ttusbir_exit_module);
 diff --git a/drivers/input/lirc/lirc_zilog.c b/drivers/input/lirc/lirc_zilog.c
 new file mode 100644
-index 0000000..3a5bc34
+index 0000000..9f73430
 --- /dev/null
 +++ b/drivers/input/lirc/lirc_zilog.c
-@@ -0,0 +1,1396 @@
+@@ -0,0 +1,1388 @@
 +/*
 + * i2c IR lirc driver for devices with zilog IR processors
 + *
@@ -14251,14 +14254,6 @@ index 0000000..3a5bc34
 +	dprintk("%s: adapter id=0x%x, client addr=0x%02x\n",
 +		__func__, adap->id, client->addr);
 +
-+	/* if this isn't an appropriate device, bail w/-ENODEV now */
-+	if (!(adap->id == I2C_HW_B_BT848 ||
-+#ifdef I2C_HW_B_HDPVR
-+	      adap->id == I2C_HW_B_HDPVR ||
-+#endif
-+	      adap->id == I2C_HW_B_CX2341X))
-+		goto out_nodev;
-+
 +	/*
 +	 * The external IR receiver is at i2c address 0x71.
 +	 * The IR transmitter is at 0x70.
@@ -14314,7 +14309,7 @@ index 0000000..3a5bc34
 +		memcpy(&ir->c_rx, client, sizeof(struct i2c_client));
 +
 +		ir->c_rx.addr = 0x71;
-+		strncpy(ir->c_rx.name, ZILOG_HAUPPAUGE_IR_RX_NAME,
++		strlcpy(ir->c_rx.name, ZILOG_HAUPPAUGE_IR_RX_NAME,
 +			I2C_NAME_SIZE);
 +
 +		/* try to fire up polling thread */
@@ -14335,7 +14330,7 @@ index 0000000..3a5bc34
 +	if (have_tx) {
 +		memcpy(&ir->c_tx, client, sizeof(struct i2c_client));
 +		ir->c_tx.addr = 0x70;
-+		strncpy(ir->c_tx.name, ZILOG_HAUPPAUGE_IR_TX_NAME,
++		strlcpy(ir->c_tx.name, ZILOG_HAUPPAUGE_IR_TX_NAME,
 +			I2C_NAME_SIZE);
 +		ir->have_tx = 1;
 +	}
@@ -14448,10 +14443,10 @@ index 0000000..3a5bc34
 +module_param(disable_tx, bool, 0644);
 +MODULE_PARM_DESC(disable_tx, "Disable the IR transmitter device");
 diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
-index 16ec523..1196110 100644
+index 23140a3..7085225 100644
 --- a/drivers/input/misc/Kconfig
 +++ b/drivers/input/misc/Kconfig
-@@ -319,4 +319,16 @@ config INPUT_PCAP
+@@ -340,4 +340,16 @@ config INPUT_PCAP
  	  To compile this driver as a module, choose M here: the
  	  module will be called pcap_keys.
  
@@ -14469,10 +14464,10 @@ index 16ec523..1196110 100644
 +
  endif
 diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
-index a8b8485..79358ff 100644
+index 7e95a5d..8918ce7 100644
 --- a/drivers/input/misc/Makefile
 +++ b/drivers/input/misc/Makefile
-@@ -13,6 +13,7 @@ obj-$(CONFIG_INPUT_CM109)		+= cm109.o
+@@ -14,6 +14,7 @@ obj-$(CONFIG_INPUT_CM109)		+= cm109.o
  obj-$(CONFIG_INPUT_COBALT_BTNS)		+= cobalt_btns.o
  obj-$(CONFIG_INPUT_DM355EVM)		+= dm355evm_keys.o
  obj-$(CONFIG_HP_SDC_RTC)		+= hp_sdc_rtc.o
@@ -14482,10 +14477,10 @@ index a8b8485..79358ff 100644
  obj-$(CONFIG_INPUT_M68K_BEEP)		+= m68kspkr.o
 diff --git a/drivers/input/misc/imon.c b/drivers/input/misc/imon.c
 new file mode 100644
-index 0000000..71223e2
+index 0000000..dfe584f
 --- /dev/null
 +++ b/drivers/input/misc/imon.c
-@@ -0,0 +1,2430 @@
+@@ -0,0 +1,2501 @@
 +/*
 + *   imon.c:	input and display driver for SoundGraph iMON IR/VFD/LCD
 + *
@@ -14770,7 +14765,11 @@ index 0000000..71223e2
 +	.minor_base	= DISPLAY_MINOR_BASE,
 +};
 +
-+/* standard imon remote key table */
++/*
++ * standard imon remote key table, which isn't really entirely
++ * "standard", as different receivers decode the same key on the
++ * same remote to different hex codes... ugh.
++ */
 +static const struct key_entry imon_remote_key_table[] = {
 +	/* keys sorted mostly by frequency of use to optimize lookups */
 +	{ KE_KEY, 0x2a8195b7, { KEY_REWIND } },
@@ -14796,11 +14795,20 @@ index 0000000..71223e2
 +	{ KE_KEY, 0x29a515b7, { KEY_LEFT } },
 +	{ KE_KEY, 0x2ba515b7, { KEY_RIGHT } },
 +
++	{ KE_KEY, 0x690281b7, { KEY_UP } },
++	{ KE_KEY, 0x688291b7, { KEY_DOWN } },
++	{ KE_KEY, 0x6a8281b7, { KEY_LEFT } },
++	{ KE_KEY, 0x688a81b7, { KEY_RIGHT } },
++
 +	{ KE_KEY, 0x0200002c, { KEY_SPACE } }, /* Select/Space */
++	{ KE_KEY, 0x2a9315b7, { KEY_SPACE } }, /* Select/Space */
 +	{ KE_KEY, 0x02000028, { KEY_ENTER } },
++	{ KE_KEY, 0x28a195b7, { KEY_ENTER } },
 +	{ KE_KEY, 0x288195b7, { KEY_EXIT } },
 +	{ KE_KEY, 0x02000029, { KEY_ESC } },
++	{ KE_KEY, 0x2bb715b7, { KEY_ESC } },
 +	{ KE_KEY, 0x0200002a, { KEY_BACKSPACE } },
++	{ KE_KEY, 0x28a115b7, { KEY_BACKSPACE } },
 +
 +	{ KE_KEY, 0x2b9595b7, { KEY_MUTE } },
 +	{ KE_KEY, 0x28a395b7, { KEY_VOLUMEUP } },
@@ -14819,8 +14827,21 @@ index 0000000..71223e2
 +	{ KE_KEY, 0x02000026, { KEY_NUMERIC_9 } },
 +	{ KE_KEY, 0x02000027, { KEY_NUMERIC_0 } },
 +
++	{ KE_KEY, 0x28b595b7, { KEY_NUMERIC_1 } },
++	{ KE_KEY, 0x2bb195b7, { KEY_NUMERIC_2 } },
++	{ KE_KEY, 0x28b195b7, { KEY_NUMERIC_3 } },
++	{ KE_KEY, 0x2a8595b7, { KEY_NUMERIC_4 } },
++	{ KE_KEY, 0x299595b7, { KEY_NUMERIC_5 } },
++	{ KE_KEY, 0x2aa595b7, { KEY_NUMERIC_6 } },
++	{ KE_KEY, 0x2b9395b7, { KEY_NUMERIC_7 } },
++	{ KE_KEY, 0x2a8515b7, { KEY_NUMERIC_8 } },
++	{ KE_KEY, 0x2aa115b7, { KEY_NUMERIC_9 } },
++	{ KE_KEY, 0x2ba595b7, { KEY_NUMERIC_0 } },
++
 +	{ KE_KEY, 0x02200025, { KEY_NUMERIC_STAR } },
++	{ KE_KEY, 0x28b515b7, { KEY_NUMERIC_STAR } },
 +	{ KE_KEY, 0x02200020, { KEY_NUMERIC_POUND } },
++	{ KE_KEY, 0x29a115b7, { KEY_NUMERIC_POUND } },
 +
 +	{ KE_KEY, 0x2b8515b7, { KEY_VIDEO } },
 +	{ KE_KEY, 0x299195b7, { KEY_AUDIO } },
@@ -14848,6 +14869,8 @@ index 0000000..71223e2
 +	{ KE_KEY, 0x01020000, { BTN_RIGHT } },
 +	{ KE_KEY, 0x01010080, { BTN_LEFT } },
 +	{ KE_KEY, 0x01020080, { BTN_RIGHT } },
++	{ KE_KEY, 0x688301b7, { BTN_LEFT } },
++	{ KE_KEY, 0x688481b7, { BTN_RIGHT } },
 +
 +	{ KE_KEY, 0x2a9395b7, { KEY_CYCLEWINDOWS } }, /* TaskSwitcher */
 +	{ KE_KEY, 0x2b8395b7, { KEY_TIME } }, /* Timer */
@@ -14857,8 +14880,10 @@ index 0000000..71223e2
 +	{ KE_KEY, 0x299395b7, { KEY_EJECTCLOSECD } }, /* eject (by TaskSw) */
 +
 +	{ KE_KEY, 0x02800000, { KEY_MENU } }, /* Left Menu */
++	{ KE_KEY, 0x2b8195b7, { KEY_MENU } }, /* Left Menu*/
 +	{ KE_KEY, 0x02000065, { KEY_COMPOSE } }, /* RightMenu */
-+	{ KE_KEY, 0x2ab195b7, { KEY_PROG1 } }, /* Go */
++	{ KE_KEY, 0x28b715b7, { KEY_COMPOSE } }, /* RightMenu */
++	{ KE_KEY, 0x2ab195b7, { KEY_PROG1 } }, /* Go or MultiMon */
 +	{ KE_KEY, 0x29b715b7, { KEY_DASHBOARD } }, /* AppLauncher */
 +	{ KE_END, 0 }
 +};
@@ -14873,7 +14898,6 @@ index 0000000..71223e2
 +
 +	{ KE_KEY, 0x800f8416, { KEY_PLAY } },
 +	{ KE_KEY, 0x800f8418, { KEY_PAUSE } },
-+	{ KE_KEY, 0x800f8418, { KEY_PAUSE } },
 +	{ KE_KEY, 0x800f8419, { KEY_STOP } },
 +	{ KE_KEY, 0x800f8417, { KEY_RECORD } },
 +
@@ -14882,11 +14906,20 @@ index 0000000..71223e2
 +	{ KE_KEY, 0x02000050, { KEY_LEFT } },
 +	{ KE_KEY, 0x0200004f, { KEY_RIGHT } },
 +
++	{ KE_KEY, 0x800f841e, { KEY_UP } },
++	{ KE_KEY, 0x800f841f, { KEY_DOWN } },
++	{ KE_KEY, 0x800f8420, { KEY_LEFT } },
++	{ KE_KEY, 0x800f8421, { KEY_RIGHT } },
++
++	{ KE_KEY, 0x800f840b, { KEY_ENTER } },
 +	{ KE_KEY, 0x02000028, { KEY_ENTER } },
-+/* the OK and Enter buttons decode to the same value
++/* the OK and Enter buttons decode to the same value on some remotes
 +	{ KE_KEY, 0x02000028, { KEY_OK } }, */
++	{ KE_KEY, 0x800f8422, { KEY_OK } },
 +	{ KE_KEY, 0x0200002a, { KEY_EXIT } },
++	{ KE_KEY, 0x800f8423, { KEY_EXIT } },
 +	{ KE_KEY, 0x02000029, { KEY_DELETE } },
++	{ KE_KEY, 0x800f840a, { KEY_DELETE } },
 +
 +	{ KE_KEY, 0x800f840e, { KEY_MUTE } },
 +	{ KE_KEY, 0x800f8410, { KEY_VOLUMEUP } },
@@ -14905,8 +14938,21 @@ index 0000000..71223e2
 +	{ KE_KEY, 0x02000026, { KEY_NUMERIC_9 } },
 +	{ KE_KEY, 0x02000027, { KEY_NUMERIC_0 } },
 +
++	{ KE_KEY, 0x800f8401, { KEY_NUMERIC_1 } },
++	{ KE_KEY, 0x800f8402, { KEY_NUMERIC_2 } },
++	{ KE_KEY, 0x800f8403, { KEY_NUMERIC_3 } },
++	{ KE_KEY, 0x800f8404, { KEY_NUMERIC_4 } },
++	{ KE_KEY, 0x800f8405, { KEY_NUMERIC_5 } },
++	{ KE_KEY, 0x800f8406, { KEY_NUMERIC_6 } },
++	{ KE_KEY, 0x800f8407, { KEY_NUMERIC_7 } },
++	{ KE_KEY, 0x800f8408, { KEY_NUMERIC_8 } },
++	{ KE_KEY, 0x800f8409, { KEY_NUMERIC_9 } },
++	{ KE_KEY, 0x800f8400, { KEY_NUMERIC_0 } },
++
 +	{ KE_KEY, 0x02200025, { KEY_NUMERIC_STAR } },
 +	{ KE_KEY, 0x02200020, { KEY_NUMERIC_POUND } },
++	{ KE_KEY, 0x800f841d, { KEY_NUMERIC_STAR } },
++	{ KE_KEY, 0x800f841c, { KEY_NUMERIC_POUND } },
 +
 +	{ KE_KEY, 0x800f8446, { KEY_TV } },
 +	{ KE_KEY, 0x800f8447, { KEY_AUDIO } },
@@ -14915,6 +14961,7 @@ index 0000000..71223e2
 +	{ KE_KEY, 0x800f844a, { KEY_VIDEO } },
 +	{ KE_KEY, 0x800f8424, { KEY_DVD } },
 +	{ KE_KEY, 0x800f8425, { KEY_TUNER } }, /* LiveTV */
++	{ KE_KEY, 0x800f8450, { KEY_RADIO } },
 +
 +	{ KE_KEY, 0x800f845b, { KEY_RED } },
 +	{ KE_KEY, 0x800f845c, { KEY_GREEN } },
@@ -14936,25 +14983,25 @@ index 0000000..71223e2
 +	u64 hw_code;
 +	u16 keycode;
 +} imon_panel_key_table[] = {
-+	{ 0x000000000f000fee, KEY_PROG1 }, /* Go */
-+	{ 0x000000001f000fee, KEY_AUDIO },
-+	{ 0x0000000020000fee, KEY_VIDEO },
-+	{ 0x0000000021000fee, KEY_CAMERA },
-+	{ 0x0000000027000fee, KEY_DVD },
++	{ 0x000000000f00ffee, KEY_PROG1 }, /* Go */
++	{ 0x000000001f00ffee, KEY_AUDIO },
++	{ 0x000000002000ffee, KEY_VIDEO },
++	{ 0x000000002100ffee, KEY_CAMERA },
++	{ 0x000000002700ffee, KEY_DVD },
 +/* the TV key on my panel is broken, doesn't work under any OS
-+	{ 0x0000000000000fee, KEY_TV }, */
-+	{ 0x0000000005000fee, KEY_PREVIOUS },
-+	{ 0x0000000007000fee, KEY_REWIND },
-+	{ 0x0000000004000fee, KEY_STOP },
-+	{ 0x000000003c000fee, KEY_PLAYPAUSE },
-+	{ 0x0000000008000fee, KEY_FASTFORWARD },
-+	{ 0x0000000006000fee, KEY_NEXT },
-+	{ 0x0000000100000fee, KEY_RIGHT },
-+	{ 0x0000010000000fee, KEY_LEFT },
-+	{ 0x000000003d000fee, KEY_SELECT },
-+	{ 0x0001000000000fee, KEY_VOLUMEUP },
-+	{ 0x0100000000000fee, KEY_VOLUMEDOWN },
-+	{ 0x0000000001000fee, KEY_MUTE },
++	{ 0x000000000000ffee, KEY_TV }, */
++	{ 0x000000000500ffee, KEY_PREVIOUS },
++	{ 0x000000000700ffee, KEY_REWIND },
++	{ 0x000000000400ffee, KEY_STOP },
++	{ 0x000000003c00ffee, KEY_PLAYPAUSE },
++	{ 0x000000000800ffee, KEY_FASTFORWARD },
++	{ 0x000000000600ffee, KEY_NEXT },
++	{ 0x000000010000ffee, KEY_RIGHT },
++	{ 0x000001000000ffee, KEY_LEFT },
++	{ 0x000000003d00ffee, KEY_SELECT },
++	{ 0x000100000000ffee, KEY_VOLUMEUP },
++	{ 0x010000000000ffee, KEY_VOLUMEDOWN },
++	{ 0x000000000100ffee, KEY_MUTE },
 +};
 +
 +/* to prevent races between open() and disconnect(), probing, etc */
@@ -15784,13 +15831,17 @@ index 0000000..71223e2
 +	int i;
 +	u32 code = be32_to_cpu(hw_code);
 +
-+	for (i = 0; i < ARRAY_SIZE(imon_mce_key_table); i++)
-+		if (imon_mce_key_table[i].code == code)
-+			return i;
++#define TOGGLE_BIT 0x8000
 +
-+	for (i = 0; i < ARRAY_SIZE(imon_mce_key_table); i++)
-+		if (imon_mce_key_table[i].code == (code | 0x8000))
-+			return i;
++	if (((code >> 24) & 0x02) || (code & TOGGLE_BIT)) {
++		for (i = 0; i < ARRAY_SIZE(imon_mce_key_table); i++)
++			if (imon_mce_key_table[i].code == code)
++				return i;
++	} else {
++		for (i = 0; i < ARRAY_SIZE(imon_mce_key_table); i++)
++			if (imon_mce_key_table[i].code == (code | TOGGLE_BIT))
++				return i;
++	}
 +
 +	return -1;
 +}
@@ -15801,7 +15852,7 @@ index 0000000..71223e2
 +	u64 code = be64_to_cpu(hw_code);
 +
 +	for (i = 0; i < ARRAY_SIZE(imon_panel_key_table); i++)
-+		if (imon_panel_key_table[i].hw_code == (code | 0xfee))
++		if (imon_panel_key_table[i].hw_code == (code | 0xffee))
 +			return i;
 +
 +	return -1;
@@ -16062,6 +16113,8 @@ index 0000000..71223e2
 +		ksrc = IMON_BUTTON_PANEL;
 +		panel_key = le64_to_cpu(temp_key);
 +		ki = imon_panel_key_lookup(panel_key);
++		if (ki < 0)
++			goto unknown_key;
 +		kc = imon_panel_key_table[ki].keycode;
 +	} else {
 +		remote_key = (u32) (le64_to_cpu(temp_key) & 0xffffffff);
@@ -16069,9 +16122,13 @@ index 0000000..71223e2
 +			if (buf[0] == 0x80)
 +				ksrc = IMON_BUTTON_MCE;
 +			ki = imon_mce_key_lookup(remote_key);
++			if (ki < 0)
++				goto unknown_key;
 +			kc = imon_mce_key_table[ki].keycode;
 +		} else {
 +			ki = imon_remote_key_lookup(remote_key);
++			if (ki < 0)
++				goto unknown_key;
 +			kc = imon_remote_key_table[ki % offset].keycode;
 +		}
 +	}
@@ -16147,6 +16204,15 @@ index 0000000..71223e2
 +
 +	return;
 +
++unknown_key:
++	/* filter out junk data on the older 0xffdc imon devices */
++	if ((buf[0] == 0xff) && (buf[7] == 0xff))
++		return;
++
++	dev_info(dev, "%s: unknown keypress, code 0x%x\n", __func__,
++		 (panel_key ? panel_key : remote_key));
++	return;
++
 +not_input_data:
 +	if (len != 8) {
 +		dev_warn(dev, "imon %s: invalid incoming packet "
@@ -16916,3 +16982,168 @@ index 0000000..71223e2
 +
 +module_init(imon_init);
 +module_exit(imon_exit);
+diff --git a/include/linux/lirc.h b/include/linux/lirc.h
+new file mode 100644
+index 0000000..74535b3
+--- /dev/null
++++ b/include/linux/lirc.h
+@@ -0,0 +1,159 @@
++/*
++ * lirc.h - linux infrared remote control header file
++ * last modified 2007/09/27
++ */
++
++#ifndef _LINUX_LIRC_H
++#define _LINUX_LIRC_H
++
++#include <linux/types.h>
++#include <linux/ioctl.h>
++
++/* <obsolete> */
++#define PULSE_BIT       0x01000000
++#define PULSE_MASK      0x00FFFFFF
++/* </obsolete> */
++
++#define LIRC_MODE2_SPACE     0x00000000
++#define LIRC_MODE2_PULSE     0x01000000
++#define LIRC_MODE2_FREQUENCY 0x02000000
++#define LIRC_MODE2_TIMEOUT   0x03000000
++
++#define LIRC_VALUE_MASK      0x00FFFFFF
++#define LIRC_MODE2_MASK      0xFF000000
++
++#define LIRC_SPACE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_SPACE)
++#define LIRC_PULSE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_PULSE)
++#define LIRC_FREQUENCY(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY)
++#define LIRC_TIMEOUT(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT)
++
++#define LIRC_VALUE(val) ((val)&LIRC_VALUE_MASK)
++#define LIRC_MODE2(val) ((val)&LIRC_MODE2_MASK)
++
++#define LIRC_IS_SPACE(val) (LIRC_MODE2(val) == LIRC_MODE2_SPACE)
++#define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE)
++#define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY)
++#define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT)
++
++/*** lirc compatible hardware features ***/
++
++#define LIRC_MODE2SEND(x) (x)
++#define LIRC_SEND2MODE(x) (x)
++#define LIRC_MODE2REC(x) ((x) << 16)
++#define LIRC_REC2MODE(x) ((x) >> 16)
++
++#define LIRC_MODE_RAW                  0x00000001
++#define LIRC_MODE_PULSE                0x00000002
++#define LIRC_MODE_MODE2                0x00000004
++#define LIRC_MODE_LIRCCODE             0x00000010
++
++
++#define LIRC_CAN_SEND_RAW              LIRC_MODE2SEND(LIRC_MODE_RAW)
++#define LIRC_CAN_SEND_PULSE            LIRC_MODE2SEND(LIRC_MODE_PULSE)
++#define LIRC_CAN_SEND_MODE2            LIRC_MODE2SEND(LIRC_MODE_MODE2)
++#define LIRC_CAN_SEND_LIRCCODE         LIRC_MODE2SEND(LIRC_MODE_LIRCCODE)
++
++#define LIRC_CAN_SEND_MASK             0x0000003f
++
++#define LIRC_CAN_SET_SEND_CARRIER      0x00000100
++#define LIRC_CAN_SET_SEND_DUTY_CYCLE   0x00000200
++#define LIRC_CAN_SET_TRANSMITTER_MASK  0x00000400
++
++#define LIRC_CAN_REC_RAW               LIRC_MODE2REC(LIRC_MODE_RAW)
++#define LIRC_CAN_REC_PULSE             LIRC_MODE2REC(LIRC_MODE_PULSE)
++#define LIRC_CAN_REC_MODE2             LIRC_MODE2REC(LIRC_MODE_MODE2)
++#define LIRC_CAN_REC_LIRCCODE          LIRC_MODE2REC(LIRC_MODE_LIRCCODE)
++
++#define LIRC_CAN_REC_MASK              LIRC_MODE2REC(LIRC_CAN_SEND_MASK)
++
++#define LIRC_CAN_SET_REC_CARRIER       (LIRC_CAN_SET_SEND_CARRIER << 16)
++#define LIRC_CAN_SET_REC_DUTY_CYCLE    (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16)
++
++#define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000
++#define LIRC_CAN_SET_REC_CARRIER_RANGE    0x80000000
++#define LIRC_CAN_GET_REC_RESOLUTION       0x20000000
++#define LIRC_CAN_SET_REC_TIMEOUT          0x10000000
++#define LIRC_CAN_SET_REC_FILTER           0x08000000
++
++#define LIRC_CAN_MEASURE_CARRIER          0x02000000
++
++#define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK)
++#define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK)
++
++#define LIRC_CAN_NOTIFY_DECODE            0x01000000
++
++/*** IOCTL commands for lirc driver ***/
++
++#define LIRC_GET_FEATURES              _IOR('i', 0x00000000, uint64_t)
++
++#define LIRC_GET_SEND_MODE             _IOR('i', 0x00000001, uint64_t)
++#define LIRC_GET_REC_MODE              _IOR('i', 0x00000002, uint64_t)
++#define LIRC_GET_SEND_CARRIER          _IOR('i', 0x00000003, uint32_t)
++#define LIRC_GET_REC_CARRIER           _IOR('i', 0x00000004, uint32_t)
++#define LIRC_GET_SEND_DUTY_CYCLE       _IOR('i', 0x00000005, uint32_t)
++#define LIRC_GET_REC_DUTY_CYCLE        _IOR('i', 0x00000006, uint32_t)
++#define LIRC_GET_REC_RESOLUTION        _IOR('i', 0x00000007, uint32_t)
++
++#define LIRC_GET_MIN_TIMEOUT           _IOR('i', 0x00000008, uint32_t)
++#define LIRC_GET_MAX_TIMEOUT           _IOR('i', 0x00000009, uint32_t)
++
++#define LIRC_GET_MIN_FILTER_PULSE      _IOR('i', 0x0000000a, uint32_t)
++#define LIRC_GET_MAX_FILTER_PULSE      _IOR('i', 0x0000000b, uint32_t)
++#define LIRC_GET_MIN_FILTER_SPACE      _IOR('i', 0x0000000c, uint32_t)
++#define LIRC_GET_MAX_FILTER_SPACE      _IOR('i', 0x0000000d, uint32_t)
++
++/* code length in bits, currently only for LIRC_MODE_LIRCCODE */
++#define LIRC_GET_LENGTH                _IOR('i', 0x0000000f, uint64_t)
++
++#define LIRC_SET_SEND_MODE             _IOW('i', 0x00000011, uint64_t)
++#define LIRC_SET_REC_MODE              _IOW('i', 0x00000012, uint64_t)
++/* Note: these can reset the according pulse_width */
++#define LIRC_SET_SEND_CARRIER          _IOW('i', 0x00000013, uint32_t)
++#define LIRC_SET_REC_CARRIER           _IOW('i', 0x00000014, uint32_t)
++#define LIRC_SET_SEND_DUTY_CYCLE       _IOW('i', 0x00000015, uint32_t)
++#define LIRC_SET_REC_DUTY_CYCLE        _IOW('i', 0x00000016, uint32_t)
++#define LIRC_SET_TRANSMITTER_MASK      _IOW('i', 0x00000017, uint32_t)
++
++/*
++ * when a timeout != 0 is set the driver will send a
++ * LIRC_MODE2_TIMEOUT data packet, otherwise LIRC_MODE2_TIMEOUT is
++ * never sent, timeout is disabled by default
++ */
++#define LIRC_SET_REC_TIMEOUT           _IOW('i', 0x00000018, uint32_t)
++
++/*
++ * pulses shorter than this are filtered out by hardware (software
++ * emulation in lirc_dev?)
++ */
++#define LIRC_SET_REC_FILTER_PULSE      _IOW('i', 0x00000019, uint32_t)
++/*
++ * spaces shorter than this are filtered out by hardware (software
++ * emulation in lirc_dev?)
++ */
++#define LIRC_SET_REC_FILTER_SPACE      _IOW('i', 0x0000001a, uint32_t)
++/*
++ * if filter cannot be set independantly for pulse/space, this should
++ * be used
++ */
++#define LIRC_SET_REC_FILTER            _IOW('i', 0x0000001b, uint32_t)
++
++/*
++ * to set a range use
++ * LIRC_SET_REC_DUTY_CYCLE_RANGE/LIRC_SET_REC_CARRIER_RANGE with the
++ * lower bound first and later
++ * LIRC_SET_REC_DUTY_CYCLE/LIRC_SET_REC_CARRIER with the upper bound
++ */
++
++#define LIRC_SET_REC_DUTY_CYCLE_RANGE  _IOW('i', 0x0000001e, uint32_t)
++#define LIRC_SET_REC_CARRIER_RANGE     _IOW('i', 0x0000001f, uint32_t)
++
++#define LIRC_NOTIFY_DECODE             _IO('i', 0x00000020)
++
++/*
++ * from the next key press on the driver will send
++ * LIRC_MODE2_FREQUENCY packets
++ */
++#define LIRC_MEASURE_CARRIER_ENABLE    _IO('i', 0x00000021)
++#define LIRC_MEASURE_CARRIER_DISABLE   _IO('i', 0x00000022)
++
++#endif



More information about the scm-commits mailing list