~galfy/helenos/bird-port-mainline

« back to all changes in this revision

Viewing changes to kernel/genarch/src/kbrd/scanc_mac.c

  • Committer: Martin Decky
  • Date: 2009-08-04 11:19:19 UTC
  • Revision ID: martin@uranus.dsrg.hide.ms.mff.cuni.cz-20090804111919-evyclddlr3v5lhmp
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2009 Jiri Svoboda
 
3
 * All rights reserved.
 
4
 *
 
5
 * Redistribution and use in source and binary forms, with or without
 
6
 * modification, are permitted provided that the following conditions
 
7
 * are met:
 
8
 *
 
9
 * - Redistributions of source code must retain the above copyright
 
10
 *   notice, this list of conditions and the following disclaimer.
 
11
 * - Redistributions in binary form must reproduce the above copyright
 
12
 *   notice, this list of conditions and the following disclaimer in the
 
13
 *   documentation and/or other materials provided with the distribution.
 
14
 * - The name of the author may not be used to endorse or promote products
 
15
 *   derived from this software without specific prior written permission.
 
16
 *
 
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
27
 */
 
28
 
 
29
/** @addtogroup genarch
 
30
 * @{
 
31
 */
 
32
/**
 
33
 * @file
 
34
 * @brief Scan codes for Macintosh ADB keyboards.
 
35
 */
 
36
 
 
37
#include <genarch/kbrd/scanc.h>
 
38
#include <typedefs.h>
 
39
#include <string.h>
 
40
 
 
41
/** Primary meaning of scancodes. */
 
42
wchar_t sc_primary_map[SCANCODES] = {
 
43
        [0x00] = 'a',
 
44
        [0x01] = 's',
 
45
        [0x02] = 'd',
 
46
        [0x03] = 'f',
 
47
        [0x04] = 'h',
 
48
        [0x05] = 'g',
 
49
        [0x06] = 'z',
 
50
        [0x07] = 'x',
 
51
        [0x08] = 'c',
 
52
        [0x09] = 'v',
 
53
        [0x0a] = U_SPECIAL,
 
54
        [0x0b] = 'b',
 
55
        [0x0c] = 'q',
 
56
        [0x0d] = 'w',
 
57
        [0x0e] = 'e',
 
58
        [0x0f] = 'r',
 
59
        [0x10] = 'y',
 
60
        [0x11] = 't',
 
61
        [0x12] = '1',
 
62
        [0x13] = '2',
 
63
        [0x14] = '3',
 
64
        [0x15] = '4',
 
65
        [0x16] = '6',
 
66
        [0x17] = '5',
 
67
        [0x18] = '=',
 
68
        [0x19] = '9',
 
69
        [0x1a] = '7',
 
70
        [0x1b] = '-',
 
71
        [0x1c] = '8',
 
72
        [0x1d] = '0',
 
73
        [0x1e] = ']',
 
74
        [0x1f] = 'o',
 
75
        [0x20] = 'u',
 
76
        [0x21] = '[',
 
77
        [0x22] = 'i',
 
78
        [0x23] = 'p',
 
79
        [0x24] = '\n',          /* Enter */
 
80
        [0x25] = 'l',
 
81
        [0x26] = 'j',
 
82
        [0x27] = '\'',
 
83
        [0x28] = 'k',
 
84
        [0x29] = ';',
 
85
        [0x2a] = '\\',
 
86
        [0x2b] = ',',
 
87
        [0x2c] = '/',
 
88
        [0x2d] = 'n',
 
89
        [0x2e] = 'm',
 
90
        [0x2f] = '.',
 
91
        [0x30] = '\t',          /* Tab */
 
92
        [0x31] = ' ',           /* Space */
 
93
        [0x32] = '`',
 
94
        [0x33] = '\b',          /* Backspace */
 
95
        [0x34] = U_SPECIAL,
 
96
        [0x35] = U_ESCAPE,
 
97
        [0x36] = U_SPECIAL,
 
98
        [0x37] = U_SPECIAL,
 
99
        [0x38] = U_SPECIAL,
 
100
        [0x39] = U_SPECIAL,
 
101
        [0x3a] = U_SPECIAL,
 
102
        [0x3b] = U_LEFT_ARROW,
 
103
        [0x3c] = U_RIGHT_ARROW,
 
104
        [0x3d] = U_DOWN_ARROW,
 
105
        [0x3e] = U_UP_ARROW,
 
106
        [0x3f] = U_SPECIAL,
 
107
        [0x40] = U_SPECIAL,
 
108
        [0x41] = '.',           /* Num Separator */
 
109
        [0x42] = U_SPECIAL,
 
110
        [0x43] = '*',           /* Num Times */
 
111
        [0x44] = U_SPECIAL,
 
112
        [0x45] = '+',           /* Num Plus */
 
113
        [0x46] = U_SPECIAL,
 
114
        [0x47] = U_SPECIAL,
 
115
        [0x48] = U_SPECIAL,
 
116
        [0x49] = U_SPECIAL,
 
117
        [0x4a] = U_SPECIAL,
 
118
        [0x4b] = '/',           /* Num Divide */
 
119
        [0x4c] = U_SPECIAL,
 
120
        [0x4d] = U_SPECIAL,
 
121
        [0x4e] = '-',           /* Num Minus */
 
122
        [0x4f] = U_SPECIAL,
 
123
        [0x50] = U_SPECIAL,
 
124
        [0x51] = U_SPECIAL,
 
125
        [0x52] = '0',           /* Num Zero */
 
126
        [0x53] = '1',           /* Num One */
 
127
        [0x54] = '2',           /* Num Two */
 
128
        [0x55] = '3',           /* Num Three */
 
129
        [0x56] = '4',           /* Num Four */
 
130
        [0x57] = '5',           /* Num Five */
 
131
        [0x58] = '6',           /* Num Six */
 
132
        [0x59] = '7',           /* Num Seven */
 
133
        [0x5a] = U_SPECIAL,
 
134
        [0x5b] = '8',           /* Num Eight */
 
135
        [0x5c] = '9',           /* Num Nine */
 
136
        [0x5d] = U_SPECIAL,
 
137
        [0x5e] = U_SPECIAL,
 
138
        [0x5f] = U_SPECIAL,
 
139
        [0x60] = U_SPECIAL,
 
140
        [0x61] = U_SPECIAL,
 
141
        [0x62] = U_SPECIAL,
 
142
        [0x63] = U_SPECIAL,
 
143
        [0x64] = U_SPECIAL,
 
144
        [0x65] = U_SPECIAL,
 
145
        [0x66] = U_SPECIAL,
 
146
        [0x67] = U_SPECIAL,
 
147
        [0x68] = U_SPECIAL,
 
148
        [0x69] = U_SPECIAL,
 
149
        [0x6a] = U_SPECIAL,
 
150
        [0x6b] = U_SPECIAL,
 
151
        [0x6c] = U_SPECIAL,
 
152
        [0x6d] = U_SPECIAL,
 
153
        [0x6e] = U_SPECIAL,
 
154
        [0x6f] = U_SPECIAL,
 
155
        [0x70] = U_SPECIAL,
 
156
        [0x71] = U_SPECIAL,
 
157
        [0x72] = U_SPECIAL,
 
158
        [0x73] = U_HOME_ARROW,
 
159
        [0x74] = U_PAGE_UP,
 
160
        [0x75] = U_DELETE,
 
161
        [0x76] = U_SPECIAL,
 
162
        [0x77] = U_SPECIAL,
 
163
        [0x78] = U_SPECIAL,
 
164
        [0x79] = U_PAGE_DOWN,
 
165
        [0x7a] = U_SPECIAL,
 
166
        [0x7b] = U_SPECIAL,
 
167
        [0x7c] = U_SPECIAL,
 
168
        [0x7d] = U_SPECIAL,
 
169
        [0x7e] = U_SPECIAL,
 
170
        [0x7f] = U_SPECIAL
 
171
};
 
