Skip to contentSkip to conversation

Input update

GIT PULL New Vojtech Pavlik 1 participant 27 messages Sep 10, 2005

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

Hello Linus,

Here comes another input update, mostly fixes/workarounds to get oddball hardware work nicely and cleanups.

Dmitry put all the patches into a GIT repository, ready for you to pull:

rsync://rsync.kernel.org/pub/scm/linux/kernel/git/dtor/input.git

The diffstat and list of changes follows:

----

 b/Documentation/kernel-parameters.txt            |    1 
 b/drivers/char/keyboard.c                        |    2 
 b/drivers/input/evdev.c                          |    2 
 b/drivers/input/joystick/iforce/iforce-packets.c |   32 --
 b/drivers/input/joystick/iforce/iforce-usb.c     |    1 
 b/drivers/input/keyboard/atkbd.c                 |   10 
 b/drivers/input/keyboard/sunkbd.c                |    2 
 b/drivers/input/mouse/Makefile                   |    2 
 b/drivers/input/mouse/alps.c                     |    2 
 b/drivers/input/mouse/logips2pp.c                |   12 
 b/drivers/input/mouse/psmouse-base.c             |   15 +
 b/drivers/input/mouse/psmouse.h                  |    1 
 b/drivers/input/mouse/trackpoint.c               |  297 +++++++++++++++++++++++
 b/drivers/input/mouse/trackpoint.h               |  147 +++++++++++
 b/drivers/input/serio/i8042-io.h                 |    6 
 b/drivers/input/serio/i8042-ip22io.h             |    2 
 b/drivers/input/serio/i8042-jazzio.h             |    2 
 b/drivers/input/serio/i8042-sparcio.h            |   12 
 b/drivers/input/serio/i8042-x86ia64io.h          |   22 -
 b/drivers/input/serio/i8042.c                    |  174 +++++++------
 b/drivers/usb/input/hid-core.c                   |   62 +++-
 b/drivers/usb/input/hid-debug.h                  |   17 +
 b/drivers/usb/input/hid-input.c                  |    1 
 b/drivers/usb/input/hid.h                        |    1 
 b/drivers/usb/input/hiddev.c                     |    1 
 b/include/linux/input.h                          |    8 
 drivers/char/keyboard.c                          |  109 ++++----
 drivers/input/mouse/logips2pp.c                  |    1 
 drivers/input/mouse/psmouse-base.c               |  117 +++++----
 drivers/input/mouse/psmouse.h                    |   49 ++-
 drivers/input/mouse/trackpoint.c                 |  183 +++++++-------
 drivers/input/serio/i8042-x86ia64io.h            |   50 ++-
 drivers/input/serio/i8042.c                      |   33 +-
 drivers/usb/input/hid-core.c                     |   11 
 drivers/usb/input/hid-debug.h                    |   17 -
 drivers/usb/input/hid-input.c                    |   71 ++++-
 drivers/usb/input/hid.h                          |   12 
 37 files changed, 1081 insertions(+), 406 deletions(-)

----

author Dmitry Torokhov <[email protected]> 1126371882 -0500 committer Dmitry Torokhov <[email protected]> 1126371882 -0500

Input: i8042 - use kzalloc instead of kcalloc

--------------------------
author Dmitry Torokhov <[email protected]> 1126371818 -0500 committer Dmitry Torokhov <[email protected]> 1126371818 -0500

Input: clean up whitespace and formatting in drivers/char/keyboard.c

--------------------------
author Stefan Nickl <[email protected]> 1125903466 -0500 committer Dmitry Torokhov <[email protected]> 1125903466 -0500

Input: HIDDEV - make HIDIOCSREPORT wait IO completion

When trying to make the hiddev driver issue several Set_Report control transfers to a custom device with 2.6.13-rc6, only the first transfer in a row is carried out, while others immediately following it are silently dropped.

This happens where hid_submit_report() (in hid-core.c) tests for HID_CTRL_RUNNING, which seems to be still set because the first transfer is not finished yet.

As a workaround, inserting a delay between the two calls to ioctl(HIDIOCSREPORT) in userspace "solves" the problem. The straightforward fix is to add a call to hid_wait_io() to the implementation of HIDIOCSREPORT (in hiddev.c), just like for HIDIOCGREPORT. Works fine for me.

Apparently, this issue has some history:
http://marc.theaimsgroup.com/?l=linux-usb-users&m=111100670105558&w=2

--------------------------
author Brian Schau <[email protected]> 1125903461 -0500 committer Dmitry Torokhov <[email protected]> 1125903461 -0500

Input: HID - add Wireless Security Lock to HID blacklist

The device is a Wireless Security Lock (WSL). The device identifies itself as a Cypress Ultra Mouse. It is, however, not a mouse at all and as such, shouldn't be handled as one.

--------------------------
author Stelian Pop <[email protected]> 1125903453 -0500 committer Dmitry Torokhov <[email protected]> 1125903453 -0500

Input: HID - add mapping for Powerbook USB keyboard

Map custom HID events (such as the ones generated by some Logitech and Apple Powerbooks USB keyboards) to the FN keycode.

--------------------------
author Vojtech Pavlik <[email protected]> 1125897212 -0500 committer Dmitry Torokhov <[email protected]> 1125897212 -0500

Input: HID - add the Trust Predator TH 400 gamepad to the badpad list

--------------------------
author Vojtech Pavlik <[email protected]> 1125897195 -0500 committer Dmitry Torokhov <[email protected]> 1125897195 -0500

Input: HID - add a quirk for the Apple Powermouse

Add a quirk for the Apple Powermouse, remapping GenericDesktop.Z to Rel.HWheel, to allow horizontal scrolling in Linux.

--------------------------
author Vojtech Pavlik <[email protected]> 1125897183 -0500 committer Dmitry Torokhov <[email protected]> 1125897183 -0500

Input: HID - fix URB success status handling

Add a missing break; statement to the URB status handling in hid-core.c, avoiding flushing the request queue on success.

--------------------------
author Vojtech Pavlik <[email protected]> 1125897167 -0500 committer Dmitry Torokhov <[email protected]> 1125897167 -0500

Input: sunkbd - extend mapping to handle Type-6 Sun keyboards

Map an unmarked key at 'Esc' position to KEY_MACRO

--------------------------
author Vojtech Pavlik <[email protected]> 1125897159 -0500 committer Dmitry Torokhov <[email protected]> 1125897159 -0500

Input: iforce - use wait_event_interruptible_timeout

The timeout while() loops in iforce-packets.c lack a set_current_state(TASK_INTERRUPTIBLE); call. The right solution is to replace them with wait_event_interruptible_timeout().

--------------------------
author Micah F. Galizia <[email protected]> 1125897135 -0500 committer Dmitry Torokhov <[email protected]> 1125897135 -0500

Input: HID - add support for Logitech UltraX Media Remote control

The hid now supports the Logitech UltraX Media Remote control. For now, ID 45 on the consumer usage page has been incorrectly mapped to KEY_RADIO since no other devices uses it.

--------------------------
author Michael Haboustak <[email protected]> 1125897121 -0500 committer Dmitry Torokhov <[email protected]> 1125897121 -0500

Input: HID - handle multi-transascion reports

Fixes handling of multi-transaction reports for HID devices. New function hid_size_buffers() that calculates the longest report for each endpoint and stores the result in the hid_device object. These lengths are used to allocate buffers that are large enough to store any report on the endpoint. For compatibility, the minimum size for an endpoint buffer set to HID_BUFFER_SIZE rather than the known optimal case (the longest report length).

It fixes bug #3063 in bugzilla.

I simplified the patch a bit to use just a single buffer size.

--------------------------
author Vojtech Pavlik <[email protected]> 1125897101 -0500 committer Dmitry Torokhov <[email protected]> 1125897101 -0500

Input: atkbd - handle keyboards generating scancode 0x7f

Extend bat_xl handling to do err_xl handling, so that keyboards using 0x7f scancode for regular keys can work.

--------------------------
author Vojtech Pavlik <[email protected]> 1125896888 -0500 committer Dmitry Torokhov <[email protected]> 1125896888 -0500

Input: HID - add more consumer usages

Extend mapping of the consumer usage page in hid-input.c to handle more cases appearing on new USB keyboards.

--------------------------
author Vojtech Pavlik <[email protected]> 1125896879 -0500 committer Dmitry Torokhov <[email protected]> 1125896879 -0500

Input: add HID simulation mappings

Add simulation usage page mappings to hid-input.c to support a new crop of joysticks using them to designate Rudder and Throttle controls.

--------------------------
author Vojtech Pavlik <[email protected]> 1125896857 -0500 committer Dmitry Torokhov <[email protected]> 1125896857 -0500

Inpur: recognize and ignore Logitech vendor usages in HID

These get in our way with MX mice.

--------------------------
author Dmitry Torokhov <[email protected]> 1125816130 -0500 committer Dmitry Torokhov <[email protected]> 1125816130 -0500

Input: i8042 - add Lifebook E4010 to MUX blacklist

--------------------------
author Dmitry Torokhov <[email protected]> 1125816120 -0500 committer Dmitry Torokhov <[email protected]> 1125816120 -0500

Input: i8042 - add i8042.nokbd module option to allow supressing
creation of keyboard port.

--------------------------
author Dmitry Torokhov <[email protected]> 1125816111 -0500 committer Dmitry Torokhov <[email protected]> 1125816111 -0500

Input: i8042 - fix IRQ printing when either KBD or AUX port
is absent from ACPI/PNP tables.

--------------------------
author Dmitry Torokhov <[email protected]> 1125816098 -0500 committer Dmitry Torokhov <[email protected]> 1125816098 -0500

Input: make i8042_platform_init return 'real' error code

--------------------------
author Dmitry Torokhov <[email protected]> 1125816087 -0500 committer Dmitry Torokhov <[email protected]> 1125816087 -0500

Input: i8042 - clean up initialization code; abort if we
can't create all ports.

--------------------------
author Ian Campbell <[email protected]> 1125816074 -0500 committer Dmitry Torokhov <[email protected]> 1125816074 -0500

Input: fix checking whether new keycode fits size-wise

When dev->keycodesize == sizeof(int) the old code produces incorrect result.

--------------------------
author Vojtech Pavlik <[email protected]> 1125816055 -0500 committer Dmitry Torokhov <[email protected]> 1125816055 -0500

Input: psmouse - add new Logitech wheel mouse model

--------------------------
author Vojtech Pavlik <[email protected]> 1125816043 -0500 committer Dmitry Torokhov <[email protected]> 1125816043 -0500

Input: ALPS - fix wheel decoding

--------------------------
author Dmitry Torokhov <[email protected]> 1125816020 -0500 committer Dmitry Torokhov <[email protected]> 1125816020 -0500

Input: rework psmouse attributes to reduce module size

Rearrange attribute code to use generic show and set handlers instead of replicating them for every attribute; switch to using attribute_group instead of creating all attributes manually. All this saves about 4K.

--------------------------
author Stephen Evanchik <[email protected]> 1123482378 -0500 committer Dmitry Torokhov <[email protected]> 1123482378 -0500

Input: psmouse - add support for IBM TrackPoint devices.

--------------------------

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR
#1 lore raw

PATCH 1/26 psmouse - add support for IBM TrackPoint devices.

Subject: [PATCH] Input: psmouse - add support for IBM TrackPoint devices.
From: Stephen Evanchik <[email protected]>
Date: 1123482378 -0500

---

 drivers/input/mouse/Makefile       |    2 
 drivers/input/mouse/psmouse-base.c |   15 ++
 drivers/input/mouse/psmouse.h      |    1 
 drivers/input/mouse/trackpoint.c   |  297 ++++++++++++++++++++++++++++++++++++
 drivers/input/mouse/trackpoint.h   |  147 ++++++++++++++++++
 5 files changed, 460 insertions(+), 2 deletions(-)
 create mode 100644 drivers/input/mouse/trackpoint.c
 create mode 100644 drivers/input/mouse/trackpoint.h

541e316aed6f7d6efeb427a88645c2a8f61418d6

drivers/input/mouse/Makefile +1 -1
@@ -15,4 +15,4 @@ obj-$(CONFIG_MOUSE_SERIAL)	+= sermouse.o
 obj-$(CONFIG_MOUSE_HIL)		+= hil_ptr.o
 obj-$(CONFIG_MOUSE_VSXXXAA)	+= vsxxxaa.o
 
-psmouse-objs  := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o
+psmouse-objs  := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o trackpoint.o
drivers/input/mouse/psmouse-base.c +14 -1
@@ -25,6 +25,7 @@
 #include "logips2pp.h"
 #include "alps.h"
 #include "lifebook.h"
+#include "trackpoint.h"
 
 #define DRIVER_DESC	"PS/2 mouse driver"
 
@@ -520,6 +521,12 @@ static int psmouse_extensions(struct psm
 		return PSMOUSE_IMPS;
 
 /*
+ * Try to initialize the IBM TrackPoint
+ */
+	if (max_proto > PSMOUSE_IMEX && trackpoint_detect(psmouse, set_properties) == 0)
+		return PSMOUSE_TRACKPOINT;
+
+/*
  * Okay, all failed, we have a standard mouse here. The number of the buttons
  * is still a question, though. We assume 3.
  */
@@ -600,6 +607,12 @@ static struct psmouse_protocol psmouse_p
 		.init		= lifebook_init,
 	},
 	{
+		.type		= PSMOUSE_TRACKPOINT,
+		.name		= "TPPS/2",
+		.alias		= "trackpoint",
+		.detect		= trackpoint_detect,
+	},
+	{
 		.type		= PSMOUSE_AUTO,
 		.name		= "auto",
 		.alias		= "any",
@@ -1234,7 +1247,7 @@ static int psmouse_set_maxproto(const ch
 
 	*((unsigned int *)kp->arg) = proto->type;
 
-	return 0;					\
+	return 0;
 }
 
 static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp)
drivers/input/mouse/psmouse.h +1 -0
@@ -78,6 +78,7 @@ enum psmouse_type {
 	PSMOUSE_SYNAPTICS,
 	PSMOUSE_ALPS,
 	PSMOUSE_LIFEBOOK,
+	PSMOUSE_TRACKPOINT,
 	PSMOUSE_AUTO		/* This one should always be last */
 };
 
drivers/input/mouse/trackpoint.c new file +297 -0

297 lines not on this page · raw message

drivers/input/mouse/trackpoint.h new file +147 -0

147 lines not on this page · raw message

#2 lore raw

PATCH 2/26 rework psmouse attributes to reduce module size

Subject: [PATCH] Input: rework psmouse attributes to reduce module size
From: Dmitry Torokhov <[email protected]>
Date: 1125816020 -0500

Rearrange attribute code to use generic show and set handlers instead of replicating them for every attribute; switch to using attribute_group instead of creating all attributes manually. All this saves about 4K.

---

 drivers/input/mouse/logips2pp.c    |   12 +-
 drivers/input/mouse/psmouse-base.c |  117 +++++++++++++----------
 drivers/input/mouse/psmouse.h      |   49 ++++++----
 drivers/input/mouse/trackpoint.c   |  183 +++++++++++++++++++-----------------
 4 files changed, 199 insertions(+), 162 deletions(-)

cfe9e88866fe892f4f71bf132c64ec8bd5256e5e

drivers/input/mouse/logips2pp.c +7 -5
@@ -150,12 +150,12 @@ static void ps2pp_set_smartscroll(struct
 	ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
 }
 
-static ssize_t psmouse_attr_show_smartscroll(struct psmouse *psmouse, char *buf)
+static ssize_t ps2pp_attr_show_smartscroll(struct psmouse *psmouse, void *data, char *buf)
 {
 	return sprintf(buf, "%d\n", psmouse->smartscroll ? 1 : 0);
 }
 
-static ssize_t psmouse_attr_set_smartscroll(struct psmouse *psmouse, const char *buf, size_t count)
+static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data, const char *buf, size_t count)
 {
 	unsigned long value;
 	char *rest;
@@ -169,7 +169,8 @@ static ssize_t psmouse_attr_set_smartscr
 	return count;
 }
 
-PSMOUSE_DEFINE_ATTR(smartscroll);
+PSMOUSE_DEFINE_ATTR(smartscroll, S_IWUSR | S_IRUGO, NULL,
+			ps2pp_attr_show_smartscroll, ps2pp_attr_set_smartscroll);
 
 /*
  * Support 800 dpi resolution _only_ if the user wants it (there are good
@@ -194,7 +195,7 @@ static void ps2pp_set_resolution(struct 
 
 static void ps2pp_disconnect(struct psmouse *psmouse)
 {
-	device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll);
+	device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll.dattr);
 }
 
 static struct ps2pp_info *get_model_info(unsigned char model)
@@ -379,7 +380,8 @@ int ps2pp_init(struct psmouse *psmouse, 
 				psmouse->set_resolution = ps2pp_set_resolution;
 				psmouse->disconnect = ps2pp_disconnect;
 
-				device_create_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll);
+				device_create_file(&psmouse->ps2dev.serio->dev,
+						   &psmouse_attr_smartscroll.dattr);
 			}
 		}
 
drivers/input/mouse/psmouse-base.c +66 -51

197 lines not on this page · raw message

drivers/input/mouse/psmouse.h +31 -18

55 lines not on this page · raw message

drivers/input/mouse/trackpoint.c +95 -88

208 lines not on this page · raw message

#3 lore raw

PATCH 3/26 ALPS - fix wheel decoding

Subject: [PATCH] Input: ALPS - fix wheel decoding
From: Vojtech Pavlik <[email protected]>
Date: 1125816043 -0500

---

 drivers/input/mouse/alps.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

e6c047b98bbd09473c586744c681e877ebf954ff

drivers/input/mouse/alps.c +1 -1
@@ -170,7 +170,7 @@ static void alps_process_packet(struct p
 	input_report_key(dev, BTN_TOOL_FINGER, z > 0);
 
 	if (priv->i->flags & ALPS_WHEEL)
-		input_report_rel(dev, REL_WHEEL, ((packet[0] >> 4) & 0x07) | ((packet[2] >> 2) & 0x08));
+		input_report_rel(dev, REL_WHEEL, ((packet[2] << 1) & 0x08) - ((packet[0] >> 4) & 0x07));
 
 	if (priv->i->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) {
 		input_report_key(dev, BTN_FORWARD, forward);
#4 lore raw

PATCH 4/26 psmouse - add new Logitech wheel mouse model

Subject: [PATCH] Input: psmouse - add new Logitech wheel mouse model
From: Vojtech Pavlik <[email protected]>
Date: 1125816055 -0500

---

 drivers/input/mouse/logips2pp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

d2b5ffca73594e4046f405e3ef2438ce41f76fb2

drivers/input/mouse/logips2pp.c +1 -0
@@ -223,6 +223,7 @@ static struct ps2pp_info *get_model_info
 		{ 80,	PS2PP_KIND_WHEEL,	PS2PP_SIDE_BTN | PS2PP_WHEEL },
 		{ 81,	PS2PP_KIND_WHEEL,	PS2PP_WHEEL },
 		{ 83,	PS2PP_KIND_WHEEL,	PS2PP_WHEEL },
+		{ 86,	PS2PP_KIND_WHEEL,	PS2PP_WHEEL },
 		{ 88,	PS2PP_KIND_WHEEL,	PS2PP_WHEEL },
 		{ 96,	0,			0 },
 		{ 97,	PS2PP_KIND_TP3,		PS2PP_WHEEL | PS2PP_HWHEEL },
#5 lore raw

PATCH 5/26 fix checking whether new keycode fits size-wise

Subject: [PATCH] Input: fix checking whether new keycode fits size-wise
From: Ian Campbell <[email protected]>
Date: 1125816074 -0500

When dev->keycodesize == sizeof(int) the old code produces incorrect result.

---

 drivers/char/keyboard.c |    2 +-
 drivers/input/evdev.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

4cee99564db7f65a6f88e4b752da52768cde3802

drivers/char/keyboard.c +1 -1
@@ -200,7 +200,7 @@ int setkeycode(unsigned int scancode, un
 		return -EINVAL;
 	if (keycode < 0 || keycode > KEY_MAX)
 		return -EINVAL;
-	if (keycode >> (dev->keycodesize * 8))
+	if (dev->keycodesize < sizeof(keycode) && (keycode >> (dev->keycodesize * 8)))
 		return -EINVAL;
 
 	oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode);
drivers/input/evdev.c +1 -1
@@ -320,7 +320,7 @@ static long evdev_ioctl(struct file *fil
 			if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL;
 			if (get_user(v, ip + 1)) return -EFAULT;
 			if (v < 0 || v > KEY_MAX) return -EINVAL;
-			if (v >> (dev->keycodesize * 8)) return -EINVAL;
+			if (dev->keycodesize < sizeof(v) && (v >> (dev->keycodesize * 8))) return -EINVAL;
 			u = SET_INPUT_KEYCODE(dev, t, v);
 			clear_bit(u, dev->keybit);
 			set_bit(v, dev->keybit);
#6 lore raw

PATCH 6/26 i8042 - clean up initialization code; abort if we

Subject: [PATCH] Input: i8042 - clean up initialization code; abort if we
From: Dmitry Torokhov <[email protected]>
Date: 1125816087 -0500
can't create all ports.

---

 drivers/input/serio/i8042.c |  174 ++++++++++++++++++++++++-------------------
 1 files changed, 98 insertions(+), 76 deletions(-)

0854e52d86080c1043bc8988daef2ebda4775f64

drivers/input/serio/i8042.c +98 -76
@@ -338,10 +338,10 @@ static int i8042_open(struct serio *seri
 
 	return 0;
 
-activate_fail:
+ activate_fail:
 	free_irq(port->irq, i8042_request_irq_cookie);
 
-irq_fail:
+ irq_fail:
 	serio_unregister_port_delayed(serio);
 
 	return -1;
@@ -485,7 +485,7 @@ static irqreturn_t i8042_interrupt(int i
 		serio_interrupt(port->serio, data, dfl, regs);
 
 	ret = 1;
-out:
+ out:
 	return IRQ_RETVAL(ret);
 }
 
@@ -552,7 +552,7 @@ static int i8042_enable_mux_ports(void)
  * Enable all muxed ports.
  */
 
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < I8042_NUM_MUX_PORTS; i++) {
 		i8042_command(&param, I8042_CMD_MUX_PFX + i);
 		i8042_command(&param, I8042_CMD_AUX_ENABLE);
 	}
@@ -682,7 +682,7 @@ static int __init i8042_port_register(st
 		kfree(port->serio);
 		port->serio = NULL;
 		i8042_ctr |= port->disable;
-		return -1;
+		return -EIO;
 	}
 
 	printk(KERN_INFO "serio: i8042 %s port at %#lx,%#lx irq %d\n",
@@ -977,80 +977,83 @@ static struct device_driver i8042_driver
 	.shutdown	= i8042_shutdown,
 };
 
-static void __init i8042_create_kbd_port(void)
+static int __init i8042_create_kbd_port(void)
 {
 	struct serio *serio;
 	struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO];
 
-	serio = kmalloc(sizeof(struct serio), GFP_KERNEL);
-	if (serio) {
-		memset(serio, 0, sizeof(struct serio));
-		serio->id.type		= i8042_direct ? SERIO_8042 : SERIO_8042_XL;
-		serio->write		= i8042_dumbkbd ? NULL : i8042_kbd_write;
-		serio->open		= i8042_open;
-		serio->close		= i8042_close;
-		serio->start		= i8042_start;
-		serio->stop		= i8042_stop;
-		serio->port_data	= port;
-		serio->dev.parent	= &i8042_platform_device->dev;
-		strlcpy(serio->name, "i8042 Kbd Port", sizeof(serio->name));
-		strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys));
+	serio = kcalloc(1, sizeof(struct serio), GFP_KERNEL);
+	if (!serio)
+		return -ENOMEM;
+
+	serio->id.type		= i8042_direct ? SERIO_8042 : SERIO_8042_XL;
+	serio->write		= i8042_dumbkbd ? NULL : i8042_kbd_write;
+	serio->open		= i8042_open;
+	serio->close		= i8042_close;
+	serio->start		= i8042_start;
+	serio->stop		= i8042_stop;
+	serio->port_data	= port;
+	serio->dev.parent	= &i8042_platform_device->dev;
+	strlcpy(serio->name, "i8042 Kbd Port", sizeof(serio->name));
+	strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys));
 
-		port->serio = serio;
-		i8042_port_register(port);
-	}
+	port->serio = serio;
+
+	return i8042_port_register(port);
 }
 
