2 * kbd_mode: report and set keyboard mode - aeb, 940406
4 * If you make \215A\201 an alias for "kbd_mode -a", and you are
5 * in raw mode, then hitting F7 = (two keys) will return you to sanity.
11 #include <sys/ioctl.h>
12 #include <linux/types.h>
18 static void __attribute__ ((noreturn))
20 fprintf(stderr, _("usage: kbd_mode [-a|-u|-k|-s] [-C device]\n"));
25 main(int argc, char *argv[]){
26 int fd, mode, c, n = 0;
29 set_progname(argv[0]);
31 setlocale(LC_ALL, "");
32 bindtextdomain(PACKAGE_NAME, LOCALEDIR);
33 textdomain(PACKAGE_NAME);
35 if (argc == 2 && !strcmp(argv[1], "-V"))
36 print_version_and_exit();
38 while ((c = getopt(argc, argv, "auskC:")) != EOF) {
65 if (!optarg || !optarg[0])
78 if (ioctl(fd, KDGKBMODE, &mode)) {
80 fprintf(stderr, _("kbd_mode: error reading keyboard mode\n"));
85 printf(_("The keyboard is in raw (scancode) mode\n"));
88 printf(_("The keyboard is in mediumraw (keycode) mode\n"));
91 printf(_("The keyboard is in the default (ASCII) mode\n"));
94 printf(_("The keyboard is in Unicode (UTF-8) mode\n"));
97 printf(_("The keyboard is in some unknown mode\n"));
102 if (ioctl(fd, KDSKBMODE, mode)) {
104 fprintf(stderr, _("%s: error setting keyboard mode\n"), progname);