/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <grub/keyboard_layouts.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <unistd.h>
#include <errno.h>
#include "progname.h"
{0, 0, 0, 0}
};
struct console_grub_equivalence
{
char *layout;
};
{"KP_0", '0'},
{"KP_1", '1'},
{"KP_2", '2'},
{"KP_3", '3'},
{"KP_4", '4'},
{"KP_5", '5'},
{"KP_6", '6'},
{"KP_7", '7'},
{"KP_8", '8'},
{"KP_9", '9'},
{"KP_Period", '.'},
{NULL, '\0'}
};
{"KP_0", GRUB_TERM_KEY_INSERT},
{"KP_1", GRUB_TERM_KEY_END},
{"KP_2", GRUB_TERM_KEY_DOWN},
{"KP_3", GRUB_TERM_KEY_NPAGE},
{"KP_4", GRUB_TERM_KEY_LEFT},
{"KP_5", GRUB_TERM_KEY_CENTER},
{"KP_6", GRUB_TERM_KEY_RIGHT},
{"KP_7", GRUB_TERM_KEY_HOME},
{"KP_8", GRUB_TERM_KEY_UP},
{"KP_9", GRUB_TERM_KEY_PPAGE},
{"KP_Period", GRUB_TERM_KEY_DC},
{NULL, '\0'}
};
{"Escape", GRUB_TERM_ESC},
{"Tab", GRUB_TERM_TAB},
{"Delete", GRUB_TERM_BACKSPACE},
{"KP_Enter", '\n'},
{"Return", '\n'},
{"KP_Multiply", '*'},
{"KP_Subtract", '-'},
{"KP_Add", '+'},
{"KP_Divide", '/'},
{"F1", GRUB_TERM_KEY_F1},
{"F2", GRUB_TERM_KEY_F2},
{"F3", GRUB_TERM_KEY_F3},
{"F4", GRUB_TERM_KEY_F4},
{"F5", GRUB_TERM_KEY_F5},
{"F6", GRUB_TERM_KEY_F6},
{"F7", GRUB_TERM_KEY_F7},
{"F8", GRUB_TERM_KEY_F8},
{"F9", GRUB_TERM_KEY_F9},
{"F10", GRUB_TERM_KEY_F10},
{"F11", GRUB_TERM_KEY_F11},
{"F12", GRUB_TERM_KEY_F12},
{"Insert", GRUB_TERM_KEY_INSERT},
{"Down", GRUB_TERM_KEY_DOWN},
{"Up", GRUB_TERM_KEY_UP},
{"Home", GRUB_TERM_KEY_HOME},
{"End", GRUB_TERM_KEY_END},
{"Right", GRUB_TERM_KEY_RIGHT},
{"Left", GRUB_TERM_KEY_LEFT},
{"Next", GRUB_TERM_KEY_NPAGE},
{"Prior", GRUB_TERM_KEY_PPAGE},
{"Remove", GRUB_TERM_KEY_DC},
{"VoidSymbol", 0},
/* "Undead" keys since no dead key support in GRUB. */
{"dead_acute", '\''},
{"dead_circumflex", '^'},
{"dead_grave", '`'},
{"dead_tilde", '~'},
{"dead_diaeresis", '"'},
/* Following ones don't provide any useful symbols for shell. */
{"dead_cedilla", 0},
{"dead_ogonek", 0},
{"dead_caron", 0},
{"dead_breve", 0},
{"dead_doubleacute", 0},
/* Unused in GRUB. */
{"Pause", 0},
{"Scroll_Forward", 0},
{"Scroll_Backward", 0},
{"Hex_0", 0},
{"Hex_1", 0},
{"Hex_2", 0},
{"Hex_3", 0},
{"Hex_4", 0},
{"Hex_5", 0},
{"Hex_6", 0},
{"Hex_7", 0},
{"Hex_8", 0},
{"Hex_9", 0},
{"Hex_A", 0},
{"Hex_B", 0},
{"Hex_C", 0},
{"Hex_D", 0},
{"Hex_E", 0},
{"Hex_F", 0},
{"Scroll_Lock", 0},
{"Show_Memory", 0},
{"Show_Registers", 0},
{"Control_backslash", 0},
{"Compose", 0},
{NULL, '\0'}
};
/* 0x54 */ 0, 0,
/* 0x58 */ GRUB_KEYBOARD_KEY_F12, 0,
/* 0x5a */ 0, 0,
/* 0x5c */ 0, 0,
/* 0x5e */ 0, 0,
/* 0x62 */ GRUB_KEYBOARD_KEY_NUMSLASH, 0,
/* 0x64 */ GRUB_KEYBOARD_KEY_RIGHT_ALT, 0,
};
static void
{
if (status)
else
printf (_("\
Usage: %s [OPTIONS]\n\
-i, --input set input filename. Default is STDIN\n\
-o, --output set output filename. Default is STDOUT\n\
-h, --help display this message and exit.\n\
-V, --version print version information and exit.\n\
-v, --verbose print verbose messages.\n\
\n\
}
static void
{
(void) layout;
}
static unsigned
{
int i;
if (shift)
else
return console_grub_equivalences_common[i].grub;
return '\0';
}
static unsigned int
{
unsigned int code;
else
return code;
}
static void
{
unsigned i;
}
static void
{
int ok;
/* Process the ckbcomp output and prepare the layouts. */
ok = 0;
{
{
unsigned keycode_linux;
unsigned keycode_usb;
/* Not used. */
/* Some obscure keys */
|| keycode_linux == 0x7e)
continue;
/* Not remappable. */
continue;
if (keycode_usb == 0
{
continue;
}
{
= get_grub_code (normalalt, 0);
ok = 1;
}
}
}
if (ok == 0)
{
CKBCOMP);
exit (1);
}
}
int
{
int verbosity;
set_program_name (argv[0]);
verbosity = 0;
/* Check for options. */
while (1)
{
if (c == -1)
break;
else
switch (c)
{
case 'h':
usage (0);
break;
case 'i':
break;
case 'o':
break;
case 'V':
return 0;
case 'v':
verbosity++;
break;
default:
usage (1);
break;
}
}
if (infile_name)
else
if (!in)
if (outfile_name)
else
if (!out)
{
}
return 0;
}