-static void __init i8042_create_aux_port(void)
+static int __init i8042_create_aux_port(void)
 {
 	struct serio *serio;
 	struct i8042_port *port = &i8042_ports[I8042_AUX_PORT_NO];
 
-	serio = kmalloc(sizeof(struct serio), GFP_KERNEL);
-	if (serio) {
-		memset(serio, 0, sizeof(struct serio));
-		serio->id.type		= SERIO_8042;
-		serio->write		= i8042_aux_write;
-		serio->open		= i8042_open;
-		serio->close		= i8042_close;
-		serio->start		= i8042_start;
-		serio->stop		= i8042_stop;
-		serio->port_data	= port;
-		serio->dev.parent	= &i8042_platform_device->dev;
-		strlcpy(serio->name, "i8042 Aux Port", sizeof(serio->name));
-		strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys));
+	serio = kcalloc(1, sizeof(struct serio), GFP_KERNEL);
+	if (!serio)
+		return -ENOMEM;
+
+	serio->id.type		= SERIO_8042;
+	serio->write		= i8042_aux_write;
+	serio->open		= i8042_open;
+	serio->close		= i8042_close;
+	serio->start		= i8042_start;
+	serio->stop		= i8042_stop;
+	serio->port_data	= port;
+	serio->dev.parent	= &i8042_platform_device->dev;
+	strlcpy(serio->name, "i8042 Aux Port", sizeof(serio->name));
+	strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys));
 
-		port->serio = serio;
-		i8042_port_register(port);
-	}
+	port->serio = serio;
+
+	return i8042_port_register(port);
 }
 
-static void __init i8042_create_mux_port(int index)
+static int __init i8042_create_mux_port(int index)
 {
 	struct serio *serio;
 	struct i8042_port *port = &i8042_ports[I8042_MUX_PORT_NO + index];
 
-	serio = kmalloc(sizeof(struct serio), GFP_KERNEL);
-	if (serio) {
-		memset(serio, 0, sizeof(struct serio));
-		serio->id.type		= SERIO_8042;
-		serio->write		= i8042_aux_write;
-		serio->open		= i8042_open;
-		serio->close		= i8042_close;
-		serio->start		= i8042_start;
-		serio->stop		= i8042_stop;
-		serio->port_data	= port;
-		serio->dev.parent	= &i8042_platform_device->dev;
-		snprintf(serio->name, sizeof(serio->name), "i8042 Aux-%d Port", index);
-		snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, index + 1);
-
-		*port = i8042_ports[I8042_AUX_PORT_NO];
-		port->exists = 0;
-		snprintf(port->name, sizeof(port->name), "AUX%d", index);
-		port->mux = index;
-		port->serio = serio;
-		i8042_port_register(port);
-	}
+	serio = kcalloc(1, sizeof(struct serio), GFP_KERNEL);
+	if (!serio)
+		return -ENOMEM;
+
+	serio->id.type		= SERIO_8042;
+	serio->write		= i8042_aux_write;
+	serio->open		= i8042_open;
+	serio->close		= i8042_close;
+	serio->start		= i8042_start;
+	serio->stop		= i8042_stop;
+	serio->port_data	= port;
+	serio->dev.parent	= &i8042_platform_device->dev;
+	snprintf(serio->name, sizeof(serio->name), "i8042 Aux-%d Port", index);
+	snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, index + 1);
+
+	*port = i8042_ports[I8042_AUX_PORT_NO];
+	port->exists = 0;
+	snprintf(port->name, sizeof(port->name), "AUX%d", index);
+	port->mux = index;
+	port->serio = serio;
+
+	return i8042_port_register(port);
 }
 
 static int __init i8042_init(void)
@@ -1070,36 +1073,55 @@ static int __init i8042_init(void)
 	i8042_ports[I8042_KBD_PORT_NO].irq = I8042_KBD_IRQ;
 
 	if (i8042_controller_init()) {
-		i8042_platform_exit();
-		return -ENODEV;
+		err = -ENODEV;
+		goto err_platform_exit;
 	}
 
 	err = driver_register(&i8042_driver);
-	if (err) {
-		i8042_platform_exit();
-		return err;
-	}
+	if (err)
+		goto err_controller_cleanup;
 
 	i8042_platform_device = platform_device_register_simple("i8042", -1, NULL, 0);
 	if (IS_ERR(i8042_platform_device)) {
-		driver_unregister(&i8042_driver);
-		i8042_platform_exit();
-		return PTR_ERR(i8042_platform_device);
+		err = PTR_ERR(i8042_platform_device);
+		goto err_unregister_driver;
 	}
 
 	if (!i8042_noaux && !i8042_check_aux()) {
-		if (!i8042_nomux && !i8042_check_mux())
-			for (i = 0; i < I8042_NUM_MUX_PORTS; i++)
-				i8042_create_mux_port(i);
-		else
-			i8042_create_aux_port();
+		if (!i8042_nomux && !i8042_check_mux()) {
+			for (i = 0; i < I8042_NUM_MUX_PORTS; i++) {
+				err = i8042_create_mux_port(i);
+				if (err)
+					goto err_unregister_ports;
+			}
+		} else {
+			err = i8042_create_aux_port();
+			if (err)
+				goto err_unregister_ports;
+		}
 	}
 
-	i8042_create_kbd_port();
+	err = i8042_create_kbd_port();
+	if (err)
+		goto err_unregister_ports;
 
 	mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);
 
 	return 0;
+
+ err_unregister_ports:
+	for (i = 0; i < I8042_NUM_PORTS; i++)
+		if (i8042_ports[i].serio)
+			serio_unregister_port(i8042_ports[i].serio);
+	platform_device_unregister(i8042_platform_device);
+ err_unregister_driver:
+	driver_unregister(&i8042_driver);
+ err_controller_cleanup:
+	i8042_controller_cleanup();
+ err_platform_exit:
+	i8042_platform_exit();
+
+	return err;
 }
 
 static void __exit i8042_exit(void)
#7 lore raw

PATCH 7/26 make i8042_platform_init return 'real' error code

Subject: [PATCH] Input: make i8042_platform_init return 'real' error code
From: Dmitry Torokhov <[email protected]>
Date: 1125816098 -0500

---

 drivers/input/serio/i8042-io.h        |    6 +++---
 drivers/input/serio/i8042-ip22io.h    |    2 +-
 drivers/input/serio/i8042-jazzio.h    |    2 +-
 drivers/input/serio/i8042-sparcio.h   |   12 ++++++------
 drivers/input/serio/i8042-x86ia64io.h |   22 ++++++++++++----------
 drivers/input/serio/i8042.c           |    5 +++--
 6 files changed, 26 insertions(+), 23 deletions(-)

8d5987a6e17fa36776a0c9964db0f24c3d070862

drivers/input/serio/i8042-io.h +3 -3
@@ -69,16 +69,16 @@ static inline int i8042_platform_init(vo
  */
 #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC64)
 	if (!request_region(I8042_DATA_REG, 16, "i8042"))
-		return -1;
+		return -EBUSY;
 #endif
 
         i8042_reset = 1;
 
 #if defined(CONFIG_PPC64)
 	if (check_legacy_ioport(I8042_DATA_REG))
-		return -1;
+		return -EBUSY;
 	if (!request_region(I8042_DATA_REG, 16, "i8042"))
-		return -1;
+		return -EBUSY;
 #endif
 	return 0;
 }
drivers/input/serio/i8042-ip22io.h +1 -1
@@ -58,7 +58,7 @@ static inline int i8042_platform_init(vo
 #if 0
 	/* XXX sgi_kh is a virtual address */
 	if (!request_mem_region(sgi_kh, sizeof(struct hpc_keyb), "i8042"))
-		return 1;
+		return -EBUSY;
 #endif
 
 	i8042_reset = 1;
drivers/input/serio/i8042-jazzio.h +1 -1
@@ -53,7 +53,7 @@ static inline int i8042_platform_init(vo
 #if 0
 	/* XXX JAZZ_KEYBOARD_ADDRESS is a virtual address */
 	if (!request_mem_region(JAZZ_KEYBOARD_ADDRESS, 2, "i8042"))
-		return 1;
+		return -EBUSY;
 #endif
 
 	return 0;
drivers/input/serio/i8042-sparcio.h +6 -6
@@ -48,10 +48,10 @@ static inline void i8042_write_command(i
 #define OBP_PS2MS_NAME1		"kdmouse"
 #define OBP_PS2MS_NAME2		"mouse"
 
-static int i8042_platform_init(void)
+static int __init i8042_platform_init(void)
 {
 #ifndef CONFIG_PCI
-	return -1;
+	return -ENODEV;
 #else
 	char prop[128];
 	int len;
@@ -59,14 +59,14 @@ static int i8042_platform_init(void)
 	len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop));
 	if (len < 0) {
 		printk("i8042: Cannot get name property of root OBP node.\n");
-		return -1;
+		return -ENODEV;
 	}
 	if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) {
 		/* Hardcoded values for MrCoffee.  */
 		i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
 		kbd_iobase = ioremap(0x71300060, 8);
 		if (!kbd_iobase)
-			return -1;
+			return -ENODEV;
 	} else {
 		struct linux_ebus *ebus;
 		struct linux_ebus_device *edev;
@@ -78,7 +78,7 @@ static int i8042_platform_init(void)
 					goto edev_found;
 			}
 		}
-		return -1;
+		return -ENODEV;
 
 	edev_found:
 		for_each_edevchild(edev, child) {
@@ -96,7 +96,7 @@ static int i8042_platform_init(void)
 		    i8042_aux_irq == -1) {
 			printk("i8042: Error, 8042 device lacks both kbd and "
 			       "mouse nodes.\n");
-			return -1;
+			return -ENODEV;
 		}
 	}
 
drivers/input/serio/i8042-x86ia64io.h +12 -10
@@ -256,7 +256,7 @@ static void i8042_pnp_exit(void)
 	}
 }
 
-static int i8042_pnp_init(void)
+static int __init i8042_pnp_init(void)
 {
 	int result_kbd, result_aux;
 
@@ -322,25 +322,29 @@ static int i8042_pnp_init(void)
 	return 0;
 }
 
+#else
+static inline int i8042_pnp_init(void) { return 0; }
+static inline void i8042_pnp_exit(void) { }
 #endif
 
-static inline int i8042_platform_init(void)
+static int __init i8042_platform_init(void)
 {
+	int retval;
+
 /*
  * On ix86 platforms touching the i8042 data register region can do really
  * bad things. Because of this the region is always reserved on ix86 boxes.
  *
  *	if (!request_region(I8042_DATA_REG, 16, "i8042"))
- *		return -1;
+ *		return -EBUSY;
  */
 
 	i8042_kbd_irq = I8042_MAP_IRQ(1);
 	i8042_aux_irq = I8042_MAP_IRQ(12);
 
-#ifdef CONFIG_PNP
-	if (i8042_pnp_init())
-		return -1;
-#endif
+	retval = i8042_pnp_init();
+	if (retval)
+		return retval;
 
 #if defined(__ia64__)
         i8042_reset = 1;
@@ -354,14 +358,12 @@ static inline int i8042_platform_init(vo
 		i8042_nomux = 1;
 #endif
 
-	return 0;
+	return retval;
 }
 
 static inline void i8042_platform_exit(void)
 {
-#ifdef CONFIG_PNP
 	i8042_pnp_exit();
-#endif
 }
 
 #endif /* _I8042_X86IA64IO_H */
drivers/input/serio/i8042.c +3 -2
@@ -1066,8 +1066,9 @@ static int __init i8042_init(void)
 	init_timer(&i8042_timer);
 	i8042_timer.function = i8042_timer_func;
 
-	if (i8042_platform_init())
-		return -EBUSY;
+	err = i8042_platform_init();
+	if (err)
+		return err;
 
 	i8042_ports[I8042_AUX_PORT_NO].irq = I8042_AUX_IRQ;
 	i8042_ports[I8042_KBD_PORT_NO].irq = I8042_KBD_IRQ;
#8 lore raw

PATCH 8/26 i8042 - fix IRQ printing when either KBD or AUX port

Subject: [PATCH] Input: i8042 - fix IRQ printing when either KBD or AUX port
From: Dmitry Torokhov <[email protected]>
Date: 1125816111 -0500
is absent from ACPI/PNP tables.

---

 drivers/input/serio/i8042-x86ia64io.h |   39 +++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 14 deletions(-)

c3d31e7f9a94800ba895a081e143e79954f6c62f

drivers/input/serio/i8042-x86ia64io.h +25 -14
@@ -258,7 +258,8 @@ static void i8042_pnp_exit(void)
 
 static int __init i8042_pnp_init(void)
 {
-	int result_kbd, result_aux;
+	int result_kbd = 0, result_aux = 0;
+	char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
 
 	if (i8042_nopnp) {
 		printk(KERN_INFO "i8042: PNP detection disabled\n");
@@ -267,6 +268,7 @@ static int __init i8042_pnp_init(void)
 
 	if ((result_kbd = pnp_register_driver(&i8042_pnp_kbd_driver)) >= 0)
 		i8042_pnp_kbd_registered = 1;
+
 	if ((result_aux = pnp_register_driver(&i8042_pnp_aux_driver)) >= 0)
 		i8042_pnp_aux_registered = 1;
 
@@ -280,6 +282,25 @@ static int __init i8042_pnp_init(void)
 #endif
 	}
 
+	if (result_kbd > 0)
+		snprintf(kbd_irq_str, sizeof(kbd_irq_str),
+			"%d", i8042_pnp_kbd_irq);
+	if (result_aux > 0)
+		snprintf(aux_irq_str, sizeof(aux_irq_str),
+			"%d", i8042_pnp_aux_irq);
+
+	printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
+		i8042_pnp_kbd_name, (result_kbd > 0 && result_aux > 0) ? "," : "",
+		i8042_pnp_aux_name,
+		i8042_pnp_data_reg, i8042_pnp_command_reg,
+		kbd_irq_str, (result_kbd > 0 && result_aux > 0) ? "," : "",
+		aux_irq_str);
+
+#if defined(__ia64__)
+	if (result_aux <= 0)
+		i8042_noaux = 1;
+#endif
+
 	if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
 	      i8042_pnp_data_reg != i8042_data_reg) || !i8042_pnp_data_reg) {
 		printk(KERN_WARNING "PNP: PS/2 controller has invalid data port %#x; using default %#x\n",
@@ -295,30 +316,20 @@ static int __init i8042_pnp_init(void)
 	}
 
 	if (!i8042_pnp_kbd_irq) {
-		printk(KERN_WARNING "PNP: PS/2 controller doesn't have KBD irq; using default %#x\n", i8042_kbd_irq);
+		printk(KERN_WARNING "PNP: PS/2 controller doesn't have KBD irq; using default %d\n", i8042_kbd_irq);
 		i8042_pnp_kbd_irq = i8042_kbd_irq;
 	}
 
-	if (!i8042_pnp_aux_irq) {
-		printk(KERN_WARNING "PNP: PS/2 controller doesn't have AUX irq; using default %#x\n", i8042_aux_irq);
+	if (!i8042_noaux && !i8042_pnp_aux_irq) {
+		printk(KERN_WARNING "PNP: PS/2 controller doesn't have AUX irq; using default %d\n", i8042_aux_irq);
 		i8042_pnp_aux_irq = i8042_aux_irq;
 	}
 
-#if defined(__ia64__)
-	if (result_aux <= 0)
-		i8042_noaux = 1;
-#endif
-
 	i8042_data_reg = i8042_pnp_data_reg;
 	i8042_command_reg = i8042_pnp_command_reg;
 	i8042_kbd_irq = i8042_pnp_kbd_irq;
 	i8042_aux_irq = i8042_pnp_aux_irq;
 
-	printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %d%s%d\n",
-		i8042_pnp_kbd_name, (result_kbd > 0 && result_aux > 0) ? "," : "", i8042_pnp_aux_name,
-		i8042_data_reg, i8042_command_reg, i8042_kbd_irq,
-		(result_aux > 0) ? "," : "", i8042_aux_irq);
-
 	return 0;
 }
 
#9 lore raw

PATCH 9/26 i8042 - add i8042.nokbd module option to allow supressing

Subject: [PATCH] Input: i8042 - add i8042.nokbd module option to allow supressing
From: Dmitry Torokhov <[email protected]>
Date: 1125816120 -0500
creation of keyboard port.

---

 Documentation/kernel-parameters.txt   |    1 +
 drivers/input/serio/i8042-x86ia64io.h |    4 +++-
 drivers/input/serio/i8042.c           |   22 ++++++++++++++++++----
 3 files changed, 22 insertions(+), 5 deletions(-)

945ef0d428bc33c639e49d27fb8cc765adec3fdf

Documentation/kernel-parameters.txt +1 -0
@@ -549,6 +549,7 @@ running once the system is up.
 			     keyboard and can not control its state
 			     (Don't attempt to blink the leds)
 	i8042.noaux	[HW] Don't check for auxiliary (== mouse) port
+	i8042.nokbd	[HW] Don't check/create keyboard port
 	i8042.nomux	[HW] Don't check presence of an active multiplexing
 			     controller
 	i8042.nopnp	[HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX
drivers/input/serio/i8042-x86ia64io.h +3 -1
@@ -297,6 +297,8 @@ static int __init i8042_pnp_init(void)
 		aux_irq_str);
 
 #if defined(__ia64__)
+	if (result_kbd <= 0)
+		i8042_nokbd = 1;
 	if (result_aux <= 0)
 		i8042_noaux = 1;
 #endif
@@ -315,7 +317,7 @@ static int __init i8042_pnp_init(void)
 		i8042_pnp_command_reg = i8042_command_reg;
 	}
 
-	if (!i8042_pnp_kbd_irq) {
+	if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
 		printk(KERN_WARNING "PNP: PS/2 controller doesn't have KBD irq; using default %d\n", i8042_kbd_irq);
 		i8042_pnp_kbd_irq = i8042_kbd_irq;
 	}
drivers/input/serio/i8042.c +18 -4
@@ -27,6 +27,10 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@s
 MODULE_DESCRIPTION("i8042 keyboard and mouse controller driver");
 MODULE_LICENSE("GPL");
 
+static unsigned int i8042_nokbd;
+module_param_named(nokbd, i8042_nokbd, bool, 0);
+MODULE_PARM_DESC(nokbd, "Do not probe or use KBD port.");
+
 static unsigned int i8042_noaux;
 module_param_named(noaux, i8042_noaux, bool, 0);
 MODULE_PARM_DESC(noaux, "Do not probe or use AUX (mouse) port.");
@@ -1058,7 +1062,7 @@ static int __init i8042_create_mux_port(
 
 static int __init i8042_init(void)
 {
-	int i;
+	int i, have_ports = 0;
 	int err;
 
 	dbg_init();
@@ -1100,11 +1104,20 @@ static int __init i8042_init(void)
 			if (err)
 				goto err_unregister_ports;
 		}
+		have_ports = 1;
 	}
 
-	err = i8042_create_kbd_port();
-	if (err)
-		goto err_unregister_ports;
+	if (!i8042_nokbd) {
+		err = i8042_create_kbd_port();
+		if (err)
+			goto err_unregister_ports;
+		have_ports = 1;
+	}
+
+	if (!have_ports) {
+		err = -ENODEV;
+		goto err_unregister_device;
+	}
 
 	mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);
 
@@ -1114,6 +1127,7 @@ static int __init i8042_init(void)
 	for (i = 0; i < I8042_NUM_PORTS; i++)
 		if (i8042_ports[i].serio)
 			serio_unregister_port(i8042_ports[i].serio);
+ err_unregister_device:
 	platform_device_unregister(i8042_platform_device);
  err_unregister_driver:
 	driver_unregister(&i8042_driver);
#10 lore raw

PATCH 10/26 i8042 - add Lifebook E4010 to MUX blacklist

Subject: [PATCH] Input: i8042 - add Lifebook E4010 to MUX blacklist
From: Dmitry Torokhov <[email protected]>
Date: 1125816130 -0500

---

 drivers/input/serio/i8042-x86ia64io.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

7545c24c6a6ab62922266197a72119212280ea2a

drivers/input/serio/i8042-x86ia64io.h +7 -0
@@ -138,6 +138,13 @@ static struct dmi_system_id __initdata i
 		},
 	},
 	{
+		.ident = "Fujitsu-Siemens Lifebook E4010",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
+		},
+	},
+	{
 		.ident = "Toshiba P10",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
#11 lore raw

PATCH 11/26 recognize and ignore Logitech vendor usages in HID

Subject: [PATCH] Inpur: recognize and ignore Logitech vendor usages in HID
From: Vojtech Pavlik <[email protected]>
Date: 1125896857 -0500

These get in our way with MX mice.

---

 drivers/usb/input/hid-input.c |    1 +
 drivers/usb/input/hid.h       |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

b8c9c642db4ab0811cc5bb0d8b90cc7819055c95

drivers/usb/input/hid-input.c +1 -0
@@ -296,6 +296,7 @@ static void hidinput_configure_usage(str
 			break;
 
 		case HID_UP_MSVENDOR:
+		case HID_UP_LOGIVENDOR:
 
 			goto ignore;
 
drivers/usb/input/hid.h +1 -0
@@ -182,6 +182,7 @@ struct hid_item {
 #define HID_UP_PID		0x000f0000
 #define HID_UP_HPVENDOR         0xff7f0000
 #define HID_UP_MSVENDOR		0xff000000
+#define HID_UP_LOGIVENDOR	0x00ff0000
 
 #define HID_USAGE		0x0000ffff
 
#12 lore raw

PATCH 12/26 add HID simulation mappings

Subject: [PATCH] Input: add HID simulation mappings
From: Vojtech Pavlik <[email protected]>
Date: 1125896879 -0500

Add simulation usage page mappings to hid-input.c to support a new crop of joysticks using them to designate Rudder and Throttle controls.

---

 drivers/usb/input/hid-debug.h |   17 +++++++++++++++++
 drivers/usb/input/hid-input.c |    9 +++++++++
 drivers/usb/input/hid.h       |    1 +
 3 files changed, 27 insertions(+), 0 deletions(-)

0aebfdac042b63d0f2625414062e138a4333181c

drivers/usb/input/hid-debug.h +17 -0
@@ -85,6 +85,23 @@ static const struct hid_usage_entry hid_
       {0, 0x91, "D-PadDown"},
       {0, 0x92, "D-PadRight"},
       {0, 0x93, "D-PadLeft"},
+  {  2, 0, "Simulation" },
+      {0, 0xb0, "Aileron"},
+      {0, 0xb1, "AileronTrim"},
+      {0, 0xb2, "Anti-Torque"},
+      {0, 0xb3, "Autopilot"},
+      {0, 0xb4, "Chaff"},
+      {0, 0xb5, "Collective"},
+      {0, 0xb6, "DiveBrake"},
+      {0, 0xb7, "ElectronicCountermeasures"},
+      {0, 0xb8, "Elevator"},
+      {0, 0xb9, "ElevatorTrim"},
+      {0, 0xba, "Rudder"},
+      {0, 0xbb, "Throttle"},
+      {0, 0xbc, "FlightCommunications"},
+      {0, 0xbd, "FlareRelease"},
+      {0, 0xbe, "LandingGear"},
+      {0, 0xbf, "ToeBrake"},
   {  7, 0, "Keyboard" },
   {  8, 0, "LED" },
       {0, 0x01, "NumLock"},
drivers/usb/input/hid-input.c +9 -0
@@ -131,6 +131,15 @@ static void hidinput_configure_usage(str
 			map_key(code);
 			break;
 
+
+		case HID_UP_SIMULATION:
+
+			switch (usage->hid & 0xffff) {
+				case 0xba: map_abs(ABS_RUDDER); break;
+				case 0xbb: map_abs(ABS_THROTTLE); break;
+			}
+			break;
+
 		case HID_UP_GENDESK:
 
 			if ((usage->hid & 0xf0) == 0x80) {	/* SystemControl */
drivers/usb/input/hid.h +1 -0
@@ -173,6 +173,7 @@ struct hid_item {
 
 #define HID_UP_UNDEFINED	0x00000000
 #define HID_UP_GENDESK		0x00010000
+#define HID_UP_SIMULATION	0x00020000
 #define HID_UP_KEYBOARD		0x00070000
 #define HID_UP_LED		0x00080000
 #define HID_UP_BUTTON		0x00090000
#13 lore raw

PATCH 13/26 HID - add more consumer usages

Subject: [PATCH] Input: HID - add more consumer usages
From: Vojtech Pavlik <[email protected]>
Date: 1125896888 -0500

Extend mapping of the consumer usage page in hid-input.c to handle more cases appearing on new USB keyboards.

---

 drivers/usb/input/hid-debug.h |   17 +++++++++++------
 drivers/usb/input/hid-input.c |   19 ++++++++++++++++---
 drivers/usb/input/hid.h       |    1 +
 include/linux/input.h         |    8 ++++++++
 4 files changed, 36 insertions(+), 9 deletions(-)

8a409b0118c2d78f84f740f60fe03abda1fe3333

drivers/usb/input/hid-debug.h +11 -6
@@ -109,6 +109,7 @@ static const struct hid_usage_entry hid_
       {0, 0x03, "ScrollLock"},
       {0, 0x04, "Compose"},
       {0, 0x05, "Kana"},
+      {0, 0x4b, "GenericIndicator"},
   {  9, 0, "Button" },
   { 10, 0, "Ordinal" },
   { 12, 0, "Consumer" },
@@ -591,7 +592,8 @@ static char *keys[KEY_MAX + 1] = {
 	[KEY_EXIT] = "Exit",			[KEY_MOVE] = "Move",
 	[KEY_EDIT] = "Edit",			[KEY_SCROLLUP] = "ScrollUp",
 	[KEY_SCROLLDOWN] = "ScrollDown",	[KEY_KPLEFTPAREN] = "KPLeftParenthesis",
-	[KEY_KPRIGHTPAREN] = "KPRightParenthesis", [KEY_F13] = "F13",
+	[KEY_KPRIGHTPAREN] = "KPRightParenthesis", [KEY_NEW] = "New",
+	[KEY_REDO] = "Redo",			[KEY_F13] = "F13",
 	[KEY_F14] = "F14",			[KEY_F15] = "F15",
 	[KEY_F16] = "F16",			[KEY_F17] = "F17",
 	[KEY_F18] = "F18",			[KEY_F19] = "F19",
@@ -601,15 +603,15 @@ static char *keys[KEY_MAX + 1] = {
 	[KEY_PAUSECD] = "PauseCD",		[KEY_PROG3] = "Prog3",
 	[KEY_PROG4] = "Prog4",			[KEY_SUSPEND] = "Suspend",
 	[KEY_CLOSE] = "Close",			[KEY_PLAY] = "Play",
-	[KEY_FASTFORWARD] = "Fast Forward",	[KEY_BASSBOOST] = "Bass Boost",
+	[KEY_FASTFORWARD] = "FastForward",	[KEY_BASSBOOST] = "BassBoost",
 	[KEY_PRINT] = "Print",			[KEY_HP] = "HP",
 	[KEY_CAMERA] = "Camera",		[KEY_SOUND] = "Sound",
 	[KEY_QUESTION] = "Question",		[KEY_EMAIL] = "Email",
 	[KEY_CHAT] = "Chat",			[KEY_SEARCH] = "Search",
 	[KEY_CONNECT] = "Connect",		[KEY_FINANCE] = "Finance",
 	[KEY_SPORT] = "Sport",			[KEY_SHOP] = "Shop",
-	[KEY_ALTERASE] = "Alternate Erase",	[KEY_CANCEL] = "Cancel",
-	[KEY_BRIGHTNESSDOWN] = "Brightness down", [KEY_BRIGHTNESSUP] = "Brightness up",
+	[KEY_ALTERASE] = "AlternateErase",	[KEY_CANCEL] = "Cancel",
+	[KEY_BRIGHTNESSDOWN] = "BrightnessDown", [KEY_BRIGHTNESSUP] = "BrightnessUp",
 	[KEY_MEDIA] = "Media",			[KEY_UNKNOWN] = "Unknown",
 	[BTN_0] = "Btn0",			[BTN_1] = "Btn1",
 	[BTN_2] = "Btn2",			[BTN_3] = "Btn3",
@@ -639,8 +641,8 @@ static char *keys[KEY_MAX + 1] = {
 	[BTN_TOOL_AIRBRUSH] = "ToolAirbrush",	[BTN_TOOL_FINGER] = "ToolFinger",
 	[BTN_TOOL_MOUSE] = "ToolMouse",		[BTN_TOOL_LENS] = "ToolLens",
 	[BTN_TOUCH] = "Touch",			[BTN_STYLUS] = "Stylus",
-	[BTN_STYLUS2] = "Stylus2",		[BTN_TOOL_DOUBLETAP] = "Tool Doubletap",
-	[BTN_TOOL_TRIPLETAP] = "Tool Tripletap", [BTN_GEAR_DOWN] = "WheelBtn",
+	[BTN_STYLUS2] = "Stylus2",		[BTN_TOOL_DOUBLETAP] = "ToolDoubleTap",
+	[BTN_TOOL_TRIPLETAP] = "ToolTripleTap", [BTN_GEAR_DOWN] = "WheelBtn",
 	[BTN_GEAR_UP] = "Gear up",		[KEY_OK] = "Ok",
 	[KEY_SELECT] = "Select",		[KEY_GOTO] = "Goto",
 	[KEY_CLEAR] = "Clear",			[KEY_POWER2] = "Power2",
@@ -676,6 +678,9 @@ static char *keys[KEY_MAX + 1] = {
 	[KEY_TWEN] = "TWEN",			[KEY_DEL_EOL] = "DeleteEOL",
 	[KEY_DEL_EOS] = "DeleteEOS",		[KEY_INS_LINE] = "InsertLine",
 	[KEY_DEL_LINE] = "DeleteLine",
+	[KEY_SEND] = "Send",			[KEY_REPLY] = "Reply",
+	[KEY_FORWARDMAIL] = "ForwardMail",	[KEY_SAVE] = "Save",
+	[KEY_DOCUMENTS] = "Documents",
 };
 
 static char *relatives[REL_MAX + 1] = {
drivers/usb/input/hid-input.c +16 -3
@@ -78,8 +78,8 @@ static void hidinput_configure_usage(str
 {
 	struct input_dev *input = &hidinput->input;
 	struct hid_device *device = hidinput->input.private;
-	int max, code;
-	unsigned long *bit;
+	int max = 0, code;
+	unsigned long *bit = NULL;
 
 	field->hidinput = hidinput;
 
@@ -248,7 +248,10 @@ static void hidinput_configure_usage(str
 				case 0x034: map_key_clear(KEY_SLEEP);		break;
 				case 0x036: map_key_clear(BTN_MISC);		break;
 				case 0x08a: map_key_clear(KEY_WWW);		break;
+				case 0x08d: map_key_clear(KEY_PROGRAM);		break;
 				case 0x095: map_key_clear(KEY_HELP);		break;
+				case 0x09c: map_key_clear(KEY_CHANNELUP);	break;
+				case 0x09d: map_key_clear(KEY_CHANNELDOWN);	break;
 				case 0x0b0: map_key_clear(KEY_PLAY);		break;
 				case 0x0b1: map_key_clear(KEY_PAUSE);		break;
 				case 0x0b2: map_key_clear(KEY_RECORD);		break;
@@ -268,6 +271,11 @@ static void hidinput_configure_usage(str
 				case 0x18a: map_key_clear(KEY_MAIL);		break;
 				case 0x192: map_key_clear(KEY_CALC);		break;
 				case 0x194: map_key_clear(KEY_FILE);		break;
+				case 0x1a7: map_key_clear(KEY_DOCUMENTS);	break;
+				case 0x201: map_key_clear(KEY_NEW);		break;
+				case 0x207: map_key_clear(KEY_SAVE);		break;
+				case 0x208: map_key_clear(KEY_PRINT);		break;
+				case 0x209: map_key_clear(KEY_PROPS);		break;
 				case 0x21a: map_key_clear(KEY_UNDO);		break;
 				case 0x21b: map_key_clear(KEY_COPY);		break;
 				case 0x21c: map_key_clear(KEY_CUT);		break;
@@ -280,7 +288,11 @@ static void hidinput_configure_usage(str
 				case 0x227: map_key_clear(KEY_REFRESH);		break;
 				case 0x22a: map_key_clear(KEY_BOOKMARKS);	break;
 				case 0x238: map_rel(REL_HWHEEL);		break;
-				default:    goto unknown;
+				case 0x279: map_key_clear(KEY_REDO);		break;
+				case 0x289: map_key_clear(KEY_REPLY);		break;
+				case 0x28b: map_key_clear(KEY_FORWARDMAIL);	break;
+				case 0x28c: map_key_clear(KEY_SEND);		break;
+				default:    goto ignore;
 			}
 			break;
 
@@ -306,6 +318,7 @@ static void hidinput_configure_usage(str
 
 		case HID_UP_MSVENDOR:
 		case HID_UP_LOGIVENDOR:
+		case HID_UP_LOGIVENDOR2:
 
 			goto ignore;
 
drivers/usb/input/hid.h +1 -0
@@ -184,6 +184,7 @@ struct hid_item {
 #define HID_UP_HPVENDOR         0xff7f0000
 #define HID_UP_MSVENDOR		0xff000000
 #define HID_UP_LOGIVENDOR	0x00ff0000
+#define HID_UP_LOGIVENDOR2	0xffbc0000
 
 #define HID_USAGE		0x0000ffff
 
include/linux/input.h +8 -0
@@ -287,6 +287,8 @@ struct input_absinfo {
 #define KEY_SCROLLDOWN		178
 #define KEY_KPLEFTPAREN		179
 #define KEY_KPRIGHTPAREN	180
+#define KEY_NEW			181
+#define KEY_REDO		182
 
 #define KEY_F13			183
 #define KEY_F14			184
@@ -333,6 +335,12 @@ struct input_absinfo {
 #define KEY_KBDILLUMDOWN	229
 #define KEY_KBDILLUMUP		230
 
+#define KEY_SEND		231
+#define KEY_REPLY		232
+#define KEY_FORWARDMAIL		233
+#define KEY_SAVE		234
+#define KEY_DOCUMENTS		235
+
 #define KEY_UNKNOWN		240
 
 #define BTN_MISC		0x100
#14 lore raw

PATCH 14/26 atkbd - handle keyboards generating scancode 0x7f

Subject: [PATCH] Input: atkbd - handle keyboards generating scancode 0x7f
From: Vojtech Pavlik <[email protected]>
Date: 1125897101 -0500

Extend bat_xl handling to do err_xl handling, so that keyboards using 0x7f scancode for regular keys can work.

---

 drivers/input/keyboard/atkbd.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

903b126bffb77dc313b7c2971880df408bf41a9e

drivers/input/keyboard/atkbd.c +7 -3
@@ -208,6 +208,7 @@ struct atkbd {
 	unsigned char resend;
 	unsigned char release;
 	unsigned char bat_xl;
+	unsigned char err_xl;
 	unsigned int last;
 	unsigned long time;
 };
@@ -296,15 +297,18 @@ static irqreturn_t atkbd_interrupt(struc
 		if (atkbd->emul ||
 		    !(code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1 ||
 		      code == ATKBD_RET_HANGUEL || code == ATKBD_RET_HANJA ||
-		      code == ATKBD_RET_ERR ||
+		     (code == ATKBD_RET_ERR && !atkbd->err_xl) ||
 	             (code == ATKBD_RET_BAT && !atkbd->bat_xl))) {
 			atkbd->release = code >> 7;
 			code &= 0x7f;
 		}
 
-		if (!atkbd->emul &&
-		     (code & 0x7f) == (ATKBD_RET_BAT & 0x7f))
+		if (!atkbd->emul) {
+		     if ((code & 0x7f) == (ATKBD_RET_BAT & 0x7f))
 			atkbd->bat_xl = !atkbd->release;
+		     if ((code & 0x7f) == (ATKBD_RET_ERR & 0x7f))
+			atkbd->err_xl = !atkbd->release;
+		}
 	}
 
 	switch (code) {
#15 lore raw

PATCH 15/26 HID - handle multi-transascion reports

Subject: [PATCH] Input: HID - handle multi-transascion reports
From: Michael Haboustak <[email protected]>
Date: 1125897121 -0500

Fixes handling of multi-transaction reports for HID devices. New function hid_size_buffers() that calculates the longest report for each endpoint and stores the result in the hid_device object. These lengths are used to allocate buffers that are large enough to store any report on the endpoint. For compatibility, the minimum size for an endpoint buffer set to HID_BUFFER_SIZE rather than the known optimal case (the longest report length).

It fixes bug #3063 in bugzilla.

I simplified the patch a bit to use just a single buffer size.

---

 drivers/usb/input/hid-core.c |   62 ++++++++++++++++++++++++++++++------------
 drivers/usb/input/hid.h      |    5 +++
 2 files changed, 48 insertions(+), 19 deletions(-)

bf0964dcda97e42964d312d0ff73a832171e080a

drivers/usb/input/hid-core.c +44 -18
@@ -2,7 +2,8 @@
  *  USB HID support for Linux
  *
  *  Copyright (c) 1999 Andreas Gal
- *  Copyright (c) 2000-2001 Vojtech Pavlik <[email protected]>
+ *  Copyright (c) 2000-2005 Vojtech Pavlik <[email protected]>
+ *  Copyright (c) 2005 Michael Haboustak <[email protected]> for Concept2, Inc
  */
 
 /*
@@ -38,7 +39,7 @@
  * Version Information
  */
 
-#define DRIVER_VERSION "v2.01"
+#define DRIVER_VERSION "v2.6"
 #define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik"
 #define DRIVER_DESC "USB HID core driver"
 #define DRIVER_LICENSE "GPL"
@@ -1058,8 +1059,8 @@ static int hid_submit_ctrl(struct hid_de
 		if (maxpacket > 0) {
 			padlen = (len + maxpacket - 1) / maxpacket;
 			padlen *= maxpacket;
-			if (padlen > HID_BUFFER_SIZE)
-				padlen = HID_BUFFER_SIZE;
+			if (padlen > hid->bufsize)
+				padlen = hid->bufsize;
 		} else
 			padlen = 0;
 		hid->urbctrl->transfer_buffer_length = padlen;
@@ -1284,13 +1285,8 @@ void hid_init_reports(struct hid_device 
 	struct hid_report *report;
 	int err, ret;
 
-	list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list) {
-		int size = ((report->size - 1) >> 3) + 1 + hid->report_enum[HID_INPUT_REPORT].numbered;
-		if (size > HID_BUFFER_SIZE) size = HID_BUFFER_SIZE;
-		if (size > hid->urbin->transfer_buffer_length)
-			hid->urbin->transfer_buffer_length = size;
+	list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list)
 		hid_submit_report(hid, report, USB_DIR_IN);
-	}
 
 	list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT].report_list, list)
 		hid_submit_report(hid, report, USB_DIR_IN);
@@ -1564,15 +1560,32 @@ static struct hid_blacklist {
 	{ 0, 0 }
 };
 
+/*
+ * Traverse the supplied list of reports and find the longest
+ */
+static void hid_find_max_report(struct hid_device *hid, unsigned int type, int *max)
+{
+	struct hid_report *report;
+	int size;
+
+	list_for_each_entry(report, &hid->report_enum[type].report_list, list) {
+		size = ((report->size - 1) >> 3) + 1;
+		if (type == HID_INPUT_REPORT && hid->report_enum[type].numbered)
+			size++;
+		if (*max < size)
+			*max = size;
+	}
+}
+
 static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid)
 {
-	if (!(hid->inbuf = usb_buffer_alloc(dev, HID_BUFFER_SIZE, SLAB_ATOMIC, &hid->inbuf_dma)))
+	if (!(hid->inbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->inbuf_dma)))
 		return -1;
-	if (!(hid->outbuf = usb_buffer_alloc(dev, HID_BUFFER_SIZE, SLAB_ATOMIC, &hid->outbuf_dma)))
+	if (!(hid->outbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->outbuf_dma)))
 		return -1;
 	if (!(hid->cr = usb_buffer_alloc(dev, sizeof(*(hid->cr)), SLAB_ATOMIC, &hid->cr_dma)))
 		return -1;
-	if (!(hid->ctrlbuf = usb_buffer_alloc(dev, HID_BUFFER_SIZE, SLAB_ATOMIC, &hid->ctrlbuf_dma)))
+	if (!(hid->ctrlbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->ctrlbuf_dma)))
 		return -1;
 
 	return 0;
@@ -1581,13 +1594,13 @@ static int hid_alloc_buffers(struct usb_
 static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid)
 {
 	if (hid->inbuf)
-		usb_buffer_free(dev, HID_BUFFER_SIZE, hid->inbuf, hid->inbuf_dma);
+		usb_buffer_free(dev, hid->bufsize, hid->inbuf, hid->inbuf_dma);
 	if (hid->outbuf)
-		usb_buffer_free(dev, HID_BUFFER_SIZE, hid->outbuf, hid->outbuf_dma);
+		usb_buffer_free(dev, hid->bufsize, hid->outbuf, hid->outbuf_dma);
 	if (hid->cr)
 		usb_buffer_free(dev, sizeof(*(hid->cr)), hid->cr, hid->cr_dma);
 	if (hid->ctrlbuf)
-		usb_buffer_free(dev, HID_BUFFER_SIZE, hid->ctrlbuf, hid->ctrlbuf_dma);
+		usb_buffer_free(dev, hid->bufsize, hid->ctrlbuf, hid->ctrlbuf_dma);
 }
 
 static struct hid_device *usb_hid_configure(struct usb_interface *intf)
@@ -1598,7 +1611,7 @@ static struct hid_device *usb_hid_config
 	struct hid_device *hid;
 	unsigned quirks = 0, rsize = 0;
 	char *buf, *rdesc;
-	int n;
+	int n, insize = 0;
 
 	for (n = 0; hid_blacklist[n].idVendor; n++)
 		if ((hid_blacklist[n].idVendor == le16_to_cpu(dev->descriptor.idVendor)) &&
@@ -1652,6 +1665,19 @@ static struct hid_device *usb_hid_config
 	kfree(rdesc);
 	hid->quirks = quirks;
 
+	hid->bufsize = HID_MIN_BUFFER_SIZE;
+	hid_find_max_report(hid, HID_INPUT_REPORT, &hid->bufsize);
+	hid_find_max_report(hid, HID_OUTPUT_REPORT, &hid->bufsize);
+	hid_find_max_report(hid, HID_FEATURE_REPORT, &hid->bufsize);
+
+	if (hid->bufsize > HID_MAX_BUFFER_SIZE)
+		hid->bufsize = HID_MAX_BUFFER_SIZE;
+
+	hid_find_max_report(hid, HID_INPUT_REPORT, &insize);
+
+	if (insize > HID_MAX_BUFFER_SIZE)
+		insize = HID_MAX_BUFFER_SIZE;
+
 	if (hid_alloc_buffers(dev, hid)) {
 		hid_free_buffers(dev, hid);
 		goto fail;
@@ -1682,7 +1708,7 @@ static struct hid_device *usb_hid_config
 			if (!(hid->urbin = usb_alloc_urb(0, GFP_KERNEL)))
 				goto fail;
 			pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
-			usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, 0,
+			usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, insize,
 					 hid_irq_in, hid, interval);
 			hid->urbin->transfer_dma = hid->inbuf_dma;
 			hid->urbin->transfer_flags |=(URB_NO_TRANSFER_DMA_MAP | URB_ASYNC_UNLINK);
drivers/usb/input/hid.h +4 -1
@@ -351,7 +351,8 @@ struct hid_report_enum {
 
 #define HID_REPORT_TYPES 3
 
-#define HID_BUFFER_SIZE		64		/* use 64 for compatibility with all possible packetlen */
+#define HID_MIN_BUFFER_SIZE	64		/* make sure there is at least a packet size of space */
+#define HID_MAX_BUFFER_SIZE	4096		/* 4kb */
 #define HID_CONTROL_FIFO_SIZE	256		/* to init devices with >100 reports */
 #define HID_OUTPUT_FIFO_SIZE	64
 
@@ -389,6 +390,8 @@ struct hid_device {							/* device repo
 
 	unsigned long iofl;						/* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
 
+	unsigned int bufsize;						/* URB buffer size */
+
 	struct urb *urbin;						/* Input URB */
 	char *inbuf;							/* Input buffer */
 	dma_addr_t inbuf_dma;						/* Input buffer dma */
#16 lore raw

PATCH 16/26 HID - add support for Logitech UltraX Media Remote control

Subject: [PATCH] Input: HID - add support for Logitech UltraX Media Remote control
From: Micah F. Galizia <[email protected]>
Date: 1125897135 -0500

The hid now supports the Logitech UltraX Media Remote control. For now, ID 45 on the consumer usage page has been incorrectly mapped to KEY_RADIO since no other devices uses it.

---

 drivers/usb/input/hid-input.c |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

39fd748f56012fdde4cf862f127ce4cdec50d661

drivers/usb/input/hid-input.c +26 -2
@@ -247,6 +247,7 @@ static void hidinput_configure_usage(str
 				case 0x000: goto ignore;
 				case 0x034: map_key_clear(KEY_SLEEP);		break;
 				case 0x036: map_key_clear(BTN_MISC);		break;
+				case 0x045: map_key_clear(KEY_RADIO);		break;
 				case 0x08a: map_key_clear(KEY_WWW);		break;
 				case 0x08d: map_key_clear(KEY_PROGRAM);		break;
 				case 0x095: map_key_clear(KEY_HELP);		break;
@@ -318,10 +319,33 @@ static void hidinput_configure_usage(str
 
 		case HID_UP_MSVENDOR:
 		case HID_UP_LOGIVENDOR:
-		case HID_UP_LOGIVENDOR2:
-
 			goto ignore;
 
+		case HID_UP_LOGIVENDOR2: /* Reported on Logitech Ultra X Media Remote */
+
+			set_bit(EV_REP, input->evbit);
+			switch(usage->hid & HID_USAGE) {
+				case 0x004: map_key_clear(KEY_AGAIN);		break;
+				case 0x00d: map_key_clear(KEY_HOME);		break;
+				case 0x024: map_key_clear(KEY_SHUFFLE);		break;
+				case 0x025: map_key_clear(KEY_TV);		break;
+				case 0x026: map_key_clear(KEY_MENU);		break;
+				case 0x031: map_key_clear(KEY_AUDIO);		break;
+				case 0x032: map_key_clear(KEY_SUBTITLE);	break;
+				case 0x033: map_key_clear(KEY_LAST);		break;
+				case 0x047: map_key_clear(KEY_MP3);		break;
+				case 0x048: map_key_clear(KEY_DVD);		break;
+				case 0x049: map_key_clear(KEY_MEDIA);		break;
+				case 0x04a: map_key_clear(KEY_VIDEO);		break;
+				case 0x04b: map_key_clear(KEY_ANGLE);		break;
+				case 0x04c: map_key_clear(KEY_LANGUAGE);	break;
+				case 0x04d: map_key_clear(KEY_SUBTITLE);	break;
+				case 0x051: map_key_clear(KEY_RED);		break;
+				case 0x052: map_key_clear(KEY_CLOSE);		break;
+				default:    goto ignore;
+			}
+			break;
+
 		case HID_UP_PID:
 
 			set_bit(EV_FF, input->evbit);
#17 lore raw

PATCH 17/26 iforce - use wait_event_interruptible_timeout

Subject: [PATCH] Input: iforce - use wait_event_interruptible_timeout
From: Vojtech Pavlik <[email protected]>
Date: 1125897159 -0500

The timeout while() loops in iforce-packets.c lack a set_current_state(TASK_INTERRUPTIBLE); call. The right solution is to replace them with wait_event_interruptible_timeout().

---

 drivers/input/joystick/iforce/iforce-packets.c |   32 +++++-------------------
 drivers/input/joystick/iforce/iforce-usb.c     |    1 +
 2 files changed, 8 insertions(+), 25 deletions(-)

fb76b099f86624d3c629cfab071aa2296f65b7bb

drivers/input/joystick/iforce/iforce-packets.c +7 -25
@@ -249,9 +249,6 @@ void iforce_process_packet(struct iforce
 
 int iforce_get_id_packet(struct iforce *iforce, char *packet)
 {
-	DECLARE_WAITQUEUE(wait, current);
-	int timeout = HZ; /* 1 second */
-
 	switch (iforce->bus) {
 
 	case IFORCE_USB:
@@ -260,22 +257,13 @@ int iforce_get_id_packet(struct iforce *
 		iforce->cr.bRequest = packet[0];
 		iforce->ctrl->dev = iforce->usbdev;
 
-		set_current_state(TASK_INTERRUPTIBLE);
-		add_wait_queue(&iforce->wait, &wait);
-
-		if (usb_submit_urb(iforce->ctrl, GFP_ATOMIC)) {
-			set_current_state(TASK_RUNNING);
-			remove_wait_queue(&iforce->wait, &wait);
+		if (usb_submit_urb(iforce->ctrl, GFP_ATOMIC))
 			return -1;
-		}
 
-		while (timeout && iforce->ctrl->status == -EINPROGRESS)
-			timeout = schedule_timeout(timeout);
+		wait_event_interruptible_timeout(iforce->wait,
+			iforce->ctrl->status != -EINPROGRESS, HZ);
 
-		set_current_state(TASK_RUNNING);
-		remove_wait_queue(&iforce->wait, &wait);
-
-		if (!timeout) {
+		if (iforce->ctrl->status != -EINPROGRESS) {
 			usb_unlink_urb(iforce->ctrl);
 			return -1;
 		}
@@ -290,16 +278,10 @@ int iforce_get_id_packet(struct iforce *
 		iforce->expect_packet = FF_CMD_QUERY;
 		iforce_send_packet(iforce, FF_CMD_QUERY, packet);
 
-		set_current_state(TASK_INTERRUPTIBLE);
-		add_wait_queue(&iforce->wait, &wait);
-
-		while (timeout && iforce->expect_packet)
-			timeout = schedule_timeout(timeout);
-
-		set_current_state(TASK_RUNNING);
-		remove_wait_queue(&iforce->wait, &wait);
+		wait_event_interruptible_timeout(iforce->wait,
+			!iforce->expect_packet, HZ);
 
-		if (!timeout) {
+		if (iforce->expect_packet) {
 			iforce->expect_packet = 0;
 			return -1;
 		}
drivers/input/joystick/iforce/iforce-usb.c +1 -0
@@ -95,6 +95,7 @@ static void iforce_usb_irq(struct urb *u
 		goto exit;
 	}
 
+	wake_up(&iforce->wait);
 	iforce_process_packet(iforce,
 		(iforce->data[0] << 8) | (urb->actual_length - 1), iforce->data + 1, regs);
 
#18 lore raw

PATCH 18/26 sunkbd - extend mapping to handle Type-6 Sun keyboards

Subject: [PATCH] Input: sunkbd - extend mapping to handle Type-6 Sun keyboards
From: Vojtech Pavlik <[email protected]>
Date: 1125897167 -0500

Map an unmarked key at 'Esc' position to KEY_MACRO

---

 drivers/input/keyboard/sunkbd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

8d9a9ae3b2941d94bb0023a3aca2ec2bfa83d0c2

drivers/input/keyboard/sunkbd.c +1 -1
@@ -44,7 +44,7 @@ MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
 static unsigned char sunkbd_keycode[128] = {
-	  0,128,114,129,115, 59, 60, 68, 61, 87, 62, 88, 63,100, 64,  0,
+	  0,128,114,129,115, 59, 60, 68, 61, 87, 62, 88, 63,100, 64,112,
 	 65, 66, 67, 56,103,119, 99, 70,105,130,131,108,106,  1,  2,  3,
 	  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 41, 14,110,113, 98, 55,
 	116,132, 83,133,102, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
#19 lore raw

PATCH 19/26 HID - fix URB success status handling

Subject: [PATCH] Input: HID - fix URB success status handling
From: Vojtech Pavlik <[email protected]>
Date: 1125897183 -0500

Add a missing break; statement to the URB status handling in hid-core.c, avoiding flushing the request queue on success.

---

 drivers/usb/input/hid-core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

c4786ca8a4274a0bbffe217917972943348bed64

drivers/usb/input/hid-core.c +2 -0
@@ -1097,6 +1097,7 @@ static void hid_irq_out(struct urb *urb,
 
 	switch (urb->status) {
 		case 0:			/* success */
+			break;
 		case -ESHUTDOWN:	/* unplug */
 		case -EILSEQ:		/* unplug timeout on uhci */
 			unplug = 1;
@@ -1144,6 +1145,7 @@ static void hid_ctrl(struct urb *urb, st
 		case 0:			/* success */
 			if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN)
 				hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, 0, regs);
+			break;
 		case -ESHUTDOWN:	/* unplug */
 		case -EILSEQ:		/* unplug timectrl on uhci */
 			unplug = 1;
#20 lore raw

PATCH 20/26 HID - add a quirk for the Apple Powermouse

Subject: [PATCH] Input: HID - add a quirk for the Apple Powermouse
From: Vojtech Pavlik <[email protected]>
Date: 1125897195 -0500

Add a quirk for the Apple Powermouse, remapping GenericDesktop.Z to Rel.HWheel, to allow horizontal scrolling in Linux.

---

 drivers/usb/input/hid-core.c  |    3 +++
 drivers/usb/input/hid-input.c |    3 +++
 drivers/usb/input/hid.h       |    1 +
 3 files changed, 7 insertions(+), 0 deletions(-)

c58de6d949a9d2c386c4d814013b6c967c14ea5a

drivers/usb/input/hid-core.c +3 -0
@@ -1442,6 +1442,8 @@ void hid_init_reports(struct hid_device 
 #define USB_DEVICE_ID_NETWORKANALYSER	0x2020
 #define USB_DEVICE_ID_POWERCONTROL	0x2030
 
+#define USB_VENDOR_ID_APPLE		0x05ac
+#define USB_DEVICE_ID_APPLE_POWERMOUSE	0x0304
 
 /*
  * Alphabetically sorted blacklist by quirk type.
@@ -1546,6 +1548,7 @@ static struct hid_blacklist {
 	{ USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET},
 	{ USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET },
 
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_POWERMOUSE, HID_QUIRK_2WHEEL_POWERMOUSE },
 	{ USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 },
 	{ USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 },
 
drivers/usb/input/hid-input.c +3 -0
@@ -396,6 +396,9 @@ static void hidinput_configure_usage(str
 	if (usage->code > max)
 		goto ignore;
 
+	if (((device->quirks & (HID_QUIRK_2WHEEL_POWERMOUSE)) && (usage->hid == 0x00010032)))
+		map_rel(REL_HWHEEL);
+
 	if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) &&
 		 (usage->type == EV_REL) && (usage->code == REL_WHEEL))
 			set_bit(REL_HWHEEL, bit);
drivers/usb/input/hid.h +1 -0
@@ -245,6 +245,7 @@ struct hid_item {
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_7		0x080
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_5		0x100
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON		0x200
+#define HID_QUIRK_2WHEEL_POWERMOUSE		0x400
 
 /*
  * This is the global environment of the parser. This information is
#21 lore raw

PATCH 21/26 HID - add the Trust Predator TH 400 gamepad to the badpad list

Subject: [PATCH] Input: HID - add the Trust Predator TH 400 gamepad to the badpad list
From: Vojtech Pavlik <[email protected]>
Date: 1125897212 -0500

---

 drivers/usb/input/hid-core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

61cdecd9f5f602775af1e89c200179d093a94ae2

drivers/usb/input/hid-core.c +3 -1
@@ -1370,8 +1370,9 @@ void hid_init_reports(struct hid_device 
 #define USB_VENDOR_ID_A4TECH		0x09da
 #define USB_DEVICE_ID_A4TECH_WCP32PU	0x0006
 
-#define USB_VENDOR_ID_AASHIMA		0x06D6
+#define USB_VENDOR_ID_AASHIMA		0x06d6
 #define USB_DEVICE_ID_AASHIMA_GAMEPAD	0x0025
+#define USB_DEVICE_ID_AASHIMA_PREDATOR	0x0026
 
 #define USB_VENDOR_ID_CYPRESS		0x04b4
 #define USB_DEVICE_ID_CYPRESS_MOUSE	0x0001
@@ -1553,6 +1554,7 @@ static struct hid_blacklist {
 	{ USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 },
 
 	{ USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD },
+	{ USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD },
 	{ USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD },
 	{ USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD },
 	{ USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
#22 lore raw

PATCH 22/26 HID - add mapping for Powerbook USB keyboard

Subject: [PATCH] Input: HID - add mapping for Powerbook USB keyboard
From: Stelian Pop <[email protected]>
Date: 1125903453 -0500

Map custom HID events (such as the ones generated by some Logitech and Apple Powerbooks USB keyboards) to the FN keycode.

---

 drivers/usb/input/hid-input.c |   12 ++++++++++--
 drivers/usb/input/hid.h       |    4 ++--
 2 files changed, 12 insertions(+), 4 deletions(-)

e875ce374759087771313c9e76b672b86ac20950

drivers/usb/input/hid-input.c +10 -2
@@ -318,10 +318,18 @@ static void hidinput_configure_usage(str
 			break;
 
 		case HID_UP_MSVENDOR:
-		case HID_UP_LOGIVENDOR:
 			goto ignore;
 
-		case HID_UP_LOGIVENDOR2: /* Reported on Logitech Ultra X Media Remote */
+		case HID_UP_CUSTOM: /* Reported on Logitech and Powerbook USB keyboards */
+
+			set_bit(EV_REP, input->evbit);
+			switch(usage->hid & HID_USAGE) {
+				case 0x003: map_key_clear(KEY_FN);		break;
+				default:    goto ignore;
+			}
+			break;
+
+		case HID_UP_LOGIVENDOR: /* Reported on Logitech Ultra X Media Remote */
 
 			set_bit(EV_REP, input->evbit);
 			switch(usage->hid & HID_USAGE) {
drivers/usb/input/hid.h +2 -2
@@ -183,8 +183,8 @@ struct hid_item {
 #define HID_UP_PID		0x000f0000
 #define HID_UP_HPVENDOR         0xff7f0000
 #define HID_UP_MSVENDOR		0xff000000
-#define HID_UP_LOGIVENDOR	0x00ff0000
-#define HID_UP_LOGIVENDOR2	0xffbc0000
+#define HID_UP_CUSTOM		0x00ff0000
+#define HID_UP_LOGIVENDOR	0xffbc0000
 
 #define HID_USAGE		0x0000ffff
 
#23 lore raw

PATCH 23/26 HID - add Wireless Security Lock to HID blacklist

Subject: [PATCH] Input: HID - add Wireless Security Lock to HID blacklist
From: Brian Schau <[email protected]>
Date: 1125903461 -0500

The device is a Wireless Security Lock (WSL). The device identifies itself as a Cypress Ultra Mouse. It is, however, not a mouse at all and as such, shouldn't be handled as one.

---

 drivers/usb/input/hid-core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

7d25258f69cedc2f2e55eb25ba2e2078060b44f4

drivers/usb/input/hid-core.c +2 -0
@@ -1377,6 +1377,7 @@ void hid_init_reports(struct hid_device 
 #define USB_VENDOR_ID_CYPRESS		0x04b4
 #define USB_DEVICE_ID_CYPRESS_MOUSE	0x0001
 #define USB_DEVICE_ID_CYPRESS_HIDCOM	0x5500
+#define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE	0x7417
 
 #define USB_VENDOR_ID_BERKSHIRE		0x0c98
 #define USB_DEVICE_ID_BERKSHIRE_PCWD	0x1140
@@ -1469,6 +1470,7 @@ static struct hid_blacklist {
 	{ USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW48, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW28, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5, HID_QUIRK_IGNORE },
#24 lore raw

PATCH 24/26 HIDDEV - make HIDIOCSREPORT wait IO completion

Subject: [PATCH] Input: HIDDEV - make HIDIOCSREPORT wait IO completion
From: Stefan Nickl <[email protected]>
Date: 1125903466 -0500

When trying to make the hiddev driver issue several Set_Report control transfers to a custom device with 2.6.13-rc6, only the first transfer in a row is carried out, while others immediately following it are silently dropped.

This happens where hid_submit_report() (in hid-core.c) tests for HID_CTRL_RUNNING, which seems to be still set because the first transfer is not finished yet.

As a workaround, inserting a delay between the two calls to ioctl(HIDIOCSREPORT) in userspace "solves" the problem. The straightforward fix is to add a call to hid_wait_io() to the implementation of HIDIOCSREPORT (in hiddev.c), just like for HIDIOCGREPORT. Works fine for me.

Apparently, this issue has some history:
http://marc.theaimsgroup.com/?l=linux-usb-users&m=111100670105558&w=2

---

 drivers/usb/input/hiddev.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

010988e888a0abbe7118635c1b33d049caae6b29

drivers/usb/input/hiddev.c +1 -0
@@ -507,6 +507,7 @@ static int hiddev_ioctl(struct inode *in
 			return -EINVAL;
 
 		hid_submit_report(hid, report, USB_DIR_OUT);
+		hid_wait_io(hid);
 
 		return 0;
 
#25 lore raw

PATCH 25/26 clean up whitespace and formatting in drivers/char/keyboard.c

Subject: [PATCH] Input: clean up whitespace and formatting in drivers/char/keyboard.c
From: Dmitry Torokhov <[email protected]>
Date: 1126371818 -0500

---

 drivers/char/keyboard.c |  109 ++++++++++++++++++++++++-----------------------
 1 files changed, 55 insertions(+), 54 deletions(-)

fe1e86049813641a518d15adf7191bd711b4f611

drivers/char/keyboard.c +55 -54
@@ -14,7 +14,7 @@
  * `Sticky' modifier keys, 951006.
  *
  * 11-11-96: SAK should now work in the raw mode (Martin Mares)
- * 
+ *
  * Modified to provide 'generic' keyboard support by Hamish Macdonald
  * Merge with the m68k keyboard driver and split-off of the PC low-level
  * parts by Geert Uytterhoeven, May 1997
@@ -52,7 +52,7 @@ extern void ctrl_alt_del(void);
 /*
  * Some laptops take the 789uiojklm,. keys as number pad when NumLock is on.
  * This seems a good reason to start with NumLock off. On HIL keyboards
- * of PARISC machines however there is no NumLock key and everyone expects the keypad 
+ * of PARISC machines however there is no NumLock key and everyone expects the keypad
  * to be used for numbers.
  */
 
@@ -76,17 +76,17 @@ void compute_shiftstate(void);
 	k_meta,		k_ascii,	k_lock,		k_lowercase,\
 	k_slock,	k_dead2,	k_ignore,	k_ignore
 
-typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value, 
+typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value,
 			    char up_flag, struct pt_regs *regs);
 static k_handler_fn K_HANDLERS;
 static k_handler_fn *k_handler[16] = { K_HANDLERS };
 
 #define FN_HANDLERS\
-	fn_null, 	fn_enter,	fn_show_ptregs,	fn_show_mem,\
-	fn_show_state,	fn_send_intr, 	fn_lastcons, 	fn_caps_toggle,\
-	fn_num,		fn_hold, 	fn_scroll_forw,	fn_scroll_back,\
-	fn_boot_it, 	fn_caps_on, 	fn_compose,	fn_SAK,\
-	fn_dec_console, fn_inc_console, fn_spawn_con, 	fn_bare_num
+	fn_null,	fn_enter,	fn_show_ptregs,	fn_show_mem,\
+	fn_show_state,	fn_send_intr,	fn_lastcons,	fn_caps_toggle,\
+	fn_num,		fn_hold,	fn_scroll_forw,	fn_scroll_back,\
+	fn_boot_it,	fn_caps_on,	fn_compose,	fn_SAK,\
+	fn_dec_console, fn_inc_console, fn_spawn_con,	fn_bare_num
 
 typedef void (fn_handler_fn)(struct vc_data *vc, struct pt_regs *regs);
 static fn_handler_fn FN_HANDLERS;
@@ -159,13 +159,13 @@ static int sysrq_alt;
  */
 int getkeycode(unsigned int scancode)
 {
-	struct list_head * node;
+	struct list_head *node;
 	struct input_dev *dev = NULL;
 
-	list_for_each(node,&kbd_handler.h_list) {
-		struct input_handle * handle = to_handle_h(node);
-		if (handle->dev->keycodesize) { 
-			dev = handle->dev; 
+	list_for_each(node, &kbd_handler.h_list) {
+		struct input_handle *handle = to_handle_h(node);
+		if (handle->dev->keycodesize) {
+			dev = handle->dev;
 			break;
 		}
 	}
@@ -181,15 +181,15 @@ int getkeycode(unsigned int scancode)
 
 int setkeycode(unsigned int scancode, unsigned int keycode)
 {
-	struct list_head * node;
+	struct list_head *node;
 	struct input_dev *dev = NULL;
 	unsigned int i, oldkey;
 
-	list_for_each(node,&kbd_handler.h_list) {
+	list_for_each(node, &kbd_handler.h_list) {
 		struct input_handle *handle = to_handle_h(node);
-		if (handle->dev->keycodesize) { 
-			dev = handle->dev; 
-			break; 
+		if (handle->dev->keycodesize) {
+			dev = handle->dev;
+			break;
 		}
 	}
 
@@ -216,11 +216,11 @@ int setkeycode(unsigned int scancode, un
 }
 
 /*
- * Making beeps and bells. 
+ * Making beeps and bells.
  */
 static void kd_nosound(unsigned long ignored)
 {
-	struct list_head * node;
+	struct list_head *node;
 
 	list_for_each(node,&kbd_handler.h_list) {
 		struct input_handle *handle = to_handle_h(node);
@@ -237,12 +237,12 @@ static DEFINE_TIMER(kd_mksound_timer, kd
 
 void kd_mksound(unsigned int hz, unsigned int ticks)
 {
-	struct list_head * node;
+	struct list_head *node;
 
 	del_timer(&kd_mksound_timer);
 
 	if (hz) {
-		list_for_each_prev(node,&kbd_handler.h_list) {
+		list_for_each_prev(node, &kbd_handler.h_list) {
 			struct input_handle *handle = to_handle_h(node);
 			if (test_bit(EV_SND, handle->dev->evbit)) {
 				if (test_bit(SND_TONE, handle->dev->sndbit)) {
@@ -337,19 +337,19 @@ static void to_utf8(struct vc_data *vc, 
 	if (c < 0x80)
 		/*  0******* */
 		put_queue(vc, c);
-    	else if (c < 0x800) {
+	else if (c < 0x800) {
 		/* 110***** 10****** */
-		put_queue(vc, 0xc0 | (c >> 6)); 
+		put_queue(vc, 0xc0 | (c >> 6));
 		put_queue(vc, 0x80 | (c & 0x3f));
-    	} else {
+	} else {
 		/* 1110**** 10****** 10****** */
 		put_queue(vc, 0xe0 | (c >> 12));
 		put_queue(vc, 0x80 | ((c >> 6) & 0x3f));
 		put_queue(vc, 0x80 | (c & 0x3f));
-    	}
+	}
 }
 
-/* 
+/*
  * Called after returning from RAW mode or when changing consoles - recompute
  * shift_down[] and shift_state from key_down[] maybe called when keymap is
  * undefined, so that shiftkey release is seen
@@ -360,7 +360,7 @@ void compute_shiftstate(void)
 
 	shift_state = 0;
 	memset(shift_down, 0, sizeof(shift_down));
-	
+
 	for (i = 0; i < ARRAY_SIZE(key_down); i++) {
 
 		if (!key_down[i])
@@ -499,9 +499,9 @@ static void fn_dec_console(struct vc_dat
 	if (want_console != -1)
 		cur = want_console;
 
-	for (i = cur-1; i != cur; i--) {
+	for (i = cur - 1; i != cur; i--) {
 		if (i == -1)
-			i = MAX_NR_CONSOLES-1;
+			i = MAX_NR_CONSOLES - 1;
 		if (vc_cons_allocated(i))
 			break;
 	}
@@ -567,9 +567,9 @@ static void fn_compose(struct vc_data *v
 
 static void fn_spawn_con(struct vc_data *vc, struct pt_regs *regs)
 {
-        if (spawnpid)
-	   if(kill_proc(spawnpid, spawnsig, 1))
-	     spawnpid = 0;
+	if (spawnpid)
+		if (kill_proc(spawnpid, spawnsig, 1))
+			spawnpid = 0;
 }
 
 static void fn_SAK(struct vc_data *vc, struct pt_regs *regs)
@@ -603,8 +603,8 @@ static void k_spec(struct vc_data *vc, u
 		return;
 	if (value >= ARRAY_SIZE(fn_handler))
 		return;
-	if ((kbd->kbdmode == VC_RAW || 
-	     kbd->kbdmode == VC_MEDIUMRAW) && 
+	if ((kbd->kbdmode == VC_RAW ||
+	     kbd->kbdmode == VC_MEDIUMRAW) &&
 	     value != KVAL(K_SAK))
 		return;		/* SAK is allowed even in raw mode */
 	fn_handler[value](vc, regs);
@@ -894,11 +894,11 @@ static inline unsigned char getleds(void
 
 static void kbd_bh(unsigned long dummy)
 {
-	struct list_head * node;
+	struct list_head *node;
 	unsigned char leds = getleds();
 
 	if (leds != ledstate) {
-		list_for_each(node,&kbd_handler.h_list) {
+		list_for_each(node, &kbd_handler.h_list) {
 			struct input_handle * handle = to_handle_h(node);
 			input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01));
 			input_event(handle->dev, EV_LED, LED_NUML,    !!(leds & 0x02));
@@ -963,11 +963,11 @@ static int sparc_l1_a_state = 0;
 extern void sun_do_break(void);
 #endif
 
-static int emulate_raw(struct vc_data *vc, unsigned int keycode, 
+static int emulate_raw(struct vc_data *vc, unsigned int keycode,
 		       unsigned char up_flag)
 {
 	if (keycode > 255 || !x86_keycodes[keycode])
-		return -1; 
+		return -1;
 
 	switch (keycode) {
 		case KEY_PAUSE:
@@ -981,7 +981,7 @@ static int emulate_raw(struct vc_data *v
 		case KEY_HANJA:
 			if (!up_flag) put_queue(vc, 0xf2);
 			return 0;
-	} 
+	}
 
 	if (keycode == KEY_SYSRQ && sysrq_alt) {
 		put_queue(vc, 0x54 | up_flag);
@@ -1104,11 +1104,12 @@ static void kbd_keycode(unsigned int key
 	else
 		clear_bit(keycode, key_down);
 
-	if (rep && (!vc_kbd_mode(kbd, VC_REPEAT) || (tty && 
-		(!L_ECHO(tty) && tty->driver->chars_in_buffer(tty))))) {
+	if (rep &&
+	    (!vc_kbd_mode(kbd, VC_REPEAT) ||
+	     (tty && !L_ECHO(tty) && tty->driver->chars_in_buffer(tty)))) {
 		/*
 		 * Don't repeat a key if the input buffers are not empty and the
-		 * characters get aren't echoed locally. This makes key repeat 
+		 * characters get aren't echoed locally. This makes key repeat
 		 * usable with slow applications and under heavy loads.
 		 */
 		return;
@@ -1130,7 +1131,8 @@ static void kbd_keycode(unsigned int key
 	type = KTYP(keysym);
 
 	if (type < 0xf0) {
-		if (down && !raw_mode) to_utf8(vc, keysym);
+		if (down && !raw_mode)
+			to_utf8(vc, keysym);
 		return;
 	}
 
@@ -1154,7 +1156,7 @@ static void kbd_keycode(unsigned int key
 		kbd->slockstate = 0;
 }
 
-static void kbd_event(struct input_handle *handle, unsigned int event_type, 
+static void kbd_event(struct input_handle *handle, unsigned int event_type,
 		      unsigned int event_code, int value)
 {
 	if (event_type == EV_MSC && event_code == MSC_RAW && HW_RAW(handle->dev))
@@ -1166,15 +1168,13 @@ static void kbd_event(struct input_handl
 	schedule_console_callback();
 }
 
-static char kbd_name[] = "kbd";
-
 /*
  * When a keyboard (or other input device) is found, the kbd_connect
  * function is called. The function then looks at the device, and if it
  * likes it, it can open it and get events from it. In this (kbd_connect)
  * function, we should decide which VT to bind that keyboard to initially.
  */
-static struct input_handle *kbd_connect(struct input_handler *handler, 
+static struct input_handle *kbd_connect(struct input_handler *handler,
 					struct input_dev *dev,
 					struct input_device_id *id)
 {
@@ -1182,18 +1182,19 @@ static struct input_handle *kbd_connect(
 	int i;
 
 	for (i = KEY_RESERVED; i < BTN_MISC; i++)
-		if (test_bit(i, dev->keybit)) break;
+		if (test_bit(i, dev->keybit))
+			break;
 
-	if ((i == BTN_MISC) && !test_bit(EV_SND, dev->evbit)) 
+	if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit))
 		return NULL;
 
-	if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) 
+	if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL)))
 		return NULL;
 	memset(handle, 0, sizeof(struct input_handle));
 
 	handle->dev = dev;
 	handle->handler = handler;
-	handle->name = kbd_name;
+	handle->name = "kbd";
 
 	input_open_device(handle);
 	kbd_refresh_leds(handle);
@@ -1212,11 +1213,11 @@ static struct input_device_id kbd_ids[] 
                 .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
                 .evbit = { BIT(EV_KEY) },
         },
-	
+
 	{
                 .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
                 .evbit = { BIT(EV_SND) },
-        },	
+        },
 
 	{ },    /* Terminating entry */
 };
#26 lore raw

PATCH 26/26 i8042 - use kzalloc instead of kcalloc

Subject: [PATCH] Input: i8042 - use kzalloc instead of kcalloc
From: Dmitry Torokhov <[email protected]>
Date: 1126371882 -0500

---

 drivers/input/serio/i8042.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

d39969deee4b541be4ee5789a2e4c14511c886e2

drivers/input/serio/i8042.c +3 -3
@@ -986,7 +986,7 @@ static int __init i8042_create_kbd_port(
 	struct serio *serio;
 	struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO];
 
-	serio = kcalloc(1, sizeof(struct serio), GFP_KERNEL);
+	serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
 	if (!serio)
 		return -ENOMEM;
 
@@ -1011,7 +1011,7 @@ static int __init i8042_create_aux_port(
 	struct serio *serio;
 	struct i8042_port *port = &i8042_ports[I8042_AUX_PORT_NO];
 
-	serio = kcalloc(1, sizeof(struct serio), GFP_KERNEL);
+	serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
 	if (!serio)
 		return -ENOMEM;
 
@@ -1036,7 +1036,7 @@ static int __init i8042_create_mux_port(
 	struct serio *serio;
 	struct i8042_port *port = &i8042_ports[I8042_MUX_PORT_NO + index];
 
-	serio = kcalloc(1, sizeof(struct serio), GFP_KERNEL);
+	serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
 	if (!serio)
 		return -ENOMEM;