strcpy(cfg->mouse_file, cur_cmd);
get_next_string(parse_line, cur_cmd, &str_pos, ' ');
cfg->mouse_toggle_key = cur_cmd[0];
+ get_next_string(parse_line, cur_cmd, &str_pos, ' ');
+ cfg->mouse_autoconnect = (strcmp(cur_cmd, "autoconnect") == 0) ? 1 : 0;
cfg->mouse_enabled = 1;
printf("[CFG] Enabled mouse event forwarding from file %s, toggle key %c.\n", cfg->mouse_file, cfg->mouse_toggle_key);
break;
cfg->keyboard_toggle_key = cur_cmd[0];
get_next_string(parse_line, cur_cmd, &str_pos, ' ');
cfg->keyboard_grab = (strcmp(cur_cmd, "grab") == 0) ? 1 : 0;
- printf("[CFG] Enabled keyboard event forwarding, toggle key %c, %slocking from host.\n",
- cfg->keyboard_toggle_key, cfg->keyboard_grab ? "" : "not ");
+ get_next_string(parse_line, cur_cmd, &str_pos, ' ');
+ cfg->keyboard_autoconnect = (strcmp(cur_cmd, "autoconnect") == 0) ? 1 : 0;
+ printf("[CFG] Enabled keyboard event forwarding, toggle key %c", cfg->keyboard_toggle_key);
+ if (cfg->keyboard_grab)
+ printf(", locking from host when connected");
+ if (cfg->keyboard_autoconnect)
+ printf(", connected to guest at startup");
+ printf(".\n");
break;
case CONFITEM_KBFILE:
get_next_string(parse_line, cur_cmd, &str_pos, ' ');
char *mouse_file, *keyboard_file;
char mouse_toggle_key, keyboard_toggle_key;
- unsigned char mouse_enabled, keyboard_enabled, keyboard_grab;
+ unsigned char mouse_enabled, mouse_autoconnect, keyboard_enabled, keyboard_grab, keyboard_autoconnect;
unsigned int loop_cycles;
unsigned int mapped_low, mapped_high;
# Uncomment this line to enable the (currently non-working) Pi-Net interface.
#setvar pi-net
-# Forward mouse events to host system, defaults to off unless toggle key is pressed on the Pi.
-# Syntax is mouse [device] [toggle key]
-#mouse /dev/input/mouse0 m
# Forward keyboard events to host system, defaults to off unless toggle key is pressed, toggled off using F12.
-# Add the keyword "grab" to steal the keyboard from the Pi, so Amiga input does not appear on the console or in X11.
-# (also helps prevent sending any ctrl-alt-del to the Amiga from resetting the Pi)
-keyboard k grab
+# Syntax: keyboard [grab key] [grab|nograb] [autoconnect|noautoconnect]
+# "grab" steals the keyboard from the Pi so Amiga/etc. input is not sent to the Pi
+# (also helps prevent sending any ctrl-alt-del to the Amiga from resetting the Pi)
+#
+# "autoconnect" connects the keyboard to the Amiga/etc. on startup
+keyboard k nograb noautoconnect
# 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
+# Forward mouse events to host system, defaults to off unless toggle key is pressed on the Pi.
+# Syntax is mouse [device] [toggle key] [autoconnect|noautoconnect]
+# (see "keyboard" above for autoconnect description)
+mouse /dev/input/mice m noautoconnect
// printf("CPU emulation reset.\n");
}
-
if (mouse_hook_enabled && (mouse_extra != 0x00)) {
// mouse wheel events have occurred; unlike l/m/r buttons, these are queued as keypresses, so add to end of buffer
switch (mouse_extra) {
printf("Failed to open keyboard event source.\n");
}
+ if (cfg->mouse_autoconnect)
+ mouse_hook_enabled = 1;
+
+ if (cfg->keyboard_autoconnect)
+ kb_hook_enabled = 1;
+
InitGayle();
signal(SIGINT, sigint_handler);