21 #include <linux/module.h>
22 #include <linux/slab.h>
25 #include <linux/input.h>
26 #include <linux/serio.h>
32 #define DRIVER_DESC "AT and PS/2 keyboard driver"
38 static int atkbd_set = 2;
40 MODULE_PARM_DESC(
set,
"Select keyboard code set (2 = default, 3 = PS/2 native)");
42 #if defined(__i386__) || defined(__x86_64__) || defined(__hppa__)
43 static bool atkbd_reset;
45 static bool atkbd_reset =
true;
50 static bool atkbd_softrepeat;
54 static bool atkbd_softraw =
true;
58 static bool atkbd_scroll;
60 MODULE_PARM_DESC(scroll,
"Enable scroll-wheel on MS Office and similar keyboards");
62 static bool atkbd_extra;
66 static bool atkbd_terminal;
68 MODULE_PARM_DESC(terminal,
"Enable break codes on an IBM Terminal keyboard connected via AT/PS2");
75 #define ATKBD_KEYMAP_SIZE 512
79 #ifdef CONFIG_KEYBOARD_ATKBD_HP_KEYCODES
86 0, 67, 65, 63, 61, 59, 60, 88, 0, 68, 66, 64, 62, 15, 41,117,
87 0, 56, 42, 93, 29, 16, 2, 0, 0, 0, 44, 31, 30, 17, 3, 0,
88 0, 46, 45, 32, 18, 5, 4, 95, 0, 57, 47, 33, 20, 19, 6,183,
89 0, 49, 48, 35, 34, 21, 7,184, 0, 0, 50, 36, 22, 8, 9,185,
90 0, 51, 37, 23, 24, 11, 10, 0, 0, 52, 53, 38, 39, 25, 12, 0,
91 0, 89, 40, 0, 26, 13, 0, 0, 58, 54, 28, 27, 0, 43, 0, 85,
92 0, 86, 91, 90, 92, 0, 14, 94, 0, 79,124, 75, 71,121, 0, 0,
93 82, 83, 80, 76, 77, 72, 1, 69, 87, 78, 81, 74, 55, 73, 70, 99,
95 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
96 217,100,255, 0, 97,165, 0, 0,156, 0, 0, 0, 0, 0, 0,125,
97 173,114, 0,113, 0, 0, 0,126,128, 0, 0,140, 0, 0, 0,127,
98 159, 0,115, 0,164, 0, 0,116,158, 0,172,166, 0, 0, 0,142,
99 157, 0, 0, 0, 0, 0, 0, 0,155, 0, 98, 0, 0,163, 0, 0,
100 226, 0, 0, 0, 0, 0, 0, 0, 0,255, 96, 0, 0, 0,143, 0,
101 0, 0, 0, 0, 0, 0, 0, 0, 0,107, 0,105,102, 0, 0,112,
102 110,111,108,112,106,103, 0,119, 0,118,109, 0, 99,104,119, 0,
110 0, 0, 0, 0, 0, 0, 0, 59, 1,138,128,129,130, 15, 41, 60,
111 131, 29, 42, 86, 58, 16, 2, 61,133, 56, 44, 31, 30, 17, 3, 62,
112 134, 46, 45, 32, 18, 5, 4, 63,135, 57, 47, 33, 20, 19, 6, 64,
113 136, 49, 48, 35, 34, 21, 7, 65,137,100, 50, 36, 22, 8, 9, 66,
114 125, 51, 37, 23, 24, 11, 10, 67,126, 52, 53, 38, 39, 25, 12, 68,
115 113,114, 40, 43, 26, 13, 87, 99, 97, 54, 28, 27, 43, 43, 88, 70,
116 108,105,119,103,111,107, 14,110, 0, 79,106, 75, 71,109,102,104,
117 82, 83, 80, 76, 77, 72, 69, 98, 0, 96, 81, 0, 78, 73, 55,183,
119 184,185,186,187, 74, 94, 92, 93, 0, 0, 0,125,126,127,112, 0,
120 0,139,172,163,165,115,152,172,166,140,160,154,113,114,167,168,
124 static const unsigned short atkbd_unxlate_table[128] = {
125 0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13,
126 21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27,
127 35, 43, 52, 51, 59, 66, 75, 76, 82, 14, 18, 93, 26, 34, 33, 42,
128 50, 49, 58, 65, 73, 74, 89,124, 17, 41, 88, 5, 6, 4, 12, 3,
129 11, 2, 10, 1, 9,119,126,108,117,125,123,107,115,116,121,105,
130 114,122,112,113,127, 96, 97,120, 7, 15, 23, 31, 39, 47, 55, 63,
131 71, 79, 86, 94, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 87,111,
132 19, 25, 57, 81, 83, 92, 95, 98, 99,100,101,103,104,106,109,110
135 #define ATKBD_CMD_SETLEDS 0x10ed
136 #define ATKBD_CMD_GSCANSET 0x11f0
137 #define ATKBD_CMD_SSCANSET 0x10f0
138 #define ATKBD_CMD_GETID 0x02f2
139 #define ATKBD_CMD_SETREP 0x10f3
140 #define ATKBD_CMD_ENABLE 0x00f4
141 #define ATKBD_CMD_RESET_DIS 0x00f5
142 #define ATKBD_CMD_RESET_DEF 0x00f6
143 #define ATKBD_CMD_SETALL_MB 0x00f8
144 #define ATKBD_CMD_SETALL_MBR 0x00fa
145 #define ATKBD_CMD_RESET_BAT 0x02ff
146 #define ATKBD_CMD_RESEND 0x00fe
147 #define ATKBD_CMD_EX_ENABLE 0x10ea
148 #define ATKBD_CMD_EX_SETLEDS 0x20eb
149 #define ATKBD_CMD_OK_GETID 0x02e8
151 #define ATKBD_RET_ACK 0xfa
152 #define ATKBD_RET_NAK 0xfe
153 #define ATKBD_RET_BAT 0xaa
154 #define ATKBD_RET_EMUL0 0xe0
155 #define ATKBD_RET_EMUL1 0xe1
156 #define ATKBD_RET_RELEASE 0xf0
157 #define ATKBD_RET_HANJA 0xf1
158 #define ATKBD_RET_HANGEUL 0xf2
159 #define ATKBD_RET_ERR 0xff
161 #define ATKBD_KEY_UNKNOWN 0
162 #define ATKBD_KEY_NULL 255
164 #define ATKBD_SCR_1 0xfffe
165 #define ATKBD_SCR_2 0xfffd
166 #define ATKBD_SCR_4 0xfffc
167 #define ATKBD_SCR_8 0xfffb
168 #define ATKBD_SCR_CLICK 0xfffa
169 #define ATKBD_SCR_LEFT 0xfff9
170 #define ATKBD_SCR_RIGHT 0xfff8
172 #define ATKBD_SPECIAL ATKBD_SCR_RIGHT
174 #define ATKBD_LED_EVENT_BIT 0
175 #define ATKBD_REP_EVENT_BIT 1
177 #define ATKBD_XL_ERR 0x01
178 #define ATKBD_XL_BAT 0x02
179 #define ATKBD_XL_ACK 0x04
180 #define ATKBD_XL_NAK 0x08
181 #define ATKBD_XL_HANGEUL 0x10
182 #define ATKBD_XL_HANJA 0x20
184 static const struct {
187 } atkbd_scroll_keys[] = {
242 static void (*atkbd_platform_fixup)(
struct atkbd *,
const void *
data);
243 static void *atkbd_platform_fixup_data;
244 static unsigned int (*atkbd_platform_scancode_fixup)(
struct atkbd *,
unsigned int);
248 static ssize_t atkbd_attr_set_helper(
struct device *dev,
const char *buf,
size_t count,
249 ssize_t (*handler)(
struct atkbd *,
const char *,
size_t));
250 #define ATKBD_DEFINE_ATTR(_name) \
251 static ssize_t atkbd_show_##_name(struct atkbd *, char *); \
252 static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \
253 static ssize_t atkbd_do_show_##_name(struct device *d, \
254 struct device_attribute *attr, char *b) \
256 return atkbd_attr_show_helper(d, b, atkbd_show_##_name); \
258 static ssize_t atkbd_do_set_##_name(struct device *d, \
259 struct device_attribute *attr, const char *b, size_t s) \
261 return atkbd_attr_set_helper(d, b, s, atkbd_set_##_name); \
263 static struct device_attribute atkbd_attr_##_name = \
264 __ATTR(_name, S_IWUSR | S_IRUGO, atkbd_do_show_##_name, atkbd_do_set_##_name);
273 #define ATKBD_DEFINE_RO_ATTR(_name) \
274 static ssize_t atkbd_show_##_name(struct atkbd *, char *); \
275 static ssize_t atkbd_do_show_##_name(struct device *d, \
276 struct device_attribute *attr, char *b) \
278 return atkbd_attr_show_helper(d, b, atkbd_show_##_name); \
280 static struct device_attribute atkbd_attr_##_name = \
281 __ATTR(_name, S_IRUGO, atkbd_do_show_##_name, NULL);
285 static struct attribute *atkbd_attributes[] = {
286 &atkbd_attr_extra.attr,
287 &atkbd_attr_force_release.attr,
288 &atkbd_attr_scroll.attr,
289 &atkbd_attr_set.attr,
290 &atkbd_attr_softrepeat.attr,
291 &atkbd_attr_softraw.attr,
292 &atkbd_attr_err_count.attr,
297 .attrs = atkbd_attributes,
300 static const unsigned int xl_table[] = {
309 static bool atkbd_need_xlate(
unsigned long xl_bit,
unsigned char code)
317 if (code == xl_table[i])
328 static void atkbd_calculate_xl_bit(
struct atkbd *
atkbd,
unsigned char code)
333 if (!((code ^ xl_table[i]) & 0x7f)) {
347 static unsigned int atkbd_compat_scancode(
struct atkbd *atkbd,
unsigned int code)
349 if (atkbd->
set == 3) {
350 if (atkbd->
emul == 1)
353 code = (code & 0x7f) | ((code & 0x80) << 1);
354 if (atkbd->
emul == 1)
369 struct atkbd *atkbd = serio_get_drvdata(serio);
370 struct input_dev *dev = atkbd->
dev;
371 unsigned int code =
data;
372 int scroll = 0, hscroll = 0, click = -1;
376 dev_dbg(&serio->
dev,
"Received %02x flags %02x\n", data, flags);
378 #if !defined(__i386__) && !defined (__x86_64__)
380 dev_warn(&serio->
dev,
"Frame/parity error: %02x\n", flags);
403 if (atkbd_platform_scancode_fixup)
404 code = atkbd_platform_scancode_fixup(atkbd, code);
408 if (atkbd->
emul || atkbd_need_xlate(atkbd->
xl_bit, code)) {
414 atkbd_calculate_xl_bit(atkbd, data);
433 if (printk_ratelimit())
435 "Spurious %s on %s. "
436 "Some program might be trying to access hardware directly.\n",
441 dev_dbg(&serio->
dev,
"Keyboard on %s reports too many keys pressed.\n",
446 code = atkbd_compat_scancode(atkbd, code);
461 "Unknown key %s (%s set %d, code %#x on %s).\n",
462 atkbd->
release ?
"released" :
"pressed",
464 atkbd->
set, code, serio->
phys);
466 "Use 'setkeycodes %s%02x <keycode>' to make it known.\n",
467 code & 0x80 ?
"e0" :
"", code & 0x7f);
507 if (value &&
test_bit(code, atkbd->force_release_mask)) {
508 input_report_key(dev, keycode, 0);
517 atkbd->
release ? -scroll : scroll);
527 static int atkbd_set_repeat_rate(
struct atkbd *atkbd)
530 { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125,
531 133, 149, 167, 182, 200, 217, 232, 250, 270, 303, 333, 370, 400, 435, 470, 500 };
532 const short delay[4] =
533 { 250, 500, 750, 1000 };
535 struct input_dev *dev = atkbd->
dev;
547 param = i | (
j << 5);
551 static int atkbd_set_leds(
struct atkbd *atkbd)
553 struct input_dev *dev = atkbd->
dev;
554 unsigned char param[2];
599 atkbd_set_leds(atkbd);
602 atkbd_set_repeat_rate(atkbd);
612 static void atkbd_schedule_event_work(
struct atkbd *atkbd,
int event_bit)
631 static int atkbd_event(
struct input_dev *dev,
632 unsigned int type,
unsigned int code,
int value)
634 struct atkbd *atkbd = input_get_drvdata(dev);
660 static inline void atkbd_enable(
struct atkbd *atkbd)
662 serio_pause_rx(atkbd->
ps2dev.serio);
664 serio_continue_rx(atkbd->
ps2dev.serio);
672 static inline void atkbd_disable(
struct atkbd *atkbd)
674 serio_pause_rx(atkbd->
ps2dev.serio);
676 serio_continue_rx(atkbd->
ps2dev.serio);
683 static int atkbd_probe(
struct atkbd *atkbd)
686 unsigned char param[2];
697 "keyboard reset failed on %s\n",
698 ps2dev->
serio->phys);
707 param[0] = param[1] = 0xa5;
725 atkbd->
id = (param[0] << 8) | param[1];
729 "NCD terminal keyboards are only supported on non-translating controlelrs. "
730 "Use i8042.direct=1 to disable translation.\n");
743 static int atkbd_select_set(
struct atkbd *atkbd,
int target_set,
int allow_extra)
745 struct ps2dev *ps2dev = &atkbd->
ps2dev;
746 unsigned char param[2];
748 atkbd->
extra =
false;
758 if (atkbd->
id == 0xaca1) {
772 if (atkbd_terminal) {
781 atkbd->
id = param[0] << 8 | param[1];
804 static int atkbd_reset_state(
struct atkbd *atkbd)
806 struct ps2dev *ps2dev = &atkbd->
ps2dev;
807 unsigned char param[1];
828 static int atkbd_activate(
struct atkbd *atkbd)
830 struct ps2dev *ps2dev = &atkbd->
ps2dev;
838 "Failed to enable keyboard on %s\n",
839 ps2dev->
serio->phys);
851 static void atkbd_cleanup(
struct serio *serio)
853 struct atkbd *atkbd = serio_get_drvdata(serio);
855 atkbd_disable(atkbd);
864 static void atkbd_disconnect(
struct serio *serio)
866 struct atkbd *atkbd = serio_get_drvdata(serio);
870 atkbd_disable(atkbd);
872 input_unregister_device(atkbd->
dev);
883 serio_set_drvdata(serio,
NULL);
890 static void atkbd_apply_forced_release_keylist(
struct atkbd* atkbd,
897 for (i = 0; keys[
i] != -1
U; i++)
898 __set_bit(keys[i], atkbd->force_release_mask);
905 static unsigned int atkbd_dell_laptop_forced_release_keys[] = {
906 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93, -1
U
913 static unsigned int atkbd_hp_forced_release_keys[] = {
920 static unsigned int atkbd_samsung_forced_release_keys[] = {
921 0x82, 0x83, 0x84, 0x86, 0x88, 0x89, 0xb3, 0xf7, 0xf9, -1
U
927 static unsigned int atkbd_amilo_pi3525_forced_release_keys[] = {
928 0x20, 0xa0, 0x2e, 0xae, 0x30, 0xb0, -1
U
934 static unsigned int atkbd_amilo_xi3650_forced_release_keys[] = {
935 0x67, 0xed, 0x90, 0xa2, 0x99, 0xa4, 0xae, 0xb0, -1
U
941 static unsigned int atkdb_soltech_ta12_forced_release_keys[] = {
942 0xa0, 0xae, 0xb0, -1
U
949 static unsigned int atkbd_volume_forced_release_keys[] = {
957 static unsigned int atkbd_oqo_01plus_scancode_fixup(
struct atkbd *atkbd,
961 (code == 0x64 || code == 0x65 || code == 0x66)) {
974 static void atkbd_set_keycode_table(
struct atkbd *atkbd)
976 unsigned int scancode;
983 for (i = 0; i < 128; i++) {
984 scancode = atkbd_unxlate_table[
i];
985 atkbd->
keycode[
i] = atkbd_set2_keycode[scancode];
986 atkbd->
keycode[i | 0x80] = atkbd_set2_keycode[scancode | 0x80];
988 for (j = 0; j <
ARRAY_SIZE(atkbd_scroll_keys); j++)
989 if ((scancode | 0x80) == atkbd_scroll_keys[
j].set2)
990 atkbd->
keycode[i | 0x80] = atkbd_scroll_keys[j].keycode;
992 }
else if (atkbd->
set == 3) {
998 for (i = 0; i <
ARRAY_SIZE(atkbd_scroll_keys); i++) {
999 scancode = atkbd_scroll_keys[
i].set2;
1000 atkbd->
keycode[scancode] = atkbd_scroll_keys[
i].keycode;
1010 __set_bit(scancode, atkbd->force_release_mask);
1014 __set_bit(scancode, atkbd->force_release_mask);
1019 if (atkbd_platform_fixup)
1020 atkbd_platform_fixup(atkbd, atkbd_platform_fixup_data);
1027 static void atkbd_set_device_attrs(
struct atkbd *atkbd)
1029 struct input_dev *input_dev = atkbd->
dev;
1034 "AT Set 2 Extra keyboard");
1037 "AT %s Set %d keyboard",
1041 "%s/input0", atkbd->
ps2dev.serio->phys);
1043 input_dev->name = atkbd->
name;
1044 input_dev->phys = atkbd->
phys;
1046 input_dev->id.vendor = 0x0001;
1048 input_dev->id.version = atkbd->
id;
1049 input_dev->event = atkbd_event;
1050 input_dev->dev.parent = &atkbd->
ps2dev.serio->dev;
1052 input_set_drvdata(input_dev, atkbd);
1083 input_dev->keycode = atkbd->
keycode;
1084 input_dev->keycodesize =
sizeof(
unsigned short);
1085 input_dev->keycodemax =
ARRAY_SIZE(atkbd_set2_keycode);
1103 static int atkbd_connect(
struct serio *serio,
struct serio_driver *drv)
1105 struct atkbd *atkbd;
1106 struct input_dev *
dev;
1109 atkbd = kzalloc(
sizeof(
struct atkbd),
GFP_KERNEL);
1110 dev = input_allocate_device();
1119 switch (serio->
id.type) {
1127 atkbd->
write =
true;
1131 atkbd->
softraw = atkbd_softraw;
1133 atkbd->
scroll = atkbd_scroll;
1138 serio_set_drvdata(serio, atkbd);
1146 if (atkbd_probe(atkbd)) {
1151 atkbd->
set = atkbd_select_set(atkbd, atkbd_set, atkbd_extra);
1152 atkbd_reset_state(atkbd);
1153 atkbd_activate(atkbd);
1160 atkbd_set_keycode_table(atkbd);
1161 atkbd_set_device_attrs(atkbd);
1167 atkbd_enable(atkbd);
1169 err = input_register_device(atkbd->
dev);
1177 fail2: serio_set_drvdata(serio,
NULL);
1178 fail1: input_free_device(dev);
1188 static int atkbd_reconnect(
struct serio *serio)
1190 struct atkbd *atkbd = serio_get_drvdata(serio);
1194 if (!atkbd || !drv) {
1196 "reconnect request, but serio is disconnected, ignoring...\n");
1202 atkbd_disable(atkbd);
1205 if (atkbd_probe(atkbd))
1208 if (atkbd->
set != atkbd_select_set(atkbd, atkbd->
set, atkbd->
extra))
1211 atkbd_activate(atkbd);
1220 atkbd_set_leds(atkbd);
1222 atkbd_set_repeat_rate(atkbd);
1226 atkbd_enable(atkbd);
1263 .id_table = atkbd_serio_ids,
1264 .interrupt = atkbd_interrupt,
1265 .connect = atkbd_connect,
1266 .reconnect = atkbd_reconnect,
1267 .disconnect = atkbd_disconnect,
1268 .cleanup = atkbd_cleanup,
1271 static ssize_t atkbd_attr_show_helper(
struct device *dev,
char *buf,
1272 ssize_t (*handler)(
struct atkbd *,
char *))
1275 struct atkbd *atkbd = serio_get_drvdata(serio);
1280 static ssize_t atkbd_attr_set_helper(
struct device *dev,
const char *buf,
size_t count,
1281 ssize_t (*handler)(
struct atkbd *,
const char *,
size_t))
1284 struct atkbd *atkbd = serio_get_drvdata(serio);
1291 atkbd_disable(atkbd);
1292 retval =
handler(atkbd, buf, count);
1293 atkbd_enable(atkbd);
1300 static ssize_t atkbd_show_extra(
struct atkbd *atkbd,
char *buf)
1305 static ssize_t atkbd_set_extra(
struct atkbd *atkbd,
const char *buf,
size_t count)
1307 struct input_dev *old_dev, *new_dev;
1311 unsigned char old_set;
1323 if (atkbd->
extra != value) {
1329 old_dev = atkbd->
dev;
1330 old_extra = atkbd->
extra;
1331 old_set = atkbd->
set;
1333 new_dev = input_allocate_device();
1337 atkbd->
dev = new_dev;
1338 atkbd->
set = atkbd_select_set(atkbd, atkbd->
set, value);
1339 atkbd_reset_state(atkbd);
1340 atkbd_activate(atkbd);
1341 atkbd_set_keycode_table(atkbd);
1342 atkbd_set_device_attrs(atkbd);
1344 err = input_register_device(atkbd->
dev);
1346 input_free_device(new_dev);
1348 atkbd->
dev = old_dev;
1349 atkbd->
set = atkbd_select_set(atkbd, old_set, old_extra);
1350 atkbd_set_keycode_table(atkbd);
1351 atkbd_set_device_attrs(atkbd);
1355 input_unregister_device(old_dev);
1361 static ssize_t atkbd_show_force_release(
struct atkbd *atkbd,
char *buf)
1364 atkbd->force_release_mask, ATKBD_KEYMAP_SIZE);
1372 static ssize_t atkbd_set_force_release(
struct atkbd *atkbd,
1373 const char *buf,
size_t count)
1383 memcpy(atkbd->force_release_mask, new_mask,
sizeof(atkbd->force_release_mask));
1388 static ssize_t atkbd_show_scroll(
struct atkbd *atkbd,
char *buf)
1393 static ssize_t atkbd_set_scroll(
struct atkbd *atkbd,
const char *buf,
size_t count)
1395 struct input_dev *old_dev, *new_dev;
1407 if (atkbd->
scroll != value) {
1408 old_dev = atkbd->
dev;
1409 old_scroll = atkbd->
scroll;
1411 new_dev = input_allocate_device();
1415 atkbd->
dev = new_dev;
1417 atkbd_set_keycode_table(atkbd);
1418 atkbd_set_device_attrs(atkbd);
1420 err = input_register_device(atkbd->
dev);
1422 input_free_device(new_dev);
1424 atkbd->
scroll = old_scroll;
1425 atkbd->
dev = old_dev;
1426 atkbd_set_keycode_table(atkbd);
1427 atkbd_set_device_attrs(atkbd);
1431 input_unregister_device(old_dev);
1436 static ssize_t atkbd_show_set(
struct atkbd *atkbd,
char *buf)
1441 static ssize_t atkbd_set_set(
struct atkbd *atkbd,
const char *buf,
size_t count)
1443 struct input_dev *old_dev, *new_dev;
1446 unsigned char old_set;
1456 if (value != 2 && value != 3)
1459 if (atkbd->
set != value) {
1460 old_dev = atkbd->
dev;
1461 old_extra = atkbd->
extra;
1462 old_set = atkbd->
set;
1464 new_dev = input_allocate_device();
1468 atkbd->
dev = new_dev;
1469 atkbd->
set = atkbd_select_set(atkbd, value, atkbd->
extra);
1470 atkbd_reset_state(atkbd);
1471 atkbd_activate(atkbd);
1472 atkbd_set_keycode_table(atkbd);
1473 atkbd_set_device_attrs(atkbd);
1475 err = input_register_device(atkbd->
dev);
1477 input_free_device(new_dev);
1479 atkbd->
dev = old_dev;
1480 atkbd->
set = atkbd_select_set(atkbd, old_set, old_extra);
1481 atkbd_set_keycode_table(atkbd);
1482 atkbd_set_device_attrs(atkbd);
1486 input_unregister_device(old_dev);
1491 static ssize_t atkbd_show_softrepeat(
struct atkbd *atkbd,
char *buf)
1496 static ssize_t atkbd_set_softrepeat(
struct atkbd *atkbd,
const char *buf,
size_t count)
1498 struct input_dev *old_dev, *new_dev;
1501 bool old_softrepeat, old_softraw;
1514 old_dev = atkbd->
dev;
1518 new_dev = input_allocate_device();
1522 atkbd->
dev = new_dev;
1526 atkbd_set_device_attrs(atkbd);
1528 err = input_register_device(atkbd->
dev);
1530 input_free_device(new_dev);
1532 atkbd->
dev = old_dev;
1535 atkbd_set_device_attrs(atkbd);
1539 input_unregister_device(old_dev);
1545 static ssize_t atkbd_show_softraw(
struct atkbd *atkbd,
char *buf)
1550 static ssize_t atkbd_set_softraw(
struct atkbd *atkbd,
const char *buf,
size_t count)
1552 struct input_dev *old_dev, *new_dev;
1564 if (atkbd->
softraw != value) {
1565 old_dev = atkbd->
dev;
1568 new_dev = input_allocate_device();
1572 atkbd->
dev = new_dev;
1574 atkbd_set_device_attrs(atkbd);
1576 err = input_register_device(atkbd->
dev);
1578 input_free_device(new_dev);
1580 atkbd->
dev = old_dev;
1582 atkbd_set_device_attrs(atkbd);
1586 input_unregister_device(old_dev);
1591 static ssize_t atkbd_show_err_count(
struct atkbd *atkbd,
char *buf)
1598 atkbd_platform_fixup = atkbd_apply_forced_release_keylist;
1599 atkbd_platform_fixup_data =
id->driver_data;
1606 atkbd_platform_scancode_fixup =
id->driver_data;
1617 .callback = atkbd_setup_forced_release,
1618 .driver_data = atkbd_dell_laptop_forced_release_keys,
1625 .callback = atkbd_setup_forced_release,
1626 .driver_data = atkbd_dell_laptop_forced_release_keys,
1633 .callback = atkbd_setup_forced_release,
1634 .driver_data = atkbd_hp_forced_release_keys,
1641 .callback = atkbd_setup_forced_release,
1642 .driver_data = atkbd_volume_forced_release_keys,
1649 .callback = atkbd_setup_forced_release,
1650 .driver_data = atkbd_volume_forced_release_keys,
1657 .callback = atkbd_setup_forced_release,
1658 .driver_data = atkbd_volume_forced_release_keys,
1665 .callback = atkbd_setup_forced_release,
1666 .driver_data = atkbd_volume_forced_release_keys,
1674 .callback = atkbd_setup_forced_release,
1675 .driver_data = atkbd_volume_forced_release_keys,
1683 .callback = atkbd_setup_forced_release,
1684 .driver_data = atkbd_samsung_forced_release_keys,
1692 .callback = atkbd_setup_forced_release,
1693 .driver_data = atkbd_samsung_forced_release_keys,
1701 .callback = atkbd_setup_forced_release,
1702 .driver_data = atkbd_samsung_forced_release_keys,
1710 .callback = atkbd_setup_forced_release,
1711 .driver_data = atkbd_volume_forced_release_keys,
1719 .callback = atkbd_setup_forced_release,
1720 .driver_data = atkbd_amilo_pi3525_forced_release_keys,
1728 .callback = atkbd_setup_forced_release,
1729 .driver_data = atkbd_amilo_xi3650_forced_release_keys,
1736 .callback = atkbd_setup_forced_release,
1737 .driver_data = atkdb_soltech_ta12_forced_release_keys,
1745 .callback = atkbd_setup_scancode_fixup,
1746 .driver_data = atkbd_oqo_01plus_scancode_fixup,
1751 static int __init atkbd_init(
void)
1758 static void __exit atkbd_exit(
void)