diff mbox

[RFC] hid-magicmouse: Map inputs rather than munging input devices

Message ID 1283699801.26830.4.camel@graviton (mailing list archive)
State Accepted
Headers show

Commit Message

Michael Poole Sept. 5, 2010, 3:16 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 8791a08..3778f9b 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -278,14 +278,12 @@  static int magicmouse_raw_event(struct hid_device
*hdev,
 	struct input_dev *input = msc->input;
 	int x = 0, y = 0, ii, clicks = 0, npoints;
 
+	/* Slightly paranoid, but "input" only gets set when our
+	 * input_mapping sees the right field. */
+	if (!input)
+		return 0;
+
 	switch (data[0]) {
-	case 0x10:
-		if (size != 6)
-			return 0;
-		x = (__s16)(data[2] | data[3] << 8);
-		y = (__s16)(data[4] | data[5] << 8);
-		clicks = data[1];
-		break;
 	case TRACKPAD_REPORT_ID:
 		/* Expect four bytes of prefix, and N*9 bytes of touch data. */