mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
Input: scancode in get/set_keycodes should be unsigned
The HID layer has some scan codes of the form 0xffbc0000 for logitech devices which do not work if scancode is typed as signed int, so we need to switch to unsigned it instead. While at it keycode being signed does not make much sense either. Acked-by: Márton Németh <[email protected]> Acked-by: Matthew Garrett <[email protected]> Acked-by: Jiri Kosina <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
This commit is contained in:
parent
ec62e1c8dd
commit
58b939959d
14 changed files with 88 additions and 94 deletions
|
|
@ -68,22 +68,25 @@ static const struct {
|
|||
#define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \
|
||||
&max, EV_KEY, (c))
|
||||
|
||||
static inline int match_scancode(int code, int scancode)
|
||||
static inline int match_scancode(unsigned int code, unsigned int scancode)
|
||||
{
|
||||
if (scancode == 0)
|
||||
return 1;
|
||||
return ((code & (HID_USAGE_PAGE | HID_USAGE)) == scancode);
|
||||
|
||||
return (code & (HID_USAGE_PAGE | HID_USAGE)) == scancode;
|
||||
}
|
||||
|
||||
static inline int match_keycode(int code, int keycode)
|
||||
static inline int match_keycode(unsigned int code, unsigned int keycode)
|
||||
{
|
||||
if (keycode == 0)
|
||||
return 1;
|
||||
return (code == keycode);
|
||||
|
||||
return code == keycode;
|
||||
}
|
||||
|
||||
static struct hid_usage *hidinput_find_key(struct hid_device *hid,
|
||||
int scancode, int keycode)
|
||||
unsigned int scancode,
|
||||
unsigned int keycode)
|
||||
{
|
||||
int i, j, k;
|
||||
struct hid_report *report;
|
||||
|
|
@ -105,8 +108,8 @@ static struct hid_usage *hidinput_find_key(struct hid_device *hid,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int hidinput_getkeycode(struct input_dev *dev, int scancode,
|
||||
int *keycode)
|
||||
static int hidinput_getkeycode(struct input_dev *dev,
|
||||
unsigned int scancode, unsigned int *keycode)
|
||||
{
|
||||
struct hid_device *hid = input_get_drvdata(dev);
|
||||
struct hid_usage *usage;
|
||||
|
|
@ -119,16 +122,13 @@ static int hidinput_getkeycode(struct input_dev *dev, int scancode,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int hidinput_setkeycode(struct input_dev *dev, int scancode,
|
||||
int keycode)
|
||||
static int hidinput_setkeycode(struct input_dev *dev,
|
||||
unsigned int scancode, unsigned int keycode)
|
||||
{
|
||||
struct hid_device *hid = input_get_drvdata(dev);
|
||||
struct hid_usage *usage;
|
||||
int old_keycode;
|
||||
|
||||
if (keycode < 0 || keycode > KEY_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
usage = hidinput_find_key(hid, scancode, 0);
|
||||
if (usage) {
|
||||
old_keycode = usage->code;
|
||||
|
|
|
|||
Loading…
Reference in a new issue