"keyboard",
"platform",
"setvar",
+ "kbfile",
};
const char *mapcmd_names[MAPCMD_NUM] = {
break;
case CONFITEM_KEYBOARD:
get_next_string(parse_line, cur_cmd, &str_pos, ' ');
+ cfg->keyboard_file = (char *)calloc(1, strlen(cur_cmd) + 1);
cfg->keyboard_toggle_key = cur_cmd[0];
printf("Enabled keyboard event forwarding, toggle key %c.\n", cfg->keyboard_toggle_key);
break;
+ case CONFITEM_KBFILE:
+ get_next_string(parse_line, cur_cmd, &str_pos, ' ');
+ cfg->keyboard_file = (char *)calloc(1, strlen(cur_cmd) + 1);
+ strcpy(cfg->keyboard_file, cur_cmd);
+ printf("Set keyboard event source file to %s.\n", cfg->keyboard_file);
+ break;
case CONFITEM_PLATFORM: {
char platform_name[128], platform_sub[128];
memset(platform_name, 0x00, 128);
CONFITEM_KEYBOARD,
CONFITEM_PLATFORM,
CONFITEM_SETVAR,
+ CONFITEM_KBFILE,
CONFITEM_NUM,
} config_items;
struct platform_config *platform;
- char *mouse_file;
+ char *mouse_file, *keyboard_file;
char mouse_toggle_key, keyboard_toggle_key;
unsigned char mouse_enabled, keyboard_enabled;
#mouse /dev/input/mouse0 m
# Forward keyboard events to host system, defaults to off unless toggle key is pressed, toggled off using F12.
#keyboard k
+# Select a specific filename for the keyboard event source.
+# This is typically /dev/input/event1 or event0, but it may be event3 with for instance a wireless keyboard.
+# Use ls /dev/input/event* to check which event files are available and try until you find the one that works.
+#kbfile /dev/input/event1
}
}
- keyboard_fd = open(keyboard_file, O_RDONLY | O_NONBLOCK);
+ if (cfg->keyboard_file)
+ keyboard_fd = open(cfg->keyboard_file, O_RDONLY | O_NONBLOCK);
+ else
+ keyboard_fd = open(keyboard_file, O_RDONLY | O_NONBLOCK);
+
if (keyboard_fd == -1) {
printf("Failed to open keyboard event source.\n");
}