Blame contrib/dropkeymaps.c
|
Packit Service |
50ad14 |
#include <stdio.h>
|
|
Packit Service |
50ad14 |
#include <stdlib.h>
|
|
Packit Service |
50ad14 |
#include <sys/ioctl.h>
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#include "getfd.h"
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
#include <linux/kd.h>
|
|
Packit Service |
50ad14 |
#include <linux/keyboard.h>
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
int main(void)
|
|
Packit Service |
50ad14 |
{
|
|
Packit Service |
50ad14 |
struct kbentry ke;
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
int i, j, fd;
|
|
Packit Service |
50ad14 |
char *console = NULL;
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
/* get console */
|
|
Packit Service |
50ad14 |
fd = getfd(console);
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
|
|
Packit Service |
50ad14 |
for (j = 0; j < NR_KEYS; j++) {
|
|
Packit Service |
50ad14 |
ke.kb_index = j;
|
|
Packit Service |
50ad14 |
ke.kb_table = i;
|
|
Packit Service |
50ad14 |
ke.kb_value = K_HOLE;
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
if (ioctl(fd, KDSKBENT, (unsigned long)&ke)) {
|
|
Packit Service |
50ad14 |
perror("KDSKBENT");
|
|
Packit Service |
50ad14 |
fprintf(stderr, "Error: cannot deallocate or clear keymap %d key %d\n", i, j);
|
|
Packit Service |
50ad14 |
return EXIT_FAILURE;
|
|
Packit Service |
50ad14 |
}
|
|
Packit Service |
50ad14 |
}
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
/* deallocate keymap */
|
|
Packit Service |
50ad14 |
ke.kb_index = 0;
|
|
Packit Service |
50ad14 |
ke.kb_table = i;
|
|
Packit Service |
50ad14 |
ke.kb_value = K_NOSUCHMAP;
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
if (ioctl(fd, KDSKBENT, (unsigned long)&ke)) {
|
|
Packit Service |
50ad14 |
perror("KDSKBENT");
|
|
Packit Service |
50ad14 |
fprintf(stderr, "Error: could not deallocate keymap %d\n", i);
|
|
Packit Service |
50ad14 |
return EXIT_FAILURE;
|
|
Packit Service |
50ad14 |
}
|
|
Packit Service |
50ad14 |
}
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
return EXIT_SUCCESS;
|
|
Packit Service |
50ad14 |
}
|