From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ij4sQ-0005GJ-1Q for qemu-devel@nongnu.org; Fri, 19 Oct 2007 23:19:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ij4sO-0005Fe-Dh for qemu-devel@nongnu.org; Fri, 19 Oct 2007 23:19:49 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ij4sO-0005Fb-8o for qemu-devel@nongnu.org; Fri, 19 Oct 2007 23:19:48 -0400 Received: from static-71-162-243-5.phlapa.fios.verizon.net ([71.162.243.5] helo=grelber.thyrsus.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ij4sO-0002hA-25 for qemu-devel@nongnu.org; Fri, 19 Oct 2007 23:19:48 -0400 From: Rob Landley Subject: Re: [Qemu-devel] handling SIGWINCH with qemu -nographic Date: Fri, 19 Oct 2007 19:22:04 -0500 References: <471410B1.3030703@gmail.com> In-Reply-To: <471410B1.3030703@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200710191922.04587.rob@landley.net> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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.