Skip to content

Commit

Permalink
Input: atkbd - use ushort instead of uchar keymap
Browse files Browse the repository at this point in the history
Since some of the keycodes defined in input.h have values greater
than 255 we should use unsigned shorts in keymaps.

Tested-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Dmitry Torokhov committed Jun 2, 2008
1 parent 5a18c34 commit f6d6561
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/input/keyboard/atkbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and
* are loadable via an userland utility.
*/

static unsigned char atkbd_set2_keycode[512] = {
static const unsigned short atkbd_set2_keycode[512] = {

#ifdef CONFIG_KEYBOARD_ATKBD_HP_KEYCODES

Expand Down Expand Up @@ -99,7 +99,7 @@ static unsigned char atkbd_set2_keycode[512] = {
#endif
};

static unsigned char atkbd_set3_keycode[512] = {
static const unsigned short atkbd_set3_keycode[512] = {

0, 0, 0, 0, 0, 0, 0, 59, 1,138,128,129,130, 15, 41, 60,
131, 29, 42, 86, 58, 16, 2, 61,133, 56, 44, 31, 30, 17, 3, 62,
Expand All @@ -115,7 +115,7 @@ static unsigned char atkbd_set3_keycode[512] = {
148,149,147,140
};

static unsigned char atkbd_unxlate_table[128] = {
static const unsigned short atkbd_unxlate_table[128] = {
0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13,
21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27,
35, 43, 52, 51, 59, 66, 75, 76, 82, 14, 18, 93, 26, 34, 33, 42,
Expand Down Expand Up @@ -161,7 +161,7 @@ static unsigned char atkbd_unxlate_table[128] = {
#define ATKBD_SCR_LEFT 249
#define ATKBD_SCR_RIGHT 248

#define ATKBD_SPECIAL 248
#define ATKBD_SPECIAL ATKBD_SCR_RIGHT

#define ATKBD_LED_EVENT_BIT 0
#define ATKBD_REP_EVENT_BIT 1
Expand All @@ -173,7 +173,7 @@ static unsigned char atkbd_unxlate_table[128] = {
#define ATKBD_XL_HANGEUL 0x10
#define ATKBD_XL_HANJA 0x20

static struct {
static const struct {
unsigned char keycode;
unsigned char set2;
} atkbd_scroll_keys[] = {
Expand All @@ -200,7 +200,7 @@ struct atkbd {
char phys[32];

unsigned short id;
unsigned char keycode[512];
unsigned short keycode[512];
DECLARE_BITMAP(force_release_mask, 512);
unsigned char set;
unsigned char translated;
Expand Down Expand Up @@ -357,7 +357,7 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
unsigned int code = data;
int scroll = 0, hscroll = 0, click = -1;
int value;
unsigned char keycode;
unsigned short keycode;

#ifdef ATKBD_DEBUG
printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags);
Expand Down Expand Up @@ -959,16 +959,16 @@ static void atkbd_set_device_attrs(struct atkbd *atkbd)
input_dev->evbit[0] |= BIT_MASK(EV_REL);
input_dev->relbit[0] = BIT_MASK(REL_WHEEL) |
BIT_MASK(REL_HWHEEL);
set_bit(BTN_MIDDLE, input_dev->keybit);
__set_bit(BTN_MIDDLE, input_dev->keybit);
}

input_dev->keycode = atkbd->keycode;
input_dev->keycodesize = sizeof(unsigned char);
input_dev->keycodesize = sizeof(unsigned short);
input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode);

for (i = 0; i < 512; i++)
if (atkbd->keycode[i] && atkbd->keycode[i] < ATKBD_SPECIAL)
set_bit(atkbd->keycode[i], input_dev->keybit);
__set_bit(atkbd->keycode[i], input_dev->keybit);
}

/*
Expand Down
2 changes: 2 additions & 0 deletions include/linux/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ struct input_absinfo {

#define KEY_WIMAX 246

/* Range 248 - 255 is reserved for special needs of AT keyboard driver */

#define BTN_MISC 0x100
#define BTN_0 0x100
#define BTN_1 0x101
Expand Down

0 comments on commit f6d6561

Please sign in to comment.