SMBIOS Library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
libraries
common
ascii2enUS_scancode.cpp
Go to the documentation of this file.
1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
* vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:cindent:textwidth=0:
3
*
4
* Copyright (C) 2005 Dell Inc.
5
* by Michael Brown <Michael_E_Brown@dell.com>
6
* Licensed under the Open Software License version 2.1
7
*
8
* Alternatively, you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published
10
* by the Free Software Foundation; either version 2 of the License,
11
* or (at your option) any later version.
12
13
* This program is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
* See the GNU General Public License for more details.
17
*/
18
19
// compat header should always be first header if including system headers
20
#define LIBSMBIOS_SOURCE
21
#include "
smbios/compat.h
"
22
23
#include <string.h>
24
25
#include "
smbios/SystemInfo.h
"
26
27
//--------------------------------------------------------------------
28
// Global Data Area
29
//--------------------------------------------------------------------
30
// maps ASCII number to a scan code
31
// sorted by ASCII value
32
static
const
char
ascMap
[256] =
33
{
34
0x03,
35
0x1E,
36
0x30,
37
0x46,
38
0x20,
39
0x12,
40
0x21,
41
0x22,
42
0x0E,
43
0x0F,
44
0x1C,
45
0x25,
46
0x26,
47
0x1C,
48
0x31,
49
0x18,
50
0x19,
51
0x10,
52
0x13,
53
0x1F,
54
0x14,
55
0x16,
56
0x2F,
57
0x11,
58
0x2D,
59
0x15,
60
0x2C,
61
0x1A,
62
0x2B,
63
0x1B,
64
0x07,
65
0x0C,
66
0x39,
67
0x02,
68
0x28,
69
0x04,
70
0x05,
71
0x06,
72
0x08,
73
0x28,
74
0x0A,
75
0x0B,
76
0x09,
77
0x0D,
78
0x33,
79
0x0C,
80
0x34,
81
0x35,
82
0x0B,
83
0x02,
84
0x03,
85
0x04,
86
0x05,
87
0x06,
88
0x07,
89
0x08,
90
0x09,
91
0x0A,
92
0x27,
93
0x27,
94
0x33,
95
0x0D,
96
0x34,
97
0x35,
98
0x03,
99
0x1E,
100
0x30,
101
0x2E,
102
0x20,
103
0x12,
104
0x21,
105
0x22,
106
0x23,
107
0x17,
108
0x24,
109
0x25,
110
0x26,
111
0x32,
112
0x31,
113
0x18,
114
0x19,
115
0x10,
116
0x13,
117
0x1F,
118
0x14,
119
0x16,
120
0x2F,
121
0x11,
122
0x2D,
123
0x15,
124
0x2C,
125
0x1A,
126
0x2B,
127
0x1B,
128
0x07,
129
0x0C,
130
0x29,
131
0x1E,
132
0x30,
133
0x2E,
134
0x20,
135
0x12,
136
0x21,
137
0x22,
138
0x23,
139
0x17,
140
0x24,
141
0x25,
142
0x26,
143
0x32,
144
0x31,
145
0x18,
146
0x19,
147
0x10,
148
0x13,
149
0x1F,
150
0x14,
151
0x16,
152
0x2F,
153
0x11,
154
0x2D,
155
0x15,
156
0x2C,
157
0x1A,
158
0x2B,
159
0x1B,
160
0x29,
161
0x0E,
162
0x00,
163
0x00,
164
0x00,
165
0x00,
166
0x00,
167
0x00,
168
0x00,
169
0x00,
170
0x00,
171
0x00,
172
0x00,
173
0x00,
174
0x00,
175
0x00,
176
0x00,
177
0x00,
178
0x00,
179
0x00,
180
0x00,
181
0x00,
182
0x00,
183
0x00,
184
0x00,
185
0x00,
186
0x00,
187
0x00,
188
0x00,
189
0x00,
190
0x00,
191
0x00,
192
0x00,
193
0x00,
194
0x00,
195
0x00,
196
0x00,
197
0x00,
198
0x00,
199
0x00,
200
0x00,
201
0x00,
202
0x00,
203
0x00,
204
0x00,
205
0x00,
206
0x00,
207
0x00,
208
0x00,
209
0x00,
210
0x00,
211
0x00,
212
0x00,
213
0x00,
214
0x00,
215
0x00,
216
0x00,
217
0x00,
218
0x00,
219
0x00,
220
0x00,
221
0x00,
222
0x00,
223
0x00,
224
0x00,
225
0x00,
226
0x00,
227
0x00,
228
0x00,
229
0x00,
230
0x00,
231
0x00,
232
0x00,
233
0x00,
234
0x00,
235
0x00,
236
0x00,
237
0x00,
238
0x00,
239
0x00,
240
0x00,
241
0x00,
242
0x00,
243
0x00,
244
0x00,
245
0x00,
246
0x00,
247
0x00,
248
0x00,
249
0x00,
250
0x00,
251
0x00,
252
0x00,
253
0x00,
254
0x00,
255
0x00,
256
0x00,
257
0x00,
258
0x00,
259
0x00,
260
0x00,
261
0x00,
262
0x00,
263
0x00,
264
0x00,
265
0x00,
266
0x00,
267
0x00,
268
0x00,
269
0x00,
270
0x00,
271
0x00,
272
0x00,
273
0x00,
274
0x00,
275
0x00,
276
0x00,
277
0x00,
278
0x00,
279
0x00,
280
0x00,
281
0x00,
282
0x00,
283
0x00,
284
0x00,
285
0x00,
286
0x00,
287
0x00,
288
0x00,
289
0x00
290
};
291
292
//---------------------------------------------------------------------
293
// KBDMapASCIIToScanCode - Maps a string of ASCII codes to scan code
294
// bytes
295
//---------------------------------------------------------------------
296
void
SMBIOSMapAsciiTo_en_US_ScanCode
(
char
*outputScanCodeBuf,
const
char
*inputAsciiBuf,
size_t
outputBufSize)
297
{
298
memset(outputScanCodeBuf, 0, outputBufSize);
299
for
(
size_t
i = 0; i<outputBufSize && i<strlen(inputAsciiBuf); i++)
300
{
301
outputScanCodeBuf[i] =
ascMap
[
static_cast<
size_t
>
(inputAsciiBuf[i])];
302
}
303
}
304
Generated on Thu Mar 27 2014 09:27:18 for SMBIOS Library by
1.8.1.2