atkbd.c (da7878d75b8520c9ae00d27dfbbce546a7bfdfbb) | atkbd.c (5a54c0115757fd98ca05efae626e6aebf54a8427) |
---|---|
1/* 2 * AT and PS/2 keyboard driver 3 * 4 * Copyright (c) 1999-2002 Vojtech Pavlik 5 */ 6 7/* 8 * This program is free software; you can redistribute it and/or modify it --- 54 unchanged lines hidden (view full) --- 63module_param_named(extra, atkbd_extra, bool, 0); 64MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards"); 65 66/* 67 * Scancode to keycode tables. These are just the default setting, and 68 * are loadable via an userland utility. 69 */ 70 | 1/* 2 * AT and PS/2 keyboard driver 3 * 4 * Copyright (c) 1999-2002 Vojtech Pavlik 5 */ 6 7/* 8 * This program is free software; you can redistribute it and/or modify it --- 54 unchanged lines hidden (view full) --- 63module_param_named(extra, atkbd_extra, bool, 0); 64MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards"); 65 66/* 67 * Scancode to keycode tables. These are just the default setting, and 68 * are loadable via an userland utility. 69 */ 70 |
71static unsigned char atkbd_set2_keycode[512] = { | 71static const unsigned short atkbd_set2_keycode[512] = { |
72 73#ifdef CONFIG_KEYBOARD_ATKBD_HP_KEYCODES 74 75/* XXX: need a more general approach */ 76 77#include "hpps2atkbd.h" /* include the keyboard scancodes */ 78 79#else --- 14 unchanged lines hidden (view full) --- 94 226, 0, 0, 0, 0, 0, 0, 0, 0,255, 96, 0, 0, 0,143, 0, 95 0, 0, 0, 0, 0, 0, 0, 0, 0,107, 0,105,102, 0, 0,112, 96 110,111,108,112,106,103, 0,119, 0,118,109, 0, 99,104,119, 0, 97 98 0, 0, 0, 65, 99, 99#endif 100}; 101 | 72 73#ifdef CONFIG_KEYBOARD_ATKBD_HP_KEYCODES 74 75/* XXX: need a more general approach */ 76 77#include "hpps2atkbd.h" /* include the keyboard scancodes */ 78 79#else --- 14 unchanged lines hidden (view full) --- 94 226, 0, 0, 0, 0, 0, 0, 0, 0,255, 96, 0, 0, 0,143, 0, 95 0, 0, 0, 0, 0, 0, 0, 0, 0,107, 0,105,102, 0, 0,112, 96 110,111,108,112,106,103, 0,119, 0,118,109, 0, 99,104,119, 0, 97 98 0, 0, 0, 65, 99, 99#endif 100}; 101 |
102static unsigned char atkbd_set3_keycode[512] = { | 102static const unsigned short atkbd_set3_keycode[512] = { |
103 104 0, 0, 0, 0, 0, 0, 0, 59, 1,138,128,129,130, 15, 41, 60, 105 131, 29, 42, 86, 58, 16, 2, 61,133, 56, 44, 31, 30, 17, 3, 62, 106 134, 46, 45, 32, 18, 5, 4, 63,135, 57, 47, 33, 20, 19, 6, 64, 107 136, 49, 48, 35, 34, 21, 7, 65,137,100, 50, 36, 22, 8, 9, 66, 108 125, 51, 37, 23, 24, 11, 10, 67,126, 52, 53, 38, 39, 25, 12, 68, 109 113,114, 40, 43, 26, 13, 87, 99, 97, 54, 28, 27, 43, 43, 88, 70, 110 108,105,119,103,111,107, 14,110, 0, 79,106, 75, 71,109,102,104, 111 82, 83, 80, 76, 77, 72, 69, 98, 0, 96, 81, 0, 78, 73, 55,183, 112 113 184,185,186,187, 74, 94, 92, 93, 0, 0, 0,125,126,127,112, 0, 114 0,139,172,163,165,115,152,172,166,140,160,154,113,114,167,168, 115 148,149,147,140 116}; 117 | 103 104 0, 0, 0, 0, 0, 0, 0, 59, 1,138,128,129,130, 15, 41, 60, 105 131, 29, 42, 86, 58, 16, 2, 61,133, 56, 44, 31, 30, 17, 3, 62, 106 134, 46, 45, 32, 18, 5, 4, 63,135, 57, 47, 33, 20, 19, 6, 64, 107 136, 49, 48, 35, 34, 21, 7, 65,137,100, 50, 36, 22, 8, 9, 66, 108 125, 51, 37, 23, 24, 11, 10, 67,126, 52, 53, 38, 39, 25, 12, 68, 109 113,114, 40, 43, 26, 13, 87, 99, 97, 54, 28, 27, 43, 43, 88, 70, 110 108,105,119,103,111,107, 14,110, 0, 79,106, 75, 71,109,102,104, 111 82, 83, 80, 76, 77, 72, 69, 98, 0, 96, 81, 0, 78, 73, 55,183, 112 113 184,185,186,187, 74, 94, 92, 93, 0, 0, 0,125,126,127,112, 0, 114 0,139,172,163,165,115,152,172,166,140,160,154,113,114,167,168, 115 148,149,147,140 116}; 117 |
118static unsigned char atkbd_unxlate_table[128] = { | 118static const unsigned short atkbd_unxlate_table[128] = { |
119 0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13, 120 21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27, 121 35, 43, 52, 51, 59, 66, 75, 76, 82, 14, 18, 93, 26, 34, 33, 42, 122 50, 49, 58, 65, 73, 74, 89,124, 17, 41, 88, 5, 6, 4, 12, 3, 123 11, 2, 10, 1, 9,119,126,108,117,125,123,107,115,116,121,105, 124 114,122,112,113,127, 96, 97,120, 7, 15, 23, 31, 39, 47, 55, 63, 125 71, 79, 86, 94, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 87,111, 126 19, 25, 57, 81, 83, 92, 95, 98, 99,100,101,103,104,106,109,110 --- 29 unchanged lines hidden (view full) --- 156#define ATKBD_SCR_1 254 157#define ATKBD_SCR_2 253 158#define ATKBD_SCR_4 252 159#define ATKBD_SCR_8 251 160#define ATKBD_SCR_CLICK 250 161#define ATKBD_SCR_LEFT 249 162#define ATKBD_SCR_RIGHT 248 163 | 119 0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13, 120 21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27, 121 35, 43, 52, 51, 59, 66, 75, 76, 82, 14, 18, 93, 26, 34, 33, 42, 122 50, 49, 58, 65, 73, 74, 89,124, 17, 41, 88, 5, 6, 4, 12, 3, 123 11, 2, 10, 1, 9,119,126,108,117,125,123,107,115,116,121,105, 124 114,122,112,113,127, 96, 97,120, 7, 15, 23, 31, 39, 47, 55, 63, 125 71, 79, 86, 94, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 87,111, 126 19, 25, 57, 81, 83, 92, 95, 98, 99,100,101,103,104,106,109,110 --- 29 unchanged lines hidden (view full) --- 156#define ATKBD_SCR_1 254 157#define ATKBD_SCR_2 253 158#define ATKBD_SCR_4 252 159#define ATKBD_SCR_8 251 160#define ATKBD_SCR_CLICK 250 161#define ATKBD_SCR_LEFT 249 162#define ATKBD_SCR_RIGHT 248 163 |
164#define ATKBD_SPECIAL 248 | 164#define ATKBD_SPECIAL ATKBD_SCR_RIGHT |
165 166#define ATKBD_LED_EVENT_BIT 0 167#define ATKBD_REP_EVENT_BIT 1 168 169#define ATKBD_XL_ERR 0x01 170#define ATKBD_XL_BAT 0x02 171#define ATKBD_XL_ACK 0x04 172#define ATKBD_XL_NAK 0x08 173#define ATKBD_XL_HANGEUL 0x10 174#define ATKBD_XL_HANJA 0x20 175 | 165 166#define ATKBD_LED_EVENT_BIT 0 167#define ATKBD_REP_EVENT_BIT 1 168 169#define ATKBD_XL_ERR 0x01 170#define ATKBD_XL_BAT 0x02 171#define ATKBD_XL_ACK 0x04 172#define ATKBD_XL_NAK 0x08 173#define ATKBD_XL_HANGEUL 0x10 174#define ATKBD_XL_HANJA 0x20 175 |
176static struct { | 176static const struct { |
177 unsigned char keycode; 178 unsigned char set2; 179} atkbd_scroll_keys[] = { 180 { ATKBD_SCR_1, 0xc5 }, 181 { ATKBD_SCR_2, 0x9d }, 182 { ATKBD_SCR_4, 0xa4 }, 183 { ATKBD_SCR_8, 0x9b }, 184 { ATKBD_SCR_CLICK, 0xe0 }, --- 10 unchanged lines hidden (view full) --- 195 struct ps2dev ps2dev; 196 struct input_dev *dev; 197 198 /* Written only during init */ 199 char name[64]; 200 char phys[32]; 201 202 unsigned short id; | 177 unsigned char keycode; 178 unsigned char set2; 179} atkbd_scroll_keys[] = { 180 { ATKBD_SCR_1, 0xc5 }, 181 { ATKBD_SCR_2, 0x9d }, 182 { ATKBD_SCR_4, 0xa4 }, 183 { ATKBD_SCR_8, 0x9b }, 184 { ATKBD_SCR_CLICK, 0xe0 }, --- 10 unchanged lines hidden (view full) --- 195 struct ps2dev ps2dev; 196 struct input_dev *dev; 197 198 /* Written only during init */ 199 char name[64]; 200 char phys[32]; 201 202 unsigned short id; |
203 unsigned char keycode[512]; | 203 unsigned short keycode[512]; |
204 DECLARE_BITMAP(force_release_mask, 512); 205 unsigned char set; 206 unsigned char translated; 207 unsigned char extra; 208 unsigned char write; 209 unsigned char softrepeat; 210 unsigned char softraw; 211 unsigned char scroll; --- 140 unchanged lines hidden (view full) --- 352static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, 353 unsigned int flags) 354{ 355 struct atkbd *atkbd = serio_get_drvdata(serio); 356 struct input_dev *dev = atkbd->dev; 357 unsigned int code = data; 358 int scroll = 0, hscroll = 0, click = -1; 359 int value; | 204 DECLARE_BITMAP(force_release_mask, 512); 205 unsigned char set; 206 unsigned char translated; 207 unsigned char extra; 208 unsigned char write; 209 unsigned char softrepeat; 210 unsigned char softraw; 211 unsigned char scroll; --- 140 unchanged lines hidden (view full) --- 352static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, 353 unsigned int flags) 354{ 355 struct atkbd *atkbd = serio_get_drvdata(serio); 356 struct input_dev *dev = atkbd->dev; 357 unsigned int code = data; 358 int scroll = 0, hscroll = 0, click = -1; 359 int value; |
360 unsigned char keycode; | 360 unsigned short keycode; |
361 362#ifdef ATKBD_DEBUG 363 printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); 364#endif 365 366#if !defined(__i386__) && !defined (__x86_64__) 367 if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { 368 printk(KERN_WARNING "atkbd.c: frame/parity error: %02x\n", flags); --- 477 unchanged lines hidden (view full) --- 846 847 if (atkbd->set == 2) 848 for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++) 849 __set_bit(forced_release_keys[i], 850 atkbd->force_release_mask); 851} 852 853/* | 361 362#ifdef ATKBD_DEBUG 363 printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); 364#endif 365 366#if !defined(__i386__) && !defined (__x86_64__) 367 if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { 368 printk(KERN_WARNING "atkbd.c: frame/parity error: %02x\n", flags); --- 477 unchanged lines hidden (view full) --- 846 847 if (atkbd->set == 2) 848 for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++) 849 __set_bit(forced_release_keys[i], 850 atkbd->force_release_mask); 851} 852 853/* |
854 * Perform fixup for HP system that doesn't generate release 855 * for its video switch 856 */ 857static void atkbd_hp_keymap_fixup(struct atkbd *atkbd) 858{ 859 const unsigned int forced_release_keys[] = { 860 0x94, 861 }; 862 int i; 863 864 if (atkbd->set == 2) 865 for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++) 866 __set_bit(forced_release_keys[i], 867 atkbd->force_release_mask); 868} 869 870/* |
|
854 * atkbd_set_keycode_table() initializes keyboard's keycode table 855 * according to the selected scancode set 856 */ 857 858static void atkbd_set_keycode_table(struct atkbd *atkbd) 859{ 860 unsigned int scancode; 861 int i, j; --- 94 unchanged lines hidden (view full) --- 956 957 input_dev->mscbit[0] = atkbd->softraw ? BIT_MASK(MSC_SCAN) : 958 BIT_MASK(MSC_RAW) | BIT_MASK(MSC_SCAN); 959 960 if (atkbd->scroll) { 961 input_dev->evbit[0] |= BIT_MASK(EV_REL); 962 input_dev->relbit[0] = BIT_MASK(REL_WHEEL) | 963 BIT_MASK(REL_HWHEEL); | 871 * atkbd_set_keycode_table() initializes keyboard's keycode table 872 * according to the selected scancode set 873 */ 874 875static void atkbd_set_keycode_table(struct atkbd *atkbd) 876{ 877 unsigned int scancode; 878 int i, j; --- 94 unchanged lines hidden (view full) --- 973 974 input_dev->mscbit[0] = atkbd->softraw ? BIT_MASK(MSC_SCAN) : 975 BIT_MASK(MSC_RAW) | BIT_MASK(MSC_SCAN); 976 977 if (atkbd->scroll) { 978 input_dev->evbit[0] |= BIT_MASK(EV_REL); 979 input_dev->relbit[0] = BIT_MASK(REL_WHEEL) | 980 BIT_MASK(REL_HWHEEL); |
964 set_bit(BTN_MIDDLE, input_dev->keybit); | 981 __set_bit(BTN_MIDDLE, input_dev->keybit); |
965 } 966 967 input_dev->keycode = atkbd->keycode; | 982 } 983 984 input_dev->keycode = atkbd->keycode; |
968 input_dev->keycodesize = sizeof(unsigned char); | 985 input_dev->keycodesize = sizeof(unsigned short); |
969 input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode); 970 971 for (i = 0; i < 512; i++) 972 if (atkbd->keycode[i] && atkbd->keycode[i] < ATKBD_SPECIAL) | 986 input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode); 987 988 for (i = 0; i < 512; i++) 989 if (atkbd->keycode[i] && atkbd->keycode[i] < ATKBD_SPECIAL) |
973 set_bit(atkbd->keycode[i], input_dev->keybit); | 990 __set_bit(atkbd->keycode[i], input_dev->keybit); |
974} 975 976/* 977 * atkbd_connect() is called when the serio module finds an interface 978 * that isn't handled yet by an appropriate device driver. We check if 979 * there is an AT keyboard out there and if yes, we register ourselves 980 * to the input module. 981 */ --- 465 unchanged lines hidden (view full) --- 1447 .ident = "Dell Latitude series", 1448 .matches = { 1449 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1450 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude"), 1451 }, 1452 .callback = atkbd_setup_fixup, 1453 .driver_data = atkbd_latitude_keymap_fixup, 1454 }, | 991} 992 993/* 994 * atkbd_connect() is called when the serio module finds an interface 995 * that isn't handled yet by an appropriate device driver. We check if 996 * there is an AT keyboard out there and if yes, we register ourselves 997 * to the input module. 998 */ --- 465 unchanged lines hidden (view full) --- 1464 .ident = "Dell Latitude series", 1465 .matches = { 1466 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1467 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude"), 1468 }, 1469 .callback = atkbd_setup_fixup, 1470 .driver_data = atkbd_latitude_keymap_fixup, 1471 }, |
1472 { 1473 .ident = "HP 2133", 1474 .matches = { 1475 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1476 DMI_MATCH(DMI_PRODUCT_NAME, "HP 2133"), 1477 }, 1478 .callback = atkbd_setup_fixup, 1479 .driver_data = atkbd_hp_keymap_fixup, 1480 }, |
|
1455 { } 1456}; 1457 1458static int __init atkbd_init(void) 1459{ 1460 dmi_check_system(atkbd_dmi_quirk_table); 1461 1462 return serio_register_driver(&atkbd_drv); 1463} 1464 1465static void __exit atkbd_exit(void) 1466{ 1467 serio_unregister_driver(&atkbd_drv); 1468} 1469 1470module_init(atkbd_init); 1471module_exit(atkbd_exit); | 1481 { } 1482}; 1483 1484static int __init atkbd_init(void) 1485{ 1486 dmi_check_system(atkbd_dmi_quirk_table); 1487 1488 return serio_register_driver(&atkbd_drv); 1489} 1490 1491static void __exit atkbd_exit(void) 1492{ 1493 serio_unregister_driver(&atkbd_drv); 1494} 1495 1496module_init(atkbd_init); 1497module_exit(atkbd_exit); |