[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] handling SIGWINCH with qemu -nographic
From: |
Rob Landley |
Subject: |
Re: [Qemu-devel] handling SIGWINCH with qemu -nographic |
Date: |
Fri, 19 Oct 2007 19:22:04 -0500 |
User-agent: |
KMail/1.9.6 |
On Monday 15 October 2007 8:15:29 pm Jeff Carr wrote:
> Has anyone looked into finding a way to pass SIGWINCH through to the
> guest? I started looking at linux-user/signal.c.
>
> For those that might not be familiar with SIGWINCH, supporting it
> would allow qemu -nographic to tell when the terminal is a different
> size than 80x24.
The problem is a serial port is essentially a pipe. You don't get tty
information about the terminal plugged into the other side, because that's a
separate machine on the other side of a piece of hardware which doesn't pass
through that info. (What _is_ the width and height of a modem?)
Have your program send an ansi probe sequence:
echo -e "\e[s\e[999C\e[999B\e[6n\e[u"
Then parse the return string, which should look something like escape left
bracket 25 semicolon 80 capital R, and use it to set $LINES=25 and
$COLUMNS=80.
Any modern terminal program should handle that and spit back a result telling
you big the tty is (although it doesn't tell you when it _changes_, you have
to re-probe). Yes, it's in-band signalling but over a serial connection
that's all you've got.
Rob
--
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.