diff options
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/atakbd.c | 157 | ||||
-rw-r--r-- | drivers/input/mouse/atarimouse.c | 18 |
2 files changed, 154 insertions, 21 deletions
diff --git a/drivers/input/keyboard/atakbd.c b/drivers/input/keyboard/atakbd.c index ded1d6ac6ff3..f948d3a14a93 100644 --- a/drivers/input/keyboard/atakbd.c +++ b/drivers/input/keyboard/atakbd.c | |||
@@ -55,7 +55,140 @@ MODULE_AUTHOR("Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>"); | |||
55 | MODULE_DESCRIPTION("Atari keyboard driver"); | 55 | MODULE_DESCRIPTION("Atari keyboard driver"); |
56 | MODULE_LICENSE("GPL"); | 56 | MODULE_LICENSE("GPL"); |
57 | 57 | ||
58 | static unsigned char atakbd_keycode[0x72]; | 58 | /* |
59 | 0x47: KP_7 71 | ||
60 | 0x48: KP_8 72 | ||
61 | 0x49: KP_9 73 | ||
62 | 0x62: KP_/ 98 | ||
63 | 0x4b: KP_4 75 | ||
64 | 0x4c: KP_5 76 | ||
65 | 0x4d: KP_6 77 | ||
66 | 0x37: KP_* 55 | ||
67 | 0x4f: KP_1 79 | ||
68 | 0x50: KP_2 80 | ||
69 | 0x51: KP_3 81 | ||
70 | 0x4a: KP_- 74 | ||
71 | 0x52: KP_0 82 | ||
72 | 0x53: KP_. 83 | ||
73 | 0x4e: KP_+ 78 | ||
74 | |||
75 | 0x67: Up 103 | ||
76 | 0x6c: Down 108 | ||
77 | 0x69: Left 105 | ||
78 | 0x6a: Right 106 | ||
79 | */ | ||
80 | |||
81 | |||
82 | static unsigned char atakbd_keycode[0x72] = { /* American layout */ | ||
83 | [0] = KEY_GRAVE, | ||
84 | [1] = KEY_ESC, | ||
85 | [2] = KEY_1, | ||
86 | [3] = KEY_2, | ||
87 | [4] = KEY_3, | ||
88 | [5] = KEY_4, | ||
89 | [6] = KEY_5, | ||
90 | [7] = KEY_6, | ||
91 | [8] = KEY_7, | ||
92 | [9] = KEY_8, | ||
93 | [10] = KEY_9, | ||
94 | [11] = KEY_0, | ||
95 | [12] = KEY_MINUS, | ||
96 | [13] = KEY_EQUAL, | ||
97 | [14] = KEY_BACKSPACE, | ||
98 | [15] = KEY_TAB, | ||
99 | [16] = KEY_Q, | ||
100 | [17] = KEY_W, | ||
101 | [18] = KEY_E, | ||
102 | [19] = KEY_R, | ||
103 | [20] = KEY_T, | ||
104 | [21] = KEY_Y, | ||
105 | [22] = KEY_U, | ||
106 | [23] = KEY_I, | ||
107 | [24] = KEY_O, | ||
108 | [25] = KEY_P, | ||
109 | [26] = KEY_LEFTBRACE, | ||
110 | [27] = KEY_RIGHTBRACE, | ||
111 | [28] = KEY_ENTER, | ||
112 | [29] = KEY_LEFTCTRL, | ||
113 | [30] = KEY_A, | ||
114 | [31] = KEY_S, | ||
115 | [32] = KEY_D, | ||
116 | [33] = KEY_F, | ||
117 | [34] = KEY_G, | ||
118 | [35] = KEY_H, | ||
119 | [36] = KEY_J, | ||
120 | [37] = KEY_K, | ||
121 | [38] = KEY_L, | ||
122 | [39] = KEY_SEMICOLON, | ||
123 | [40] = KEY_APOSTROPHE, | ||
124 | [41] = KEY_BACKSLASH, /* FIXME, '#' */ | ||
125 | [42] = KEY_LEFTSHIFT, | ||
126 | [43] = KEY_GRAVE, /* FIXME: '~' */ | ||
127 | [44] = KEY_Z, | ||
128 | [45] = KEY_X, | ||
129 | [46] = KEY_C, | ||
130 | [47] = KEY_V, | ||
131 | [48] = KEY_B, | ||
132 | [49] = KEY_N, | ||
133 | [50] = KEY_M, | ||
134 | [51] = KEY_COMMA, | ||
135 | [52] = KEY_DOT, | ||
136 | [53] = KEY_SLASH, | ||
137 | [54] = KEY_RIGHTSHIFT, | ||
138 | [55] = KEY_KPASTERISK, | ||
139 | [56] = KEY_LEFTALT, | ||
140 | [57] = KEY_SPACE, | ||
141 | [58] = KEY_CAPSLOCK, | ||
142 | [59] = KEY_F1, | ||
143 | [60] = KEY_F2, | ||
144 | [61] = KEY_F3, | ||
145 | [62] = KEY_F4, | ||
146 | [63] = KEY_F5, | ||
147 | [64] = KEY_F6, | ||
148 | [65] = KEY_F7, | ||
149 | [66] = KEY_F8, | ||
150 | [67] = KEY_F9, | ||
151 | [68] = KEY_F10, | ||
152 | [69] = KEY_ESC, | ||
153 | [70] = KEY_DELETE, | ||
154 | [71] = KEY_KP7, | ||
155 | [72] = KEY_KP8, | ||
156 | [73] = KEY_KP9, | ||
157 | [74] = KEY_KPMINUS, | ||
158 | [75] = KEY_KP4, | ||
159 | [76] = KEY_KP5, | ||
160 | [77] = KEY_KP6, | ||
161 | [78] = KEY_KPPLUS, | ||
162 | [79] = KEY_KP1, | ||
163 | [80] = KEY_KP2, | ||
164 | [81] = KEY_KP3, | ||
165 | [82] = KEY_KP0, | ||
166 | [83] = KEY_KPDOT, | ||
167 | [90] = KEY_KPLEFTPAREN, | ||
168 | [91] = KEY_KPRIGHTPAREN, | ||
169 | [92] = KEY_KPASTERISK, /* FIXME */ | ||
170 | [93] = KEY_KPASTERISK, | ||
171 | [94] = KEY_KPPLUS, | ||
172 | [95] = KEY_HELP, | ||
173 | [96] = KEY_BACKSLASH, /* FIXME: '<' */ | ||
174 | [97] = KEY_KPASTERISK, /* FIXME */ | ||
175 | [98] = KEY_KPSLASH, | ||
176 | [99] = KEY_KPLEFTPAREN, | ||
177 | [100] = KEY_KPRIGHTPAREN, | ||
178 | [101] = KEY_KPSLASH, | ||
179 | [102] = KEY_KPASTERISK, | ||
180 | [103] = KEY_UP, | ||
181 | [104] = KEY_KPASTERISK, /* FIXME */ | ||
182 | [105] = KEY_LEFT, | ||
183 | [106] = KEY_RIGHT, | ||
184 | [107] = KEY_KPASTERISK, /* FIXME */ | ||
185 | [108] = KEY_DOWN, | ||
186 | [109] = KEY_KPASTERISK, /* FIXME */ | ||
187 | [110] = KEY_KPASTERISK, /* FIXME */ | ||
188 | [111] = KEY_KPASTERISK, /* FIXME */ | ||
189 | [112] = KEY_KPASTERISK, /* FIXME */ | ||
190 | [113] = KEY_KPASTERISK /* FIXME */ | ||
191 | }; | ||
59 | 192 | ||
60 | static struct input_dev *atakbd_dev; | 193 | static struct input_dev *atakbd_dev; |
61 | 194 | ||
@@ -86,21 +219,20 @@ static int __init atakbd_init(void) | |||
86 | { | 219 | { |
87 | int i; | 220 | int i; |
88 | 221 | ||
89 | if (!ATARIHW_PRESENT(ST_MFP)) | 222 | if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP)) |
90 | return -EIO; | 223 | return -EIO; |
91 | 224 | ||
92 | // TODO: request_mem_region if not done in arch code | ||
93 | |||
94 | if (!(atakbd_dev = input_allocate_device())) | ||
95 | return -ENOMEM; | ||
96 | |||
97 | // need to init core driver if not already done so | 225 | // need to init core driver if not already done so |
98 | if (atari_keyb_init()) | 226 | if (atari_keyb_init()) |
99 | return -ENODEV; | 227 | return -ENODEV; |
100 | 228 | ||
229 | atakbd_dev = input_allocate_device(); | ||
230 | if (!atakbd_dev) | ||
231 | return -ENOMEM; | ||
232 | |||
101 | atakbd_dev->name = "Atari Keyboard"; | 233 | atakbd_dev->name = "Atari Keyboard"; |
102 | atakbd_dev->phys = "atakbd/input0"; | 234 | atakbd_dev->phys = "atakbd/input0"; |
103 | atakbd_dev->id.bustype = BUS_ATARI; | 235 | atakbd_dev->id.bustype = BUS_HOST; |
104 | atakbd_dev->id.vendor = 0x0001; | 236 | atakbd_dev->id.vendor = 0x0001; |
105 | atakbd_dev->id.product = 0x0001; | 237 | atakbd_dev->id.product = 0x0001; |
106 | atakbd_dev->id.version = 0x0100; | 238 | atakbd_dev->id.version = 0x0100; |
@@ -111,16 +243,17 @@ static int __init atakbd_init(void) | |||
111 | atakbd_dev->keycodemax = ARRAY_SIZE(atakbd_keycode); | 243 | atakbd_dev->keycodemax = ARRAY_SIZE(atakbd_keycode); |
112 | 244 | ||
113 | for (i = 1; i < 0x72; i++) { | 245 | for (i = 1; i < 0x72; i++) { |
114 | atakbd_keycode[i] = i; | ||
115 | set_bit(atakbd_keycode[i], atakbd_dev->keybit); | 246 | set_bit(atakbd_keycode[i], atakbd_dev->keybit); |
116 | } | 247 | } |
117 | 248 | ||
118 | input_register_device(atakbd_dev); | 249 | /* error check */ |
250 | if (input_register_device(atakbd_dev)) { | ||
251 | input_free_device(atakbd_dev); | ||
252 | return -ENOMEM; | ||
253 | } | ||
119 | 254 | ||
120 | atari_input_keyboard_interrupt_hook = atakbd_interrupt; | 255 | atari_input_keyboard_interrupt_hook = atakbd_interrupt; |
121 | 256 | ||
122 | printk(KERN_INFO "input: %s at IKBD ACIA\n", atakbd_dev->name); | ||
123 | |||
124 | return 0; | 257 | return 0; |
125 | } | 258 | } |
126 | 259 | ||
diff --git a/drivers/input/mouse/atarimouse.c b/drivers/input/mouse/atarimouse.c index 43ab6566fb65..c8c7244b48a1 100644 --- a/drivers/input/mouse/atarimouse.c +++ b/drivers/input/mouse/atarimouse.c | |||
@@ -73,14 +73,11 @@ static void atamouse_interrupt(char *buf) | |||
73 | { | 73 | { |
74 | int buttons, dx, dy; | 74 | int buttons, dx, dy; |
75 | 75 | ||
76 | /* ikbd_mouse_disable(); */ | ||
77 | |||
78 | buttons = (buf[0] & 1) | ((buf[0] & 2) << 1); | 76 | buttons = (buf[0] & 1) | ((buf[0] & 2) << 1); |
79 | #ifdef FIXED_ATARI_JOYSTICK | 77 | #ifdef FIXED_ATARI_JOYSTICK |
80 | buttons |= atari_mouse_buttons & 2; | 78 | buttons |= atari_mouse_buttons & 2; |
81 | atari_mouse_buttons = buttons; | 79 | atari_mouse_buttons = buttons; |
82 | #endif | 80 | #endif |
83 | /* ikbd_mouse_rel_pos(); */ | ||
84 | 81 | ||
85 | /* only relative events get here */ | 82 | /* only relative events get here */ |
86 | dx = buf[1]; | 83 | dx = buf[1]; |
@@ -126,15 +123,16 @@ static int __init atamouse_init(void) | |||
126 | if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP)) | 123 | if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP)) |
127 | return -ENODEV; | 124 | return -ENODEV; |
128 | 125 | ||
129 | if (!(atamouse_dev = input_allocate_device())) | ||
130 | return -ENOMEM; | ||
131 | |||
132 | if (!(atari_keyb_init())) | 126 | if (!(atari_keyb_init())) |
133 | return -ENODEV; | 127 | return -ENODEV; |
134 | 128 | ||
129 | atamouse_dev = input_allocate_device(); | ||
130 | if (!atamouse_dev) | ||
131 | return -ENOMEM; | ||
132 | |||
135 | atamouse_dev->name = "Atari mouse"; | 133 | atamouse_dev->name = "Atari mouse"; |
136 | atamouse_dev->phys = "atamouse/input0"; | 134 | atamouse_dev->phys = "atamouse/input0"; |
137 | atamouse_dev->id.bustype = BUS_ATARI; | 135 | atamouse_dev->id.bustype = BUS_HOST; |
138 | atamouse_dev->id.vendor = 0x0001; | 136 | atamouse_dev->id.vendor = 0x0001; |
139 | atamouse_dev->id.product = 0x0002; | 137 | atamouse_dev->id.product = 0x0002; |
140 | atamouse_dev->id.version = 0x0100; | 138 | atamouse_dev->id.version = 0x0100; |
@@ -145,9 +143,11 @@ static int __init atamouse_init(void) | |||
145 | atamouse_dev->open = atamouse_open; | 143 | atamouse_dev->open = atamouse_open; |
146 | atamouse_dev->close = atamouse_close; | 144 | atamouse_dev->close = atamouse_close; |
147 | 145 | ||
148 | input_register_device(atamouse_dev); | 146 | if (input_register_device(atamouse_dev)) { |
147 | input_free_device(atamouse_dev); | ||
148 | return -ENOMEM; | ||
149 | } | ||
149 | 150 | ||
150 | printk(KERN_INFO "input: %s at keyboard ACIA\n", atamouse_dev->name); | ||
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
153 | 153 | ||