1 /* genmap - output binary keymap Author: Marcus Hampel
5 #include <minix/keymap.h>
7 #include "../../../include/minix/keymap.h"
16 * if we crosscompile those might not be defined,
20 typedef uint16_t u16_t
;
28 u16_t keymap
[NR_SCAN_CODES
* MAP_COLS
] = {
32 u8_t comprmap
[4 + NR_SCAN_CODES
* MAP_COLS
* 9/8 * 2 + 1];
34 void tell(const char *s
)
36 write(2, s
, strlen(s
));
45 /* Compress the keymap. */
46 memcpy(comprmap
, KEY_MAGIC
, 4);
49 for (km
= keymap
; km
< keymap
+ NR_SCAN_CODES
* MAP_COLS
; km
++) {
51 /* Allocate a new flag byte. */
56 *cm
++ = (*km
& 0x00FF); /* Low byte. */
58 *cm
++ = (*km
>> 8); /* High byte only when set. */
59 *fb
|= (1 << n
); /* Set a flag if so. */
64 /* Don't store trailing zeros. */
65 while (cm
> comprmap
&& cm
[-1] == 0) cm
--;
67 /* Emit the compressed keymap. */
68 if (write(1, comprmap
, cm
- comprmap
) < 0) {