172
 
 
173
/** Secondary meaning of scancodes. */
 
174
wchar_t sc_secondary_map[SCANCODES] = {
 
175
        [0x00] = 'A',
 
176
        [0x01] = 'S',
 
177
        [0x02] = 'D',
 
178
        [0x03] = 'F',
 
179
        [0x04] = 'H',
 
180
        [0x05] = 'G',
 
181
        [0x06] = 'Z',
 
182
        [0x07] = 'X',
 
183
        [0x08] = 'C',
 
184
        [0x09] = 'V',
 
185
        [0x0a] = U_SPECIAL,
 
186
        [0x0b] = 'B',
 
187
        [0x0c] = 'Q',
 
188
        [0x0d] = 'W',
 
189
        [0x0e] = 'E',
 
190
        [0x0f] = 'R',
 
191
        [0x10] = 'Y',
 
192
        [0x11] = 'T',
 
193
        [0x12] = '!',
 
194
        [0x13] = '@',
 
195
        [0x14] = '#',
 
196
        [0x15] = '$',
 
197
        [0x16] = '^',
 
198
        [0x17] = '%',
 
199
        [0x18] = '+',
 
200
        [0x19] = '(',
 
201
        [0x1a] = '&',
 
202
        [0x1b] = '_',
 
203
        [0x1c] = '*',
 
204
        [0x1d] = ')',
 
205
        [0x1e] = '}',
 
206
        [0x1f] = 'O',
 
207
        [0x20] = 'U',
 
208
        [0x21] = '{',
 
209
        [0x22] = 'I',
 
210
        [0x23] = 'P',
 
211
        [0x24] = '\n',          /* Enter */
 
212
        [0x25] = 'L',
 
213
        [0x26] = 'J',
 
214
        [0x27] = '"',
 
215
        [0x28] = 'K',
 
216
        [0x29] = ':',
 
217
        [0x2a] = '|',
 
218
        [0x2b] = '<',
 
219
        [0x2c] = '?',
 
220
        [0x2d] = 'N',
 
221
        [0x2e] = 'M',
 
222
        [0x2f] = '>',
 
223
        [0x30] = '\t',          /* Tab */
 
224
        [0x31] = ' ',           /* Space */
 
225
        [0x32] = '~',
 
226
        [0x33] = '\b',          /* Backspace */
 
227
        [0x34] = U_SPECIAL,
 
228
        [0x35] = U_SPECIAL,
 
229
        [0x36] = U_SPECIAL,
 
230
        [0x37] = U_SPECIAL,
 
231
        [0x38] = U_SPECIAL,
 
232
        [0x39] = U_SPECIAL,
 
233
        [0x3a] = U_SPECIAL,
 
234
        [0x3b] = U_SPECIAL,
 
235
        [0x3c] = U_SPECIAL,
 
236
        [0x3d] = U_SPECIAL,
 
237
        [0x3e] = U_SPECIAL,
 
238
        [0x3f] = U_SPECIAL,
 
239
        [0x40] = U_SPECIAL,
 
240
        [0x41] = '.',           /* Num Separator */
 
241
        [0x42] = U_SPECIAL,
 
242
        [0x43] = '*',           /* Num Times */
 
243
        [0x44] = U_SPECIAL,
 
244
        [0x45] = '+',           /* Num Plus */
 
245
        [0x46] = U_SPECIAL,
 
246
        [0x47] = U_SPECIAL,
 
247
        [0x48] = U_SPECIAL,
 
248
        [0x49] = U_SPECIAL,
 
249
        [0x4a] = U_SPECIAL,
 
250
        [0x4b] = '/',           /* Num Divide */
 
251
        [0x4c] = U_SPECIAL,
 
252
        [0x4d] = U_SPECIAL,
 
253
        [0x4e] = '-',           /* Num Minus */
 
254
        [0x4f] = U_SPECIAL,
 
255
        [0x50] = U_SPECIAL,
 
256
        [0x51] = U_SPECIAL,
 
257
        [0x52] = '0',           /* Num Zero */
 
258
        [0x53] = '1',           /* Num One */
 
259
        [0x54] = '2',           /* Num Two */
 
260
        [0x55] = '3',           /* Num Three */
 
261
        [0x56] = '4',           /* Num Four */
 
262
        [0x57] = '5',           /* Num Five */
 
263
        [0x58] = '6',           /* Num Six */
 
264
        [0x59] = '7',           /* Num Seven */
 
265
        [0x5a] = U_SPECIAL,
 
266
        [0x5b] = '8',           /* Num Eight */
 
267
        [0x5c] = '9',           /* Num Nine */
 
268
        [0x5d] = U_SPECIAL,
 
269
        [0x5e] = U_SPECIAL,
 
270
        [0x5f] = U_SPECIAL,
 
271
        [0x60] = U_SPECIAL,
 
272
        [0x61] = U_SPECIAL,
 
273
        [0x62] = U_SPECIAL,
 
274
        [0x63] = U_SPECIAL,
 
275
        [0x64] = U_SPECIAL,
 
276
        [0x65] = U_SPECIAL,
 
277
        [0x66] = U_SPECIAL,
 
278
        [0x67] = U_SPECIAL,
 
279
        [0x68] = U_SPECIAL,
 
280
        [0x69] = U_SPECIAL,
 
281
        [0x6a] = U_SPECIAL,
 
282
        [0x6b] = U_SPECIAL,
 
283
        [0x6c] = U_SPECIAL,
 
284
        [0x6d] = U_SPECIAL,
 
285
        [0x6e] = U_SPECIAL,
 
286
        [0x6f] = U_SPECIAL,
 
287
        [0x70] = U_SPECIAL,
 
288
        [0x71] = U_SPECIAL,
 
289
        [0x72] = U_SPECIAL,
 
290
        [0x73] = U_SPECIAL,
 
291
        [0x74] = U_SPECIAL,
 
292
        [0x75] = U_SPECIAL,
 
293
        [0x76] = U_SPECIAL,
 
294
        [0x77] = U_SPECIAL,
 
295
        [0x78] = U_SPECIAL,
 
296
        [0x79] = U_SPECIAL,
 
297
        [0x7a] = U_SPECIAL,
 
298
        [0x7b] = U_SPECIAL,
 
299
        [0x7c] = U_SPECIAL,
 
300
        [0x7d] = U_SPECIAL,
 
301
        [0x7e] = U_SPECIAL,
 
302
        [0x7f] = U_SPECIAL
 
303
};
 
304
 
 
305
/** @}
 
306
 */