Skip to contentSkip to conversation

Bug/Inconvenience report

Qemu-devel Johannes Martin 2 participants 2 messages Aug 17, 2004 – Aug 18, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

when qemu crashes, it usually leaves the console window in a state where input isn't echoed to the terminal, i.e. you don't see what you type any more. /usr/bin/reset fixes this.

Also, if qemu had grabbed the mouse before crashing, the mouse will be stuck after the crash or disappear completely. Restarting qemu and grabbing/degrabbing will fix this.

Would it be possible to install some signal handlers and/or atexit() routines to restore console and mouse settings on unexpected failures?

Thanks
Johannes

#1 lore raw
Quoted 5 lines · Johannes Martin

Hi,

when qemu crashes, it usually leaves the console window in a state where input isn't echoed to the terminal, i.e. you don't see what you type any more. /usr/bin/reset fixes this.

I propose a small patch to change the console tty settings only when qemu uses the console for input/output.

----------------------------------------------->8--

vl.c +4 -0
diff -wurb qemu/vl.c qemu-patched/vl.c
@@ -1467,6 +1467,8 @@
 
 static void term_exit(void)
 {
+    if (stdio_nb_clients == 0)
+        return;
     tcsetattr (0, TCSANOW, &oldtty);
     fcntl(0, F_SETFL, old_fd0_flags);
 }
@@ -1475,6 +1477,8 @@
 {
     struct termios tty;
 
+    if (stdio_nb_clients == 0)
+        return;
     tcgetattr (0, &tty);
     oldtty = tty;
     old_fd0_flags = fcntl(0, F_GETFL);

----------------------------------------------->8--

This patch enables qemu to run as a background process. It initialises the current terminal only when serial- or monitor-I/O is redirected to stdin/stdout or when -nographic is selected. Without this patch, the program hangs in the term_init() and term_exit() functions when running as a background process.

examples:
qemu -hda disk.img &
xinit /usr/local/bin/qemu -hda disk.img -- :1 &

The second example launches qemu with a second X server and permits to switch between host and guest operating systems using ctrl-alt-F7 and ctrl-alt-F8.

Quoted 4 lines

Also, if qemu had grabbed the mouse before crashing, the mouse will be stuck after the crash or disappear completely. Restarting qemu and grabbing/degrabbing will fix this.

Even worse is working in full-screen mode before a crash.

Quoted 3 lines

Would it be possible to install some signal handlers and/or atexit() routines to restore console and mouse settings on unexpected failures?

and returning from full-screen mode.

Quoted 3 lines

Thanks
Johannes

Mark Jonckheere

Signature · 1 line
:wq