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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#include <stdio.h>
#include <string.h>
#ifndef from
#define from at2
#endif
#ifndef to
#define to code
#endif
#include "scancodes.h"
int main(void)
{
int i, j;
unsigned int keycode[4096];
memset(keycode, 0, 4096 * sizeof(int));
for (i = 0; scancodes[i].code; i++) {
if (scancodes[i].from && scancodes[i].to) {
if (!keycode[scancodes[i].from])
keycode[scancodes[i].from] = scancodes[i].to;
else
printf("Clash: %3d and %3d on 0x%02x\n",
scancodes[i].to, keycode[scancodes[i].from], scancodes[i].from);
}
}
for (j = 4095; j > 0; j--)
if (keycode[j]) break;
for (i = 0; i <= j; i++) {
if (keycode[i])
printf("%3d,", keycode[i]);
else
printf(" 0,");
if ((i & 0xf) == 0xf)
printf("\n");
}
#if 0
for (i = 0; i <= j; i++) {
if (!keycode[i])
printf("%03x ", i);
else
printf(" ");
if ((i & 0xf) == 0xf)
printf("\n");
}
#endif
printf("\n");
return 0;
}
|