Daniel Walker | 30 Jun 21:33

[PATCH] input: push down scancode negative checking

The getkeycode/setkeycode calls should be able to accept "negative" values.

The HID layer has some scan codes of the form 0xffbc0000 for logitech
devices, and they get ignored by these calls. I pushed the checking
into the input_default_* functions since they do need non-negative
values.

I also corrected a typo in the comment for input_set_keycode

Signed-off-by: Daniel Walker <dwalker <at> mvista.com>
---
 drivers/input/input.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 27006fc..e1af21f 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -526,7 +526,7 @@ static int input_default_getkeycode(struct input_dev *dev,
 	if (!dev->keycodesize)
 		return -EINVAL;

-	if (scancode >= dev->keycodemax)
+	if (scancode < 0 || scancode >= dev->keycodemax)
 		return -EINVAL;

 	*keycode = input_fetch_keycode(dev, scancode);
@@ -540,7 +540,7 @@ static int input_default_setkeycode(struct input_dev *dev,
 	int old_keycode;
 	int i;
(Continue reading)

Dmitry Torokhov | 30 Jun 21:47

Re: [PATCH] input: push down scancode negative checking

On Mon, Jun 30, 2008 at 12:33:46PM -0700, Daniel Walker wrote:
> The getkeycode/setkeycode calls should be able to accept "negative" values.
> 
> The HID layer has some scan codes of the form 0xffbc0000 for logitech
> devices, and they get ignored by these calls. I pushed the checking
> into the input_default_* functions since they do need non-negative
> values.
> 
> I also corrected a typo in the comment for input_set_keycode

Hmm, I wonder if we just need to type these as unsigned.

--

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Daniel Walker | 30 Jun 21:56

Re: [PATCH] input: push down scancode negative checking


On Mon, 2008-06-30 at 15:47 -0400, Dmitry Torokhov wrote:
> On Mon, Jun 30, 2008 at 12:33:46PM -0700, Daniel Walker wrote:
> > The getkeycode/setkeycode calls should be able to accept "negative" values.
> > 
> > The HID layer has some scan codes of the form 0xffbc0000 for logitech
> > devices, and they get ignored by these calls. I pushed the checking
> > into the input_default_* functions since they do need non-negative
> > values.
> > 
> > I also corrected a typo in the comment for input_set_keycode
> 
> Hmm, I wonder if we just need to type these as unsigned.
> 

I think it would make sense, because AFAIK scancodes don't really have a
concept of signed-ness anyway .. I almost did it that way, but I wasn't
sure enough about the reasoning for the signed int ..

Daniel

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Jiri Kosina | 1 Jul 09:51
Favicon

Re: [PATCH] input: push down scancode negative checking

On Mon, 30 Jun 2008, Daniel Walker wrote:

>> Hmm, I wonder if we just need to type these as unsigned.
> I think it would make sense, because AFAIK scancodes don't really have a
> concept of signed-ness anyway .. I almost did it that way, but I wasn't
> sure enough about the reasoning for the signed int ..

That would be the option I'd prefer too.

Thanks,

--

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Daniel Walker | 1 Jul 19:23

Re: [PATCH] input: push down scancode negative checking


On Tue, 2008-07-01 at 09:51 +0200, Jiri Kosina wrote:
> On Mon, 30 Jun 2008, Daniel Walker wrote:
> 
> >> Hmm, I wonder if we just need to type these as unsigned.
> > I think it would make sense, because AFAIK scancodes don't really have a
> > concept of signed-ness anyway .. I almost did it that way, but I wasn't
> > sure enough about the reasoning for the signed int ..
> 
> That would be the option I'd prefer too.

Do you guys want me to send another patch for this?

Daniel

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Dmitry Torokhov | 7 Jul 21:00

Re: [PATCH] input: push down scancode negative checking

On Tue, Jul 01, 2008 at 10:23:25AM -0700, Daniel Walker wrote:
> 
> On Tue, 2008-07-01 at 09:51 +0200, Jiri Kosina wrote:
> > On Mon, 30 Jun 2008, Daniel Walker wrote:
> > 
> > >> Hmm, I wonder if we just need to type these as unsigned.
> > > I think it would make sense, because AFAIK scancodes don't really have a
> > > concept of signed-ness anyway .. I almost did it that way, but I wasn't
> > > sure enough about the reasoning for the signed int ..
> > 
> > That would be the option I'd prefer too.
> 
> Do you guys want me to send another patch for this?
> 

Yes please.

--

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane