bump to 0.4

Changes since last version
Fixes:
- Fixed compile error on arm due to different char size
- Fixed child processes becoming zombies
- Fixed infinite loop on config files bigger than 512B
- Fixed memory allocation bug upon reloading config file
- Fixed crash upon suspending and resuming computer
- Fixed bug where last hotkey would be ignored
- Fixed crash with small parse block sizes

Additions:
- Added -h flag
- Added -d flag
- Added some keys aliases
- Added button events
- Parsed keys are now case-insensitive

Others:
- Better code readability
- Added license in source file
- Keys are now stored in keys.h
- Better errors regarding invalid config files
- Makefile respects system's $CC
xkbcommon
Alessandro Mauri 4 years ago
parent 45ea29a760
commit 8edf0d1ce9
  1. 0
      config.template
  2. 10
      hkd.1
  3. 209
      hkd.c
  4. 504
      keys.h
  5. 2
      makefile

10
hkd.1

@ -72,12 +72,16 @@ error, read the manpage for
for more info about the possible word expansion capabilities. for more info about the possible word expansion capabilities.
.PP .PP
Possible keys are taken directly from linux's input.h header file, those Possible keys are taken directly from linux's input.h header file, those
include normal keys, multimedia keys and special keys, for the full list include normal keys, multimedia keys, special keys and button events, for the
of available keys either refer to the header file or this project's hkd.c full list of available keys either refer to the linux header file input.h or
source file. Keys as specified by the kernel are named "KEY_<name>", in this keys.h in this project.
Keys as specified by the kernel are named "KEY_<name>", in this
configuration file only the <name> is required. configuration file only the <name> is required.
Key names are case-insensitive and are parsed as a list of comma separated Key names are case-insensitive and are parsed as a list of comma separated
strings, such as: 'leftmeta,UP', 'VOLUMEUP' or 'leftctrl,LEFTALT,cancel'. strings, such as: 'leftmeta,UP', 'VOLUMEUP' or 'leftctrl,LEFTALT,cancel'.
Some aliases are in place to avoid overly verbose repetitive definitions, those
are: CTRL \-> LEFTCTRL, META \-> LEFTMETA, ALT \-> LEFTALT, SHIFT \-> LEFTSHIFT,
PRINTSCR \-> SYSRQ, MIC_MUTE \-> F20.
.PP .PP
hkd can live reload the configuration file by signaling it with hkd can live reload the configuration file by signaling it with
.I SIGUSR1 .I SIGUSR1

209
hkd.c

@ -33,13 +33,13 @@
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <linux/input.h>
#include <sys/epoll.h> #include <sys/epoll.h>
#include <sys/inotify.h> #include <sys/inotify.h>
#include <wordexp.h> #include <wordexp.h>
#include <ctype.h> #include <ctype.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdarg.h> #include <stdarg.h>
#include "keys.h"
/* Value defines */ /* Value defines */
#define FILE_NAME_MAX_LENGTH 255 #define FILE_NAME_MAX_LENGTH 255
@ -74,147 +74,6 @@ const char *config_paths[] = {
"/etc/hkd/config", "/etc/hkd/config",
}; };
const struct {
const char *const name;
const unsigned short value;
} key_conversion_table[] =
{{"ESC", KEY_ESC}, {"1", KEY_1}, {"2", KEY_2}, {"3", KEY_3},
{"4", KEY_4}, {"5", KEY_5}, {"6", KEY_6}, {"7", KEY_7},
{"8", KEY_8}, {"9", KEY_9}, {"0", KEY_0}, {"MINUS", KEY_MINUS},
{"EQUAL", KEY_EQUAL}, {"BACKSPACE", KEY_BACKSPACE}, {"TAB", KEY_TAB},
{"Q", KEY_Q}, {"W", KEY_W}, {"E", KEY_E}, {"R", KEY_R},
{"T", KEY_T}, {"Y", KEY_Y}, {"U", KEY_U}, {"I", KEY_I},
{"O", KEY_O}, {"P", KEY_P}, {"LEFTBRACE", KEY_LEFTBRACE},
{"RIGHTBRACE", KEY_RIGHTBRACE}, {"ENTER", KEY_ENTER}, {"LEFTCTRL", KEY_LEFTCTRL},
{"A", KEY_A}, {"S", KEY_S}, {"D", KEY_D}, {"F", KEY_F},
{"G", KEY_G}, {"H", KEY_H}, {"J", KEY_J}, {"K", KEY_K},
{"L", KEY_L}, {"SEMICOLON", KEY_SEMICOLON}, {"APOSTROPHE", KEY_APOSTROPHE},
{"GRAVE", KEY_GRAVE}, {"LEFTSHIFT", KEY_LEFTSHIFT}, {"BACKSLASH", KEY_BACKSLASH},
{"Z", KEY_Z}, {"X", KEY_X}, {"C", KEY_C}, {"V", KEY_V},
{"B", KEY_B}, {"N", KEY_N}, {"M", KEY_M}, {"COMMA", KEY_COMMA},
{"DOT", KEY_DOT}, {"SLASH", KEY_SLASH}, {"RIGHTSHIFT", KEY_RIGHTSHIFT},
{"KPASTERISK", KEY_KPASTERISK}, {"LEFTALT", KEY_LEFTALT}, {"SPACE", KEY_SPACE},
{"CAPSLOCK", KEY_CAPSLOCK}, {"F1", KEY_F1}, {"F2", KEY_F2}, {"F3", KEY_F3},
{"F4", KEY_F4}, {"F5", KEY_F5}, {"F6", KEY_F6}, {"F7", KEY_F7},
{"F8", KEY_F8}, {"F9", KEY_F9}, {"F10", KEY_F10}, {"NUMLOCK", KEY_NUMLOCK},
{"SCROLLLOCK", KEY_SCROLLLOCK}, {"KP7", KEY_KP7}, {"KP8", KEY_KP8},
{"KP9", KEY_KP9}, {"KPMINUS", KEY_KPMINUS}, {"KP4", KEY_KP4}, {"KP5", KEY_KP5},
{"KP6", KEY_KP6}, {"KPPLUS", KEY_KPPLUS}, {"KP1", KEY_KP1}, {"KP2", KEY_KP2},
{"KP3", KEY_KP3}, {"KP0", KEY_KP0}, {"KPDOT", KEY_KP0},
{"ZENKAKUHANKAKU", KEY_ZENKAKUHANKAKU}, {"102ND", KEY_102ND}, {"F11", KEY_F11},
{"F12", KEY_F12}, {"RO", KEY_RO}, {"KATAKANA", KEY_KATAKANA},
{"HIRAGANA", KEY_HIRAGANA}, {"HENKAN", KEY_HENKAN},
{"KATAKANAHIRAGANA", KEY_KATAKANAHIRAGANA}, {"MUHENKAN", KEY_MUHENKAN},
{"KPJPCOMMA", KEY_KPJPCOMMA}, {"KPENTER", KEY_KPENTER},
{"RIGHTCTRL", KEY_RIGHTCTRL}, {"KPSLASH", KEY_KPSLASH},
{"SYSRQ", KEY_SYSRQ}, {"RIGHTALT", KEY_RIGHTALT}, {"LINEFEED", KEY_LINEFEED},
{"HOME", KEY_HOME}, {"UP", KEY_UP}, {"PAGEUP", KEY_PAGEUP},
{"LEFT", KEY_LEFT}, {"RIGHT", KEY_RIGHT}, {"END", KEY_END},
{"DOWN", KEY_DOWN}, {"PAGEDOWN", KEY_PAGEDOWN}, {"INSERT", KEY_INSERT},
{"DELETE", KEY_DELETE}, {"MACRO", KEY_MACRO}, {"MUTE", KEY_MUTE},
{"VOLUMEDOWN", KEY_VOLUMEDOWN}, {"VOLUMEUP", KEY_VOLUMEUP},
{"POWER", KEY_POWER}, {"KPEQUAL", KEY_KPEQUAL}, {"KPPLUSMINUS", KEY_KPPLUSMINUS},
{"PAUSE", KEY_PAUSE}, {"SCALE", KEY_SCALE}, {"KPCOMMA", KEY_KPCOMMA},
{"HANGEUL", KEY_HANGEUL}, {"HANGUEL", KEY_HANGEUL}, {"HANJA", KEY_HANJA},
{"YEN", KEY_YEN}, {"LEFTMETA", KEY_LEFTMETA}, {"RIGHTMETA", KEY_LEFTMETA},
{"COMPOSE", KEY_COMPOSE}, {"STOP", KEY_STOP}, {"AGAIN", KEY_AGAIN},
{"PROPS", KEY_PROPS}, {"UNDO", KEY_UNDO}, {"FRONT", KEY_FRONT},
{"COPY", KEY_COPY}, {"OPEN", KEY_OPEN}, {"PASTE", KEY_PASTE},
{"FIND", KEY_FIND}, {"CUT", KEY_CUT}, {"HELP", KEY_HELP},
{"MENU", KEY_MENU}, {"CALC", KEY_CALC}, {"SETUP", KEY_SETUP},
{"SLEEP", KEY_SLEEP}, {"WAKEUP", KEY_WAKEUP}, {"FILE", KEY_FILE},
{"SENDFILE", KEY_SENDFILE}, {"DELETEFILE", KEY_DELETEFILE},
{"XFER", KEY_XFER}, {"PROG1", KEY_PROG1}, {"PROG2", KEY_PROG2},
{"WWW", KEY_WWW}, {"MSDOS", KEY_MSDOS}, {"COFFEE", KEY_COFFEE},
{"SCREENLOCK", KEY_COFFEE}, {"DIRECTION", KEY_DIRECTION},
{"CYCLEWINDOWS", KEY_CYCLEWINDOWS}, {"MAIL", KEY_MAIL},
{"BOOKMARKS", KEY_BOOKMARKS}, {"COMPUTER", KEY_COMPUTER}, {"BACK", KEY_BACK},
{"FORWARD", KEY_FORWARD}, {"CLOSECD", KEY_CLOSECD}, {"EJECTCD", KEY_EJECTCD},
{"EJECTCLOSECD", KEY_EJECTCLOSECD}, {"NEXTSONG", KEY_NEXTSONG},
{"PLAYPAUSE", KEY_PLAYPAUSE}, {"PREVIOUSSONG", KEY_PREVIOUSSONG},
{"STOPCD", KEY_STOPCD}, {"RECORD", KEY_RECORD}, {"REWIND", KEY_REWIND},
{"PHONE", KEY_PHONE}, {"ISO", KEY_ISO}, {"CONFIG", KEY_CONFIG},
{"HOMEPAGE", KEY_HOMEPAGE}, {"REFRESH", KEY_REFRESH}, {"EXIT", KEY_EXIT},
{"MOVE", KEY_MOVE}, {"EDIT", KEY_EDIT}, {"SCROLLUP", KEY_SCROLLUP},
{"SCROLLDOWN", KEY_SCROLLDOWN}, {"KPLEFTPAREN", KEY_KPLEFTPAREN},
{"KPRIGHTPAREN", KEY_KPRIGHTPAREN}, {"NEW", KEY_NEW}, {"REDO", KEY_REDO},
{"F13", KEY_F13}, {"F14", KEY_F14}, {"F15", KEY_F15}, {"F16", KEY_F16},
{"F17", KEY_F17}, {"F18", KEY_F18}, {"F19", KEY_F19}, {"F20", KEY_F20},
{"F21", KEY_F21}, {"F22", KEY_F22}, {"F23", KEY_F23}, {"F24", KEY_F24},
{"PLAYCD", KEY_PLAYCD}, {"PAUSECD", KEY_PAUSECD}, {"PROG3", KEY_PROG3},
{"PROG4", KEY_PROG4}, {"DASHBOARD", KEY_DASHBOARD}, {"SUSPEND", KEY_SUSPEND},
{"CLOSE", KEY_CLOSE}, {"PLAY", KEY_PLAY}, {"FASTFORWARD", KEY_FASTFORWARD},
{"BASSBOOST", KEY_BASSBOOST}, {"PRINT", KEY_PRINT}, {"HP", KEY_HP},
{"CAMERA", KEY_CAMERA}, {"SOUND", KEY_SOUND}, {"QUESTION", KEY_QUESTION},
{"EMAIL", KEY_EMAIL}, {"CHAT", KEY_CHAT}, {"SEARCH", KEY_SEARCH},
{"CONNECT", KEY_CONNECT}, {"FINANCE", KEY_FINANCE}, {"SPORT", KEY_SPORT},
{"SHOP", KEY_SHOP}, {"ALTERASE", KEY_ALTERASE}, {"CANCEL", KEY_CANCEL},
{"BRIGHTNESSDOWN", KEY_BRIGHTNESSDOWN}, {"BRIGHTNESSUP", KEY_BRIGHTNESSUP},
{"MEDIA", KEY_MEDIA}, {"SWITCHVIDEOMODE", KEY_SWITCHVIDEOMODE},
{"KBDILLUMTOGGLE", KEY_KBDILLUMTOGGLE}, {"KBDILLUMDOWN", KEY_KBDILLUMDOWN},
{"KBDILLUMUP", KEY_KBDILLUMUP}, {"SEND", KEY_SEND}, {"REPLY", KEY_REPLY},
{"FORWARDMAIL", KEY_FORWARDMAIL}, {"SAVE", KEY_SAVE},
{"DOCUMENTS", KEY_DOCUMENTS}, {"BATTERY", KEY_BATTERY},
{"BLUETOOTH", KEY_BLUETOOTH}, {"WLAN", KEY_WLAN}, {"UWB", KEY_UWB},
{"UNKNOWN", KEY_UNKNOWN}, {"VIDEO_NEXT", KEY_VIDEO_NEXT},
{"VIDEO_PREV", KEY_VIDEO_PREV}, {"BRIGHTNESS_CYCLE", KEY_BRIGHTNESS_CYCLE},
{"BRIGHTNESS_ZERO", KEY_BRIGHTNESS_ZERO}, {"DISPLAY_OFF", KEY_DISPLAY_OFF},
{"WIMAX", KEY_WIMAX}, {"RFKILL", KEY_RFKILL}, {"OK", KEY_OK},
{"SELECT", KEY_SELECT}, {"GOTO", KEY_GOTO}, {"CLEAR", KEY_CLEAR},
{"POWER2", KEY_POWER2}, {"OPTION", KEY_OPTION}, {"INFO", KEY_INFO},
{"TIME", KEY_TIME}, {"VENDOR", KEY_VENDOR}, {"ARCHIVE", KEY_ARCHIVE},
{"PROGRAM", KEY_PROGRAM}, {"CHANNEL", KEY_CHANNEL}, {"FAVORITES", KEY_FAVORITES},
{"EPG", KEY_EPG}, {"PVR", KEY_PVR}, {"MHP", KEY_MHP},
{"LANGUAGE", KEY_LANGUAGE}, {"TITLE", KEY_TITLE}, {"SUBTITLE", KEY_SUBTITLE},
{"ANGLE", KEY_ANGLE}, {"ZOOM", KEY_ZOOM}, {"MODE", KEY_MODE},
{"KEYBOARD", KEY_KEYBOARD}, {"SCREEN", KEY_SCREEN}, {"PC", KEY_PC},
{"TV", KEY_TV}, {"TV2", KEY_TV2}, {"VCR", KEY_VCR}, {"VCR2", KEY_VCR2},
{"SAT", KEY_SAT}, {"SAT2", KEY_SAT2}, {"CD", KEY_CD}, {"TAPE", KEY_TAPE},
{"RADIO", KEY_RADIO}, {"TUNER", KEY_TUNER}, {"PLAYER", KEY_PLAYER},
{"TEXT", KEY_TEXT}, {"DVD", KEY_DVD}, {"AUX", KEY_AUX}, {"MP3", KEY_MP3},
{"AUDIO", KEY_AUDIO}, {"VIDEO", KEY_VIDEO}, {"DIRECTORY", KEY_DIRECTORY},
{"LIST", KEY_LIST}, {"MEMO", KEY_MEMO}, {"CALENDAR", KEY_CALENDAR},
{"RED", KEY_RED}, {"GREEN", KEY_GREEN}, {"YELLOW", KEY_YELLOW},
{"BLUE", KEY_BLUE}, {"CHANNELUP", KEY_CHANNELUP},
{"CHANNELDOWN", KEY_CHANNELDOWN}, {"FIRST", KEY_FIRST}, {"LAST", KEY_LAST},
{"AB", KEY_AB}, {"NEXT", KEY_NEXT}, {"RESTART", KEY_RESTART},
{"SLOW", KEY_SLOW}, {"SHUFFLE", KEY_SHUFFLE}, {"BREAK", KEY_BREAK},
{"PREVIOUS", KEY_PREVIOUS}, {"DIGITS", KEY_DIGITS}, {"TEEN", KEY_TEEN},
{"TWEN", KEY_TWEN}, {"VIDEOPHONE", KEY_VIDEOPHONE}, {"GAMES", KEY_GAMES},
{"ZOOMIN", KEY_ZOOMIN}, {"ZOOMOUT", KEY_ZOOMOUT}, {"ZOOMRESET", KEY_ZOOMRESET},
{"WORDPROCESSOR", KEY_WORDPROCESSOR}, {"EDITOR", KEY_EDITOR},
{"SPREADSHEET", KEY_SPREADSHEET}, {"GRAPHICSEDITOR", KEY_GRAPHICSEDITOR},
{"PRESENTATION", KEY_PRESENTATION}, {"DATABASE", KEY_DATABASE},
{"NEWS", KEY_NEWS}, {"VOICEMAIL", KEY_VOICEMAIL},
{"ADDRESSBOOK", KEY_ADDRESSBOOK}, {"MESSENGER", KEY_MESSENGER},
{"DISPLAYTOGGLE", KEY_DISPLAYTOGGLE}, {"SPELLCHECK", KEY_SPELLCHECK},
{"LOGOFF", KEY_LOGOFF}, {"DOLLAR", KEY_DOLLAR}, {"EURO", KEY_EURO},
{"FRAMEBACK", KEY_FRAMEBACK}, {"FRAMEFORWARD", KEY_FRAMEFORWARD},
{"CONTEXT_MENU", KEY_CONTEXT_MENU}, {"MEDIA_REPEAT", KEY_MEDIA_REPEAT},
{"10CHANNELSUP", KEY_10CHANNELSUP}, {"10CHANNELSDOWN", KEY_10CHANNELSDOWN},
{"DEL_EOL", KEY_DEL_EOL}, {"DEL_EOS", KEY_DEL_EOS}, {"INS_LINE", KEY_INS_LINE},
{"DEL_LINE", KEY_DEL_LINE}, {"FN", KEY_FN}, {"FN_ESC", KEY_FN_ESC},
{"FN_F1", KEY_FN_F1}, {"FN_F2", KEY_FN_F2}, {"FN_F3", KEY_FN_F3},
{"FN_F4", KEY_FN_F4}, {"FN_F5", KEY_FN_F5}, {"FN_F6", KEY_FN_F6},
{"FN_F7", KEY_FN_F7}, {"FN_F8", KEY_FN_F8}, {"FN_F9", KEY_FN_F9},
{"FN_F10", KEY_FN_F10}, {"FN_F11", KEY_FN_F11}, {"FN_F12", KEY_FN_F12},
{"FN_1", KEY_FN_1}, {"FN_2", KEY_FN_2}, {"FN_D", KEY_FN_D},
{"FN_E", KEY_FN_E}, {"FN_F", KEY_FN_F}, {"FN_S", KEY_FN_S},
{"FN_B", KEY_FN_B}, {"BRL_DOT1", KEY_BRL_DOT1}, {"BRL_DOT2", KEY_BRL_DOT2},
{"BRL_DOT3", KEY_BRL_DOT3}, {"BRL_DOT4", KEY_BRL_DOT4},
{"BRL_DOT5", KEY_BRL_DOT5}, {"BRL_DOT6", KEY_BRL_DOT6},
{"BRL_DOT7", KEY_BRL_DOT7}, {"BRL_DOT8", KEY_BRL_DOT8},
{"BRL_DOT9", KEY_BRL_DOT9}, {"BRL_DOT10", KEY_BRL_DOT10},
{"NUMERIC_0", KEY_NUMERIC_0}, {"NUMERIC_1", KEY_NUMERIC_1},
{"NUMERIC_2", KEY_NUMERIC_2}, {"NUMERIC_3", KEY_NUMERIC_3},
{"NUMERIC_4", KEY_NUMERIC_4}, {"NUMERIC_5", KEY_NUMERIC_5},
{"NUMERIC_6", KEY_NUMERIC_6}, {"NUMERIC_7", KEY_NUMERIC_7},
{"NUMERIC_8", KEY_NUMERIC_8}, {"NUMERIC_9", KEY_NUMERIC_9},
{"NUMERIC_STAR", KEY_NUMERIC_STAR}, {"NUMERIC_POUND", KEY_NUMERIC_POUND},
{"CAMERA_FOCUS", KEY_CAMERA_FOCUS}, {"WPS_BUTTON", KEY_WPS_BUTTON},
{"TOUCHPAD_TOGGLE", KEY_TOUCHPAD_TOGGLE}, {"TOUCHPAD_ON", KEY_TOUCHPAD_ON},
{"TOUCHPAD_OFF", KEY_TOUCHPAD_OFF}};
struct key_buffer { struct key_buffer {
unsigned short buf[KEY_BUFFER_SIZE]; unsigned short buf[KEY_BUFFER_SIZE];
unsigned int size; unsigned int size;
@ -232,10 +91,9 @@ struct hotkey_list_e {
struct hotkey_list_e *hotkey_list = NULL; struct hotkey_list_e *hotkey_list = NULL;
unsigned long hotkey_size_mask = 0; unsigned long hotkey_size_mask = 0;
char *ext_config_file = NULL; char *ext_config_file = NULL;
/* Flags */ /* Global flags */
int vflag = 0; int vflag = 0;
int dead = 0; // exit flag int dead = 0; /* Exit flag */
int dump = 0;
/* key buffer operations */ /* key buffer operations */
int key_buffer_add (struct key_buffer*, unsigned short); int key_buffer_add (struct key_buffer*, unsigned short);
int key_buffer_remove (struct key_buffer*, unsigned short); int key_buffer_remove (struct key_buffer*, unsigned short);
@ -265,11 +123,12 @@ int main (int argc, char *argv[])
int opc; int opc;
int ev_fd; int ev_fd;
int event_watcher = inotify_init1(IN_NONBLOCK); int event_watcher = inotify_init1(IN_NONBLOCK);
ssize_t rb; // Read bits int dump = 0;
ssize_t read_b; /* Read buffer */
struct flock fl; struct flock fl;
struct sigaction action; struct sigaction action;
struct input_event event; struct input_event event;
struct key_buffer pb = {{0}, 0}; // Pressed keys buffer struct key_buffer pb = {{0}, 0}; /* Pressed keys buffer */
/* Parse command line arguments */ /* Parse command line arguments */
while ((opc = getopt(argc, argv, "vc:dh")) != -1) { while ((opc = getopt(argc, argv, "vc:dh")) != -1) {
@ -299,6 +158,7 @@ int main (int argc, char *argv[])
action.sa_handler = int_handler; action.sa_handler = int_handler;
sigaction(SIGINT, &action, NULL); sigaction(SIGINT, &action, NULL);
sigaction(SIGUSR1, &action, NULL); sigaction(SIGUSR1, &action, NULL);
sigaction(SIGCHLD, &action, NULL);
/* Parse config file */ /* Parse config file */
parse_config_file(); parse_config_file();
@ -371,8 +231,8 @@ int main (int argc, char *argv[])
prev_size = pb.size; prev_size = pb.size;
for (int i = 0; i < fd_num; i++) { for (int i = 0; i < fd_num; i++) {
rb = read(fds[i], &event, sizeof(struct input_event)); read_b = read(fds[i], &event, sizeof(struct input_event));
if (rb != sizeof(struct input_event)) continue; if (read_b != sizeof(struct input_event)) continue;
/* Ignore touchpad events */ /* Ignore touchpad events */
if ( if (
@ -483,6 +343,9 @@ void int_handler (int signum)
case SIGUSR1: case SIGUSR1:
parse_config_file(); parse_config_file();
break; break;
case SIGCHLD:
wait(NULL);
break;
} }
} }
@ -670,13 +533,12 @@ void parse_config_file (void)
{ {
wordexp_t result = {0}; wordexp_t result = {0};
FILE *fd; FILE *fd;
// 0: normal, 1: skip line 2: get directive 3: get keys 4: get command 5: output /* normal, skip line, get matching, get keys, get command, output */
int state = 0; enum {NORM, LINE_SKIP, GET_MATCH, GET_KEYS, GET_CMD, LAST} parse_state = NORM;
enum {CONT, NEW_BL, LAST_BL, END} block_state = CONT; /* continue, new block, last block, end */
int alloc_tmp = 0, alloc_size = 0; int alloc_tmp = 0, alloc_size = 0;
int fuzzy = 0; int fuzzy = 0;
int i_tmp = 0, linenum = 1; int i_tmp = 0, linenum = 1;
// 0: aok, 1: request block, 2: last block, -1: exit
int exit_state = 0;
char block[BLOCK_SIZE + 1] = {0}; char block[BLOCK_SIZE + 1] = {0};
char *bb = NULL; char *bb = NULL;
char *keys = NULL; char *keys = NULL;
@ -732,22 +594,22 @@ void parse_config_file (void)
hotkey_list_destroy(hotkey_list); hotkey_list_destroy(hotkey_list);
hotkey_list = NULL; hotkey_list = NULL;
while (exit_state >= 0) { while (block_state != END) {
int tmp = 0; int tmp = 0;
memset(block, 0, BLOCK_SIZE + 1); memset(block, 0, BLOCK_SIZE + 1);
tmp = fread(block, sizeof(char), BLOCK_SIZE, fd); tmp = fread(block, sizeof(char), BLOCK_SIZE, fd);
if (!tmp) if (!tmp)
break; break;
if (tmp < BLOCK_SIZE || feof(fd)) if (tmp < BLOCK_SIZE || feof(fd))
exit_state = 2; block_state = LAST_BL;
else else
exit_state = 0; block_state = CONT;
bb = block; bb = block;
while (exit_state == 0 || exit_state == 2) { while (block_state == CONT || block_state == LAST_BL) {
switch (state) { switch (parse_state) {
// First state // First state
case 0: case NORM:
// remove whitespaces // remove whitespaces
while (isblank(*bb) && *bb) while (isblank(*bb) && *bb)
bb++; bb++;
@ -758,17 +620,14 @@ void parse_config_file (void)
#endif #endif
case '\0': case '\0':
// If it is the end of the last block exit // If it is the end of the last block exit
if (exit_state > 1) block_state = block_state == LAST_BL ? END : NEW_BL;
exit_state = -1;
else
exit_state = 1;
break; break;
case '\n': case '\n':
case '#': case '#':
state = 1; parse_state = LINE_SKIP;
break; break;
default: default:
state = 2; parse_state = GET_MATCH;
break; break;
} }
break; break;
@ -779,9 +638,9 @@ void parse_config_file (void)
if (*bb) { if (*bb) {
bb++; bb++;
linenum++; linenum++;
state = 0; parse_state = NORM;
} else { } else {
exit_state = 1; block_state = NEW_BL;
} }
break; break;
// Get compairson method // Get compairson method
@ -800,7 +659,7 @@ void parse_config_file (void)
break; break;
} }
bb++; bb++;
state = 3; parse_state = GET_KEYS;
break; break;
// Get keys // Get keys
case 3: case 3:
@ -821,15 +680,15 @@ void parse_config_file (void)
if (!bb[alloc_tmp] || alloc_tmp == alloc_size) { if (!bb[alloc_tmp] || alloc_tmp == alloc_size) {
strncat(keys, bb, alloc_tmp); strncat(keys, bb, alloc_tmp);
bb += alloc_tmp; bb += alloc_tmp;
if (exit_state > 1) if (block_state == LAST_BL)
die("Keys not finished before end of file"); die("Keys not finished before end of file");
else else
exit_state = 1; block_state = NEW_BL;
break; break;
} else if (bb[alloc_tmp] == ':') { } else if (bb[alloc_tmp] == ':') {
strncat(keys, bb, alloc_tmp); strncat(keys, bb, alloc_tmp);
bb += alloc_tmp + 1; bb += alloc_tmp + 1;
state = 4; parse_state = GET_CMD;
break; break;
} else { } else {
die("Error at line %d: " die("Error at line %d: "
@ -855,15 +714,15 @@ void parse_config_file (void)
if (!bb[alloc_tmp] || alloc_tmp == alloc_size) { if (!bb[alloc_tmp] || alloc_tmp == alloc_size) {
strncat(cmd, bb, alloc_tmp); strncat(cmd, bb, alloc_tmp);
bb += alloc_tmp; bb += alloc_tmp;
if (exit_state > 1) if (block_state == LAST_BL)
die("Command not finished before end of file"); die("Command not finished before end of file");
else else
exit_state = 1; block_state = NEW_BL;
break; break;
} else { } else {
strncat(cmd, bb, alloc_tmp); strncat(cmd, bb, alloc_tmp);
if (!(bb[alloc_tmp - 1] == '\\')) if (!(bb[alloc_tmp - 1] == '\\'))
state = 5; parse_state = LAST;
bb += alloc_tmp + 1; bb += alloc_tmp + 1;
linenum++; linenum++;
break; break;
@ -909,7 +768,7 @@ void parse_config_file (void)
free(cmd); free(cmd);
cp_tmp = keys = cmd = NULL; cp_tmp = keys = cmd = NULL;
i_tmp = 0; i_tmp = 0;
state = 0; parse_state = NORM;
break; break;
default: default:
die("Unknown state in parse_config_file"); die("Unknown state in parse_config_file");

504
keys.h

@ -0,0 +1,504 @@
#ifndef _H_KEYS
#define _H_KEYS
#include <linux/input.h>
struct {
const char *const name;
const unsigned short value;
} key_conversion_table[] =
{{"ESC", KEY_ESC},
{"1", KEY_1},
{"2", KEY_2},
{"3", KEY_3},
{"4", KEY_4},
{"5", KEY_5},
{"6", KEY_6},
{"7", KEY_7},
{"8", KEY_8},
{"9", KEY_9},
{"0", KEY_0},
{"MINUS", KEY_MINUS},
{"EQUAL", KEY_EQUAL},
{"BACKSPACE", KEY_BACKSPACE},
{"TAB", KEY_TAB},
{"Q", KEY_Q},
{"W", KEY_W},
{"E", KEY_E},
{"R", KEY_R},
{"T", KEY_T},
{"Y", KEY_Y},
{"U", KEY_U},
{"I", KEY_I},
{"O", KEY_O},
{"P", KEY_P},
{"LEFTBRACE", KEY_LEFTBRACE},
{"RIGHTBRACE", KEY_RIGHTBRACE},
{"ENTER", KEY_ENTER},
{"LEFTCTRL", KEY_LEFTCTRL},
{"A", KEY_A},
{"S", KEY_S},
{"D", KEY_D},
{"F", KEY_F},
{"G", KEY_G},
{"H", KEY_H},
{"J", KEY_J},
{"K", KEY_K},
{"L", KEY_L},
{"SEMICOLON", KEY_SEMICOLON},
{"APOSTROPHE", KEY_APOSTROPHE},
{"GRAVE", KEY_GRAVE},
{"LEFTSHIFT", KEY_LEFTSHIFT},
{"BACKSLASH", KEY_BACKSLASH},
{"Z", KEY_Z},
{"X", KEY_X},
{"C", KEY_C},
{"V", KEY_V},
{"B", KEY_B},
{"N", KEY_N},
{"M", KEY_M},
{"COMMA", KEY_COMMA},
{"DOT", KEY_DOT},
{"SLASH", KEY_SLASH},
{"RIGHTSHIFT", KEY_RIGHTSHIFT},
{"KPASTERISK", KEY_KPASTERISK},
{"LEFTALT", KEY_LEFTALT},
{"SPACE", KEY_SPACE},
{"CAPSLOCK", KEY_CAPSLOCK},
{"F1", KEY_F1},
{"F2", KEY_F2},
{"F3", KEY_F3},
{"F4", KEY_F4},
{"F5", KEY_F5},
{"F6", KEY_F6},
{"F7", KEY_F7},
{"F8", KEY_F8},
{"F9", KEY_F9},
{"F10", KEY_F10},
{"NUMLOCK", KEY_NUMLOCK},
{"SCROLLLOCK", KEY_SCROLLLOCK},
{"KP7", KEY_KP7},
{"KP8", KEY_KP8},
{"KP9", KEY_KP9},
{"KPMINUS", KEY_KPMINUS},
{"KP4", KEY_KP4},
{"KP5", KEY_KP5},
{"KP6", KEY_KP6},
{"KPPLUS", KEY_KPPLUS},
{"KP1", KEY_KP1},
{"KP2", KEY_KP2},
{"KP3", KEY_KP3},
{"KP0", KEY_KP0},
{"KPDOT", KEY_KP0},
{"ZENKAKUHANKAKU", KEY_ZENKAKUHANKAKU},
{"102ND", KEY_102ND},
{"F11", KEY_F11},
{"F12", KEY_F12},
{"RO", KEY_RO},
{"KATAKANA", KEY_KATAKANA},
{"HIRAGANA", KEY_HIRAGANA},
{"HENKAN", KEY_HENKAN},
{"KATAKANAHIRAGANA", KEY_KATAKANAHIRAGANA},
{"MUHENKAN", KEY_MUHENKAN},
{"KPJPCOMMA", KEY_KPJPCOMMA},
{"KPENTER", KEY_KPENTER},
{"RIGHTCTRL", KEY_RIGHTCTRL},
{"KPSLASH", KEY_KPSLASH},
{"SYSRQ", KEY_SYSRQ},
{"RIGHTALT", KEY_RIGHTALT},
{"LINEFEED", KEY_LINEFEED},
{"HOME", KEY_HOME},
{"UP", KEY_UP},
{"PAGEUP", KEY_PAGEUP},
{"LEFT", KEY_LEFT},
{"RIGHT", KEY_RIGHT},
{"END", KEY_END},
{"DOWN", KEY_DOWN},
{"PAGEDOWN", KEY_PAGEDOWN},
{"INSERT", KEY_INSERT},
{"DELETE", KEY_DELETE},
{"MACRO", KEY_MACRO},
{"MUTE", KEY_MUTE},
{"VOLUMEDOWN", KEY_VOLUMEDOWN},
{"VOLUMEUP", KEY_VOLUMEUP},
{"POWER", KEY_POWER},
{"KPEQUAL", KEY_KPEQUAL},
{"KPPLUSMINUS", KEY_KPPLUSMINUS},
{"PAUSE", KEY_PAUSE},
{"SCALE", KEY_SCALE},
{"KPCOMMA", KEY_KPCOMMA},
{"HANGEUL", KEY_HANGEUL},
{"HANGUEL", KEY_HANGEUL},
{"HANJA", KEY_HANJA},
{"YEN", KEY_YEN},
{"LEFTMETA", KEY_LEFTMETA},
{"RIGHTMETA", KEY_LEFTMETA},
{"COMPOSE", KEY_COMPOSE},
{"STOP", KEY_STOP},
{"AGAIN", KEY_AGAIN},
{"PROPS", KEY_PROPS},
{"UNDO", KEY_UNDO},
{"FRONT", KEY_FRONT},
{"COPY", KEY_COPY},
{"OPEN", KEY_OPEN},
{"PASTE", KEY_PASTE},
{"FIND", KEY_FIND},
{"CUT", KEY_CUT},
{"HELP", KEY_HELP},
{"MENU", KEY_MENU},
{"CALC", KEY_CALC},
{"SETUP", KEY_SETUP},
{"SLEEP", KEY_SLEEP},
{"WAKEUP", KEY_WAKEUP},
{"FILE", KEY_FILE},
{"SENDFILE", KEY_SENDFILE},
{"DELETEFILE", KEY_DELETEFILE},
{"XFER", KEY_XFER},
{"PROG1", KEY_PROG1},
{"PROG2", KEY_PROG2},
{"WWW", KEY_WWW},
{"MSDOS", KEY_MSDOS},
{"COFFEE", KEY_COFFEE},
{"SCREENLOCK", KEY_COFFEE},
{"DIRECTION", KEY_DIRECTION},
{"CYCLEWINDOWS", KEY_CYCLEWINDOWS},
{"MAIL", KEY_MAIL},
{"BOOKMARKS", KEY_BOOKMARKS},
{"COMPUTER", KEY_COMPUTER},
{"BACK", KEY_BACK},
{"FORWARD", KEY_FORWARD},
{"CLOSECD", KEY_CLOSECD},
{"EJECTCD", KEY_EJECTCD},
{"EJECTCLOSECD", KEY_EJECTCLOSECD},
{"NEXTSONG", KEY_NEXTSONG},
{"PLAYPAUSE", KEY_PLAYPAUSE},
{"PREVIOUSSONG", KEY_PREVIOUSSONG},
{"STOPCD", KEY_STOPCD},
{"RECORD", KEY_RECORD},
{"REWIND", KEY_REWIND},
{"PHONE", KEY_PHONE},
{"ISO", KEY_ISO},
{"CONFIG", KEY_CONFIG},
{"HOMEPAGE", KEY_HOMEPAGE},
{"REFRESH", KEY_REFRESH},
{"EXIT", KEY_EXIT},
{"MOVE", KEY_MOVE},
{"EDIT", KEY_EDIT},
{"SCROLLUP", KEY_SCROLLUP},
{"SCROLLDOWN", KEY_SCROLLDOWN},
{"KPLEFTPAREN", KEY_KPLEFTPAREN},
{"KPRIGHTPAREN", KEY_KPRIGHTPAREN},
{"NEW", KEY_NEW},{"REDO", KEY_REDO},
{"F13", KEY_F13},{"F14", KEY_F14},
{"F15", KEY_F15},{"F16", KEY_F16},
{"F17", KEY_F17},{"F18", KEY_F18},
{"F19", KEY_F19},{"F20", KEY_F20},
{"F21", KEY_F21},{"F22", KEY_F22},
{"F23", KEY_F23},{"F24", KEY_F24},
{"PLAYCD", KEY_PLAYCD},
{"PAUSECD", KEY_PAUSECD},
{"PROG3", KEY_PROG3},
{"PROG4", KEY_PROG4},
{"DASHBOARD", KEY_DASHBOARD},
{"SUSPEND", KEY_SUSPEND},
{"CLOSE", KEY_CLOSE},
{"PLAY", KEY_PLAY},
{"FASTFORWARD", KEY_FASTFORWARD},
{"BASSBOOST", KEY_BASSBOOST},
{"PRINT", KEY_PRINT},
{"HP", KEY_HP},
{"CAMERA", KEY_CAMERA},
{"SOUND", KEY_SOUND},
{"QUESTION", KEY_QUESTION},
{"EMAIL", KEY_EMAIL},
{"CHAT", KEY_CHAT},
{"SEARCH", KEY_SEARCH},
{"CONNECT", KEY_CONNECT},
{"FINANCE", KEY_FINANCE},
{"SPORT", KEY_SPORT},
{"SHOP", KEY_SHOP},
{"ALTERASE", KEY_ALTERASE},
{"CANCEL", KEY_CANCEL},
{"BRIGHTNESSDOWN", KEY_BRIGHTNESSDOWN},
{"BRIGHTNESSUP", KEY_BRIGHTNESSUP},
{"MEDIA", KEY_MEDIA},
{"SWITCHVIDEOMODE", KEY_SWITCHVIDEOMODE},
{"KBDILLUMTOGGLE", KEY_KBDILLUMTOGGLE},
{"KBDILLUMDOWN", KEY_KBDILLUMDOWN},
{"KBDILLUMUP", KEY_KBDILLUMUP},
{"SEND", KEY_SEND},
{"REPLY", KEY_REPLY},
{"FORWARDMAIL", KEY_FORWARDMAIL},
{"SAVE", KEY_SAVE},
{"DOCUMENTS", KEY_DOCUMENTS},
{"BATTERY", KEY_BATTERY},
{"BLUETOOTH", KEY_BLUETOOTH},
{"WLAN", KEY_WLAN},
{"UWB", KEY_UWB},
{"UNKNOWN", KEY_UNKNOWN},
{"VIDEO_NEXT", KEY_VIDEO_NEXT},
{"VIDEO_PREV", KEY_VIDEO_PREV},
{"BRIGHTNESS_CYCLE", KEY_BRIGHTNESS_CYCLE},
{"BRIGHTNESS_ZERO", KEY_BRIGHTNESS_ZERO},
{"DISPLAY_OFF", KEY_DISPLAY_OFF},
{"WIMAX", KEY_WIMAX},
{"RFKILL", KEY_RFKILL},
{"BTN_MISC", BTN_MISC},
{"BTN_0", BTN_0},
{"BTN_1", BTN_1},
{"BTN_2", BTN_2},
{"BTN_3", BTN_3},
{"BTN_4", BTN_4},
{"BTN_5", BTN_5},
{"BTN_6", BTN_6},
{"BTN_7", BTN_7},
{"BTN_8", BTN_8},
{"BTN_9", BTN_9},
{"BTN_MOUSE", BTN_MOUSE},
{"BTN_LEFT", BTN_LEFT},
{"BTN_RIGHT", BTN_RIGHT},
{"BTN_MIDDLE", BTN_MIDDLE},
{"BTN_SIDE", BTN_SIDE},
{"BTN_EXTRA", BTN_EXTRA},
{"BTN_FORWARD", BTN_FORWARD},
{"BTN_BACK", BTN_BACK},
{"BTN_TASK", BTN_TASK},
{"BTN_JOYSTICK", BTN_JOYSTICK},
{"BTN_TRIGGER", BTN_TRIGGER},
{"BTN_THUMB", BTN_THUMB},
{"BTN_THUMB2", BTN_THUMB2},
{"BTN_TOP", BTN_TOP},
{"BTN_TOP2", BTN_TOP2},
{"BTN_PINKIE", BTN_PINKIE},
{"BTN_BASE", BTN_BASE},
{"BTN_BASE2", BTN_BASE2},
{"BTN_BASE3", BTN_BASE3},
{"BTN_BASE4", BTN_BASE4},
{"BTN_BASE5", BTN_BASE5},
{"BTN_BASE6", BTN_BASE6},
{"BTN_DEAD", BTN_DEAD},
{"BTN_GAMEPAD", BTN_GAMEPAD},
{"BTN_A", BTN_A},
{"BTN_B", BTN_B},
{"BTN_C", BTN_C},
{"BTN_X", BTN_X},
{"BTN_Y", BTN_Y},
{"BTN_Z", BTN_Z},
{"BTN_TL", BTN_TL},
{"BTN_TR", BTN_TR},
{"BTN_TL2", BTN_TL2},
{"BTN_TR2", BTN_TR2},
{"BTN_SELECT", BTN_SELECT},
{"BTN_START", BTN_START},
{"BTN_MODE", BTN_MODE},
{"BTN_THUMBL", BTN_THUMBL},
{"BTN_THUMBR", BTN_THUMBR},
{"BTN_DIGI", BTN_DIGI},
{"BTN_TOOL_PEN", BTN_TOOL_PEN},
{"BTN_TOOL_RUBBER", BTN_TOOL_RUBBER},
{"BTN_TOOL_BRUSH", BTN_TOOL_RUBBER},
{"BTN_TOOL_PENCIL", BTN_TOOL_PENCIL},
{"BTN_TOOL_AIRBRUSH", BTN_TOOL_AIRBRUSH},
{"BTN_TOOL_FINGER", BTN_TOOL_FINGER},
{"BTN_TOOL_MOUSE", BTN_TOOL_MOUSE},
{"BTN_TOOL_LENS", BTN_TOOL_LENS},
{"BTN_TOUCH", BTN_TOUCH},
{"BTN_STYLUS", BTN_STYLUS},
{"BTN_STYLUS2", BTN_STYLUS2},
{"BTN_TOOL_DOUBLETAP", BTN_TOOL_DOUBLETAP},
{"BTN_TOOL_TRIPLETAP", BTN_TOOL_TRIPLETAP},
{"BTN_TOOL_QUADTAP", BTN_TOOL_QUADTAP},
{"BTN_WHEEL", BTN_WHEEL},
{"BTN_GEAR_DOWN", BTN_GEAR_DOWN},
{"BTN_GEAR_UP", BTN_GEAR_UP},
{"OK", KEY_OK},
{"SELECT", KEY_SELECT},
{"GOTO", KEY_GOTO},
{"CLEAR", KEY_CLEAR},
{"POWER2", KEY_POWER2},
{"OPTION", KEY_OPTION},
{"INFO", KEY_INFO},
{"TIME", KEY_TIME},
{"VENDOR", KEY_VENDOR},
{"ARCHIVE", KEY_ARCHIVE},
{"PROGRAM", KEY_PROGRAM},
{"CHANNEL", KEY_CHANNEL},
{"FAVORITES", KEY_FAVORITES},
{"EPG", KEY_EPG},
{"PVR", KEY_PVR},
{"MHP", KEY_MHP},
{"LANGUAGE", KEY_LANGUAGE},
{"TITLE", KEY_TITLE},
{"SUBTITLE", KEY_SUBTITLE},
{"ANGLE", KEY_ANGLE},
{"ZOOM", KEY_ZOOM},
{"MODE", KEY_MODE},
{"KEYBOARD", KEY_KEYBOARD},
{"SCREEN", KEY_SCREEN},
{"PC", KEY_PC},
{"TV", KEY_TV},
{"TV2", KEY_TV2},
{"VCR", KEY_VCR},
{"VCR2", KEY_VCR2},
{"SAT", KEY_SAT},
{"SAT2", KEY_SAT2},
{"CD", KEY_CD},
{"TAPE", KEY_TAPE},
{"RADIO", KEY_RADIO},
{"TUNER", KEY_TUNER},
{"PLAYER", KEY_PLAYER},
{"TEXT", KEY_TEXT},
{"DVD", KEY_DVD},
{"AUX", KEY_AUX},
{"MP3", KEY_MP3},
{"AUDIO", KEY_AUDIO},
{"VIDEO", KEY_VIDEO},
{"DIRECTORY", KEY_DIRECTORY},
{"LIST", KEY_LIST},
{"MEMO", KEY_MEMO},
{"CALENDAR", KEY_CALENDAR},
{"RED", KEY_RED},
{"GREEN", KEY_GREEN},
{"YELLOW", KEY_YELLOW},
{"BLUE", KEY_BLUE},
{"CHANNELUP", KEY_CHANNELUP},
{"CHANNELDOWN", KEY_CHANNELDOWN},
{"FIRST", KEY_FIRST},{"LAST", KEY_LAST},
{"AB", KEY_AB},
{"NEXT", KEY_NEXT},
{"RESTART", KEY_RESTART},
{"SLOW", KEY_SLOW},
{"SHUFFLE", KEY_SHUFFLE},
{"BREAK", KEY_BREAK},
{"PREVIOUS", KEY_PREVIOUS},
{"DIGITS", KEY_DIGITS},
{"TEEN", KEY_TEEN},
{"TWEN", KEY_TWEN},
{"VIDEOPHONE", KEY_VIDEOPHONE},
{"GAMES", KEY_GAMES},
{"ZOOMIN", KEY_ZOOMIN},
{"ZOOMOUT", KEY_ZOOMOUT},
{"ZOOMRESET", KEY_ZOOMRESET},
{"WORDPROCESSOR", KEY_WORDPROCESSOR},
{"EDITOR", KEY_EDITOR},
{"SPREADSHEET", KEY_SPREADSHEET},
{"GRAPHICSEDITOR", KEY_GRAPHICSEDITOR},
{"PRESENTATION", KEY_PRESENTATION},
{"DATABASE", KEY_DATABASE},
{"NEWS", KEY_NEWS},
{"VOICEMAIL", KEY_VOICEMAIL},
{"ADDRESSBOOK", KEY_ADDRESSBOOK},
{"MESSENGER", KEY_MESSENGER},
{"DISPLAYTOGGLE", KEY_DISPLAYTOGGLE},
{"SPELLCHECK", KEY_SPELLCHECK},
{"LOGOFF", KEY_LOGOFF},
{"DOLLAR", KEY_DOLLAR},
{"EURO", KEY_EURO},
{"FRAMEBACK", KEY_FRAMEBACK},
{"FRAMEFORWARD", KEY_FRAMEFORWARD},
{"CONTEXT_MENU", KEY_CONTEXT_MENU},
{"MEDIA_REPEAT", KEY_MEDIA_REPEAT},
{"10CHANNELSUP", KEY_10CHANNELSUP},
{"10CHANNELSDOWN", KEY_10CHANNELSDOWN},
{"DEL_EOL", KEY_DEL_EOL},
{"DEL_EOS", KEY_DEL_EOS},
{"INS_LINE", KEY_INS_LINE},
{"DEL_LINE", KEY_DEL_LINE},
{"FN", KEY_FN},
{"FN_ESC", KEY_FN_ESC},
{"FN_F1", KEY_FN_F1},
{"FN_F2", KEY_FN_F2},
{"FN_F3", KEY_FN_F3},
{"FN_F4", KEY_FN_F4},
{"FN_F5", KEY_FN_F5},
{"FN_F6", KEY_FN_F6},
{"FN_F7", KEY_FN_F7},
{"FN_F8", KEY_FN_F8},
{"FN_F9", KEY_FN_F9},
{"FN_F10", KEY_FN_F10},
{"FN_F11", KEY_FN_F11},
{"FN_F12", KEY_FN_F12},
{"FN_1", KEY_FN_1},
{"FN_2", KEY_FN_2},
{"FN_D", KEY_FN_D},
{"FN_E", KEY_FN_E},
{"FN_F", KEY_FN_F},
{"FN_S", KEY_FN_S},
{"FN_B", KEY_FN_B},
{"BRL_DOT1", KEY_BRL_DOT1},
{"BRL_DOT2", KEY_BRL_DOT2},
{"BRL_DOT3", KEY_BRL_DOT3},
{"BRL_DOT4", KEY_BRL_DOT4},
{"BRL_DOT5", KEY_BRL_DOT5},
{"BRL_DOT6", KEY_BRL_DOT6},
{"BRL_DOT7", KEY_BRL_DOT7},
{"BRL_DOT8", KEY_BRL_DOT8},
{"BRL_DOT9", KEY_BRL_DOT9},
{"BRL_DOT10", KEY_BRL_DOT10},
{"NUMERIC_0", KEY_NUMERIC_0},
{"NUMERIC_1", KEY_NUMERIC_1},
{"NUMERIC_2", KEY_NUMERIC_2},
{"NUMERIC_3", KEY_NUMERIC_3},
{"NUMERIC_4", KEY_NUMERIC_4},
{"NUMERIC_5", KEY_NUMERIC_5},
{"NUMERIC_6", KEY_NUMERIC_6},
{"NUMERIC_7", KEY_NUMERIC_7},
{"NUMERIC_8", KEY_NUMERIC_8},
{"NUMERIC_9", KEY_NUMERIC_9},
{"NUMERIC_STAR", KEY_NUMERIC_STAR},
{"NUMERIC_POUND", KEY_NUMERIC_POUND},
{"CAMERA_FOCUS", KEY_CAMERA_FOCUS},
{"WPS_BUTTON", KEY_WPS_BUTTON},
{"TOUCHPAD_TOGGLE", KEY_TOUCHPAD_TOGGLE},
{"TOUCHPAD_ON", KEY_TOUCHPAD_ON},
{"TOUCHPAD_OFF", KEY_TOUCHPAD_OFF},
{"BTN_TRIGGER_HAPPY", BTN_TRIGGER_HAPPY},
{"BTN_TRIGGER_HAPPY1", BTN_TRIGGER_HAPPY1},
{"BTN_TRIGGER_HAPPY2", BTN_TRIGGER_HAPPY2},
{"BTN_TRIGGER_HAPPY3", BTN_TRIGGER_HAPPY3},
{"BTN_TRIGGER_HAPPY4", BTN_TRIGGER_HAPPY4},
{"BTN_TRIGGER_HAPPY5", BTN_TRIGGER_HAPPY5},
{"BTN_TRIGGER_HAPPY6", BTN_TRIGGER_HAPPY6},
{"BTN_TRIGGER_HAPPY7", BTN_TRIGGER_HAPPY7},
{"BTN_TRIGGER_HAPPY8", BTN_TRIGGER_HAPPY8},
{"BTN_TRIGGER_HAPPY9", BTN_TRIGGER_HAPPY9},
{"BTN_TRIGGER_HAPPY10", BTN_TRIGGER_HAPPY10},
{"BTN_TRIGGER_HAPPY11", BTN_TRIGGER_HAPPY11},
{"BTN_TRIGGER_HAPPY12", BTN_TRIGGER_HAPPY12},
{"BTN_TRIGGER_HAPPY13", BTN_TRIGGER_HAPPY13},
{"BTN_TRIGGER_HAPPY14", BTN_TRIGGER_HAPPY14},
{"BTN_TRIGGER_HAPPY15", BTN_TRIGGER_HAPPY15},
{"BTN_TRIGGER_HAPPY16", BTN_TRIGGER_HAPPY16},
{"BTN_TRIGGER_HAPPY17", BTN_TRIGGER_HAPPY17},
{"BTN_TRIGGER_HAPPY18", BTN_TRIGGER_HAPPY18},
{"BTN_TRIGGER_HAPPY19", BTN_TRIGGER_HAPPY19},
{"BTN_TRIGGER_HAPPY20", BTN_TRIGGER_HAPPY20},
{"BTN_TRIGGER_HAPPY21", BTN_TRIGGER_HAPPY21},
{"BTN_TRIGGER_HAPPY22", BTN_TRIGGER_HAPPY22},
{"BTN_TRIGGER_HAPPY23", BTN_TRIGGER_HAPPY23},
{"BTN_TRIGGER_HAPPY24", BTN_TRIGGER_HAPPY24},
{"BTN_TRIGGER_HAPPY25", BTN_TRIGGER_HAPPY25},
{"BTN_TRIGGER_HAPPY26", BTN_TRIGGER_HAPPY26},
{"BTN_TRIGGER_HAPPY27", BTN_TRIGGER_HAPPY27},
{"BTN_TRIGGER_HAPPY28", BTN_TRIGGER_HAPPY28},
{"BTN_TRIGGER_HAPPY29", BTN_TRIGGER_HAPPY29},
{"BTN_TRIGGER_HAPPY30", BTN_TRIGGER_HAPPY30},
{"BTN_TRIGGER_HAPPY31", BTN_TRIGGER_HAPPY31},
{"BTN_TRIGGER_HAPPY32", BTN_TRIGGER_HAPPY32},
{"BTN_TRIGGER_HAPPY33", BTN_TRIGGER_HAPPY33},
{"BTN_TRIGGER_HAPPY34", BTN_TRIGGER_HAPPY34},
{"BTN_TRIGGER_HAPPY35", BTN_TRIGGER_HAPPY35},
{"BTN_TRIGGER_HAPPY36", BTN_TRIGGER_HAPPY36},
{"BTN_TRIGGER_HAPPY37", BTN_TRIGGER_HAPPY37},
{"BTN_TRIGGER_HAPPY38", BTN_TRIGGER_HAPPY38},
{"BTN_TRIGGER_HAPPY39", BTN_TRIGGER_HAPPY39},
{"BTN_TRIGGER_HAPPY40", BTN_TRIGGER_HAPPY40},
/* Aliases */
{"CTRL", KEY_LEFTCTRL},
{"META", KEY_LEFTMETA},
{"ALT", KEY_LEFTALT},
{"SHIFT", KEY_LEFTSHIFT},
{"PRINTSCR", KEY_SYSRQ},
{"MIC_MUTE", KEY_F20}};
#endif

@ -1,6 +1,6 @@
CC ?= gcc CC ?= gcc
CFLAGS = -Wall -Werror -pedantic --std=c99 -O2 CFLAGS = -Wall -Werror -pedantic --std=c99 -O2
VERSION = 0.3 VERSION = 0.4
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man MANPREFIX = ${PREFIX}/share/man

Loading…
Cancel
Save