--- trunk/src/console.c 2007/10/08 16:20:48 31 +++ trunk/src/console.c 2007/10/08 16:20:58 32 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: console.c,v 1.16 2006/05/05 21:28:09 debug Exp $ + * $Id: console.c,v 1.21 2006/10/31 08:26:38 debug Exp $ * * Generic console support functions. * @@ -92,16 +92,11 @@ static int console_slave_outputd; static int console_initialized = 0; +static struct settings *console_settings = NULL; static int console_stdout_pending; #define CONSOLE_FIFO_LEN 4096 -/* Mouse coordinates: */ -static int console_framebuffer_mouse_x; /* absolute x, 0-based */ -static int console_framebuffer_mouse_y; /* absolute y, 0-based */ -static int console_framebuffer_mouse_fb_nr; /* fb_number of last - framebuffer cursor update */ - static int console_mouse_x; /* absolute x, 0-based */ static int console_mouse_y; /* absolute y, 0-based */ static int console_mouse_fb_nr; /* framebuffer number of @@ -139,11 +134,11 @@ /* - * console_deinit(): + * console_deinit_main(): * * Restore host's console settings. */ -void console_deinit(void) +void console_deinit_main(void) { if (!console_initialized) return; @@ -158,15 +153,17 @@ * console_sigcont(): * * If the user presses CTRL-Z (to stop the emulator process) and then - * continues, we have to make sure that the right termios settings are - * active. (This should be set as the SIGCONT signal handler in src/emul.c.) + * continues, the termios settings might have been invalidated. This + * function restores them. + * + * (This function should be set as the SIGCONT signal handler in src/emul.c.) */ void console_sigcont(int x) { if (!console_initialized) return; - /* Make sure our 'current' termios setting is active: */ + /* Make sure that the correct (current) termios setting is active: */ tcsetattr(STDIN_FILENO, TCSANOW, &console_curtermios); /* Reset the signal handler: */ @@ -489,33 +486,6 @@ /* - * console_get_framebuffer_mouse(): - * - * TODO: Comment - */ -void console_get_framebuffer_mouse(int *x, int *y, int *fb_nr) -{ - *x = console_framebuffer_mouse_x; - *y = console_framebuffer_mouse_y; - *fb_nr = console_framebuffer_mouse_fb_nr; -} - - -/* - * console_set_framebuffer_mouse(): - * - * A framebuffer device calls this function when it sets the - * position of a cursor (ie a mouse cursor). - */ -void console_set_framebuffer_mouse(int x, int y, int fb_nr) -{ - console_framebuffer_mouse_x = x; - console_framebuffer_mouse_y = y; - console_framebuffer_mouse_fb_nr = fb_nr; -} - - -/* * console_getmouse(): * * Puts current mouse data into the variables pointed to by @@ -572,7 +542,7 @@ int inputd; int len; char *p; - char buf[400]; + char buf[16384]; /* arg = '3,6' or similar, input and output descriptors */ /* printf("console_slave(): arg = '%s'\n", arg); */ @@ -618,7 +588,7 @@ write(console_slave_outputd, buf, len); } - usleep(100); + usleep(10000); } } @@ -714,7 +684,12 @@ chp->outputonly = 1; chp->in_use_for_input = 0; } - chp->machine_name = strdup(machine->machine_name); + + if (machine->machine_name != NULL) + chp->machine_name = strdup(machine->machine_name); + else + chp->machine_name = strdup(""); + chp->name = strdup(consolename); if (allow_slaves) @@ -973,7 +948,8 @@ { int handle; struct console_handle *chp; - struct settings *console_settings = settings_new(); + + console_settings = settings_new(); settings_add(global_settings, "console", 1, SETTINGS_TYPE_SUBSETTINGS, 0, console_settings); @@ -991,3 +967,15 @@ chp->in_use_for_input = 1; } + +/* + * console_deinit(): + * + * Unregister settings registered by console_init(). + */ +void console_deinit(void) +{ + settings_remove(console_settings, "allow_slaves"); + settings_remove(global_settings, "console"); +} +