Re: [PATCH] Fujitsu application panel driver
From: Dmitry Torokhov <hidden>
Date: 2007-10-28 05:30:29
Also in:
lkml
From: Dmitry Torokhov <hidden>
Date: 2007-10-28 05:30:29
Also in:
lkml
Hi Stephen, On Tuesday 23 October 2007 15:55, Stephen Hemminger wrote:
+
+static int apanel_setkeycode(struct input_dev *idev, int scancode, int keycode)
+{
+ struct apanel *ap = idev->private;
+
+ if (keycode < 0 || keycode > KEY_MAX)
+ return -EINVAL;
+
+ if (scancode < 0 || scancode >= MAX_PANEL_KEYS)
+ return -EINVAL;scancode >= idev->keycodemax is prbably better here - we don't want to allow setting keycode for unsupported buttons.
+ + clear_bit(ap->keymap[scancode], idev->keybit);
This will not work if one has same code assigned to 2 buttons. Pretty degenerate case, I know...
+ ap->keymap[scancode] = keycode; + set_bit(keycode, idev->keybit); + return 0; +}
-- Dmitry