1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#include <linux/config.h>
28#include <linux/sched.h>
29#include <linux/errno.h>
30#include <linux/init.h>
31#include <linux/input.h>
32
33void kbd_leds(unsigned char leds)
34{
35}
36
37int kbd_setkeycode(unsigned int scancode, unsigned int keycode)
38{
39 return (scancode == keycode) ? 0 : -EINVAL;
40}
41
42int kbd_getkeycode(unsigned int scancode)
43{
44 return scancode;
45}
46
47#ifdef CONFIG_INPUT
48static unsigned char e0_keys[128] = {
49 0, 0, 0, KEY_KPCOMMA, 0, KEY_INTL3, 0, 0,
50 0, 0, 0, 0, KEY_LANG1, KEY_LANG2, 0, 0,
51 0, 0, 0, 0, 0, 0, 0, 0,
52 0, 0, 0, 0, KEY_KPENTER, KEY_RIGHTCTRL, KEY_VOLUMEUP, 0,
53 0, 0, 0, 0, 0, KEY_VOLUMEDOWN, KEY_MUTE, 0,
54 0, 0, 0, 0, 0, 0, 0, 0,
55 0, 0, 0, 0, 0, KEY_KPSLASH, 0, KEY_SYSRQ,
56 KEY_RIGHTALT, KEY_BRIGHTNESSUP, KEY_BRIGHTNESSDOWN,
57 KEY_EJECTCD, 0, 0, 0, 0,
58 0, 0, 0, 0, 0, 0, 0, KEY_HOME,
59 KEY_UP, KEY_PAGEUP, 0, KEY_LEFT, 0, KEY_RIGHT, 0, KEY_END,
60 KEY_DOWN, KEY_PAGEDOWN, KEY_INSERT, KEY_DELETE, 0, 0, 0, 0,
61 0, 0, 0, KEY_LEFTMETA, KEY_RIGHTMETA, KEY_COMPOSE, KEY_POWER, 0,
62 0, 0, 0, 0, 0, 0, 0, 0,
63 0, 0, 0, 0, 0, 0, 0, KEY_MACRO,
64 0, 0, 0, 0, 0, 0, 0, 0,
65 0, 0, 0, 0, 0, 0, 0, 0
66};
67
68int kbd_translate(unsigned char scancode, unsigned char *keycode,
69 char raw_mode)
70{
71
72
73
74
75
76 static int prev_scancode = 0;
77
78
79 if (scancode == 0xe0 || scancode == 0xe1) {
80 prev_scancode = scancode;
81 return 0;
82 }
83
84 scancode &= 0x7f;
85
86 if (prev_scancode) {
87 if (prev_scancode != 0xe0) {
88 if (prev_scancode == 0xe1 && scancode == 0x1d) {
89 prev_scancode = 0x100;
90 return 0;
91 } else if (prev_scancode == 0x100 && scancode == 0x45) {
92 *keycode = KEY_PAUSE;
93 prev_scancode = 0;
94 } else {
95 if (!raw_mode)
96 printk(KERN_INFO "keyboard: unknown e1 escape sequence\n");
97 prev_scancode = 0;
98 return 0;
99 }
100 } else {
101 prev_scancode = 0;
102 if (scancode == 0x2a || scancode == 0x36)
103 return 0;
104 }
105 if (e0_keys[scancode])
106 *keycode = e0_keys[scancode];
107 else {
108 if (!raw_mode)
109 printk(KERN_INFO "keyboard: unknown scancode e0 %02x\n",
110 scancode);
111 return 0;
112 }
113 } else {
114 switch (scancode) {
115 case 91: scancode = KEY_LINEFEED; break;
116 case 92: scancode = KEY_KPEQUAL; break;
117 case 125: scancode = KEY_INTL1; break;
118 }
119 *keycode = scancode;
120 }
121 return 1;
122}
123
124#else
125int kbd_translate(unsigned char scancode, unsigned char *keycode,
126 char raw_mode)
127{
128 *keycode = scancode;
129
130 return 1;
131}
132#endif
133
134char kbd_unexpected_up(unsigned char keycode)
135{
136 return 0x80;
137}
138
139void __init kbd_init_hw(void)
140{
141 printk("Dummy keyboard driver installed.\n");
142}
143