Re: [PATCH 5/6] Input: ati-remote2 - switch to using new keycode interface

From
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date
2010-09-15 21:13:46
Also in
linux-media
Reply to
Ville Syrjälä, 2010-09-15
On Thu, Sep 16, 2010 at 12:04:19AM +0300, Ville Syrjälä wrote:
On Mon, Sep 13, 2010 at 09:28:07AM -0700, Dmitry Torokhov wrote:
quoted
On Thu, Sep 09, 2010 at 03:40:04PM +0300, Ville Syrjälä wrote:
quoted
On Wed, Sep 08, 2010 at 12:42:05AM -0700, Dmitry Torokhov wrote:
quoted
Switch the code to use new style of getkeycode and setkeycode
methods to allow retrieving and setting keycodes not only by
their scancodes but also by index.

Signed-off-by: Dmitry Torokhov <redacted>
---

 drivers/input/misc/ati_remote2.c |   93 +++++++++++++++++++++++++++-----------
 1 files changed, 65 insertions(+), 28 deletions(-)
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index 2325765..b2e0d82 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -483,51 +483,88 @@ static void ati_remote2_complete_key(struct urb *urb)
 }
 
 static int ati_remote2_getkeycode(struct input_dev *idev,
-				  unsigned int scancode, unsigned int *keycode)
+				  struct input_keymap_entry *ke)
 {
 	struct ati_remote2 *ar2 = input_get_drvdata(idev);
 	unsigned int mode;
-	int index;
+	int offset;
+	unsigned int index;
+	unsigned int scancode;
+
+	if (ke->flags & INPUT_KEYMAP_BY_INDEX) {
+		index = ke->index;
+		if (index >= (ATI_REMOTE2_MODES - 1) *
                                               ^^^^
That -1 looks wrong. Same in setkeycode().
Yes, indeed. Thanks for noticing.
I fixed this bug locally and gave this a short whirl with my RWII.
I tried both the old and new style keycode ioctls. Everything
worked as expected.

So if you want more tags feel free to add my Acked-by and Tested-by
for this (assuming the off-by-one fix is included)
Thank you very much for reviewing and testing it Ville, I will surely
add the tags.

 and you can add my
Tested-by for patch 1/6 as well.
This one is already in public branch; I prefer not to rewind unless
there are compile or other major issues....

-- 
Dmitry
Thread (33 messages) 33 messages, 8 authors, last reply 2010-10-29
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help