One of my test domUs is a opensuse 10.3 PV domain, and it has a /boot/grub/menu.lst file. pygrub is used as bootloader. With xVM 3.1.4, the arrow keys can be used in the pygrub screen. With xVM 3.3-unstable, the arrow keys don''t work for me any more. What I''ve found out so far is that: - gnome-terminal, xterm or dtterm are running with "vt100 application key mode" disabled, that is, the arrow keys send ESC [ A, ESC [ B, ESC [ C and ESC [ D - pygrub is started by xend with $TERM=vt100 The vt100 terminfo entry defines the "vt100 application key mode" sequences for the cursor keys: ESC O A, ESC O B, ESC O C and ESC O D During curses initialization, the vt100 terminfo sequence "smkx" is sent by pygrub, which includes "ESC [ ? 1 h". This enables the application key mode; gnome-terminal / xterm / dtterm starts sending the ESC O ... cursor key sequences. Now the problem seems to be that the xenconsole process opens the domain''s slave pty, and uses the init_term() function to configure the terminal for "raw" mode. init_term() uses a TCSAFLUSH ioctl to set the new terminal attributes, but that apparently flushes queued data (the" ESC [ ? 1 h" vt100 init sequence for switching to application mode) that is already waiting in the pty''s output queue. Why doesn''t xen.hg/tools/console/client/main.c use TCSANOW when configuring terminal attributes? That wouldn''t flush queued data, and with such a change the arrow keys start working for me inside pygrub. diff --git a/tools/console/client/main.c b/tools/console/client/main.c --- a/tools/console/client/main.c +++ b/tools/console/client/main.c @@ -164,7 +164,7 @@ new_term = *old; cfmakeraw(&new_term); - tcsetattr(fd, TCSAFLUSH, &new_term); + tcsetattr(fd, TCSANOW, &new_term); } static void restore_term(int fd, struct termios *old) This message posted from opensolaris.org
Jürgen Keil wrote:> One of my test domUs is a opensuse 10.3 PV domain, and it > has a /boot/grub/menu.lst file. pygrub is used as bootloader. > > With xVM 3.1.4, the arrow keys can be used in the pygrub screen. > > With xVM 3.3-unstable, the arrow keys don''t work for me any more. > > > What I''ve found out so far is that: > > - gnome-terminal, xterm or dtterm are running with > "vt100 application key mode" disabled, that is, the arrow > keys send ESC [ A, ESC [ B, ESC [ C and ESC [ D > > - pygrub is started by xend with $TERM=vt100 > The vt100 terminfo entry defines the "vt100 application key mode" > sequences for the cursor keys: > ESC O A, ESC O B, ESC O C and ESC O D > > During curses initialization, the vt100 terminfo sequence > "smkx" is sent by pygrub, which includes "ESC [ ? 1 h". > This enables the application key mode; gnome-terminal / > xterm / dtterm starts sending the ESC O ... cursor key > sequences. > > Now the problem seems to be that the xenconsole > process opens the domain''s slave pty, and uses > the init_term() function to configure the terminal for > "raw" mode. init_term() uses a TCSAFLUSH ioctl > to set the new terminal attributes, but that apparently > flushes queued data (the" ESC [ ? 1 h" vt100 init sequence > for switching to application mode) that is already waiting > in the pty''s output queue. > > > Why doesn''t xen.hg/tools/console/client/main.c use > TCSANOW when configuring terminal attributes? > That wouldn''t flush queued data, and with such a change > the arrow keys start working for me inside pygrub.It looks like this is fixed in the pty-fixes patch in xvm 3.1.4 bits. Maybe a mismerge when it was moved to unstable? MRJ> diff --git a/tools/console/client/main.c b/tools/console/client/main.c > --- a/tools/console/client/main.c > +++ b/tools/console/client/main.c > @@ -164,7 +164,7 @@ > new_term = *old; > cfmakeraw(&new_term); > > - tcsetattr(fd, TCSAFLUSH, &new_term); > + tcsetattr(fd, TCSANOW, &new_term); > } > > static void restore_term(int fd, struct termios *old) > > > This message posted from opensolaris.org > _______________________________________________ > xen-discuss mailing list > xen-discuss@opensolaris.org
Mark Johnson wrote:> Jürgen Keil wrote: > > One of my test domUs is a opensuse 10.3 PV domain, and it > > has a /boot/grub/menu.lst file. pygrub is used as bootloader. > > > > With xVM 3.1.4, the arrow keys can be used in the pygrub screen. > > > > With xVM 3.3-unstable, the arrow keys don't work for me any more. > > ... > > Why doesn't xen.hg/tools/console/client/main.c use > > TCSANOW when configuring terminal attributes? > > That wouldn't flush queued data, and with such a change > > the arrow keys start working for me inside pygrub. > > It looks like this is fixed in the pty-fixes patch > in xvm 3.1.4 bits. Maybe a mismerge when it was moved > to unstable?No, don't think so. There are three places with tcsetattr() calls in xvm-3.1.4 xen.hg/tools/console/client/main.c; the first on in get_pty_fd() inside an #ifdef __sun__ block uses TCSANOW, so with this call we can't loose data. The second one is in init_term(). This is the one that uses TCSAFLUSH. And there is restore_term, which uses TCSAFLUSH, too. Wait a minute... While writing this, I noticed that xvm-3.1.4 calls init_term for xenconsole's stdin only, but in xen-3.3 they've changed it to use init_term() both for xenconsole's stdin *and* they use it on the slave pty that is used between xend<->xenconsole: xvm-gate/xen.hg/tools/console/client/main.c: 332 spty = get_pty_fd(xs, path, 5); 333 if (spty == -1) { 334 err(errno, "Could not read tty from store"); 335 } 336 337 init_term(spty, &attr); 338 init_term(STDIN_FILENO, &attr); 339 console_loop(spty, xs, path); 340 restore_term(STDIN_FILENO, &attr); Line 337 is new; the init_term() call might flush queued pygrub screen output. This message posted from opensolaris.org _______________________________________________ xen-discuss mailing list xen-discuss@opensolaris.org
> While writing this, I noticed that xvm-3.1.4 calls > init_term for xenconsole''s stdin only, but in xen-3.3 > they''ve changed it to use init_term() both for > xenconsole''s stdin *and* they use it on the > slave pty that is used between xend<->xenconsole:Hmm, that init_term(spty) call was added to fix a pseudo terminal issue for NetBSD - changeset 15928: http://xenbits.xensource.com/xen-unstable.hg?rev/40bf3ffff484 description: Fix tools/console to build on NetBSD. - include headers needed to build on NetBSD - Remove unused pty.h - Initialize spty terminal before actually using it Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> This message posted from opensolaris.org
Jürgen Keil wrote:> Mark Johnson wrote: >> Jürgen Keil wrote: >>> One of my test domUs is a opensuse 10.3 PV domain, and it >>> has a /boot/grub/menu.lst file. pygrub is used as bootloader. >>> >>> With xVM 3.1.4, the arrow keys can be used in the pygrub screen. >>> >>> With xVM 3.3-unstable, the arrow keys don't work for me any more. >>> ... >>> Why doesn't xen.hg/tools/console/client/main.c use >>> TCSANOW when configuring terminal attributes? >>> That wouldn't flush queued data, and with such a change >>> the arrow keys start working for me inside pygrub. >> It looks like this is fixed in the pty-fixes patch >> in xvm 3.1.4 bits. Maybe a mismerge when it was moved >> to unstable? > > No, don't think so.yep, sorry, didn't have my patched applied :-(. MRJ> There are three places with tcsetattr() calls in > xvm-3.1.4 xen.hg/tools/console/client/main.c; > the first on in get_pty_fd() inside an #ifdef __sun__ > block uses TCSANOW, so with this call we > can't loose data. > > The second one is in init_term(). This is the one > that uses TCSAFLUSH. > And there is restore_term, which uses TCSAFLUSH, too. > > Wait a minute... > While writing this, I noticed that xvm-3.1.4 calls > init_term for xenconsole's stdin only, but in xen-3.3 > they've changed it to use init_term() both for > xenconsole's stdin *and* they use it on the > slave pty that is used between xend<->xenconsole: > > xvm-gate/xen.hg/tools/console/client/main.c: > > 332 spty = get_pty_fd(xs, path, 5); > 333 if (spty == -1) { > 334 err(errno, "Could not read tty from store"); > 335 } > 336 > 337 init_term(spty, &attr); > 338 init_term(STDIN_FILENO, &attr); > 339 console_loop(spty, xs, path); > 340 restore_term(STDIN_FILENO, &attr); > > > Line 337 is new; the init_term() call might flush queued pygrub > screen output. > > > This message posted from opensolaris.org > _______________________________________________ > xen-discuss mailing list > xen-discuss@opensolaris.org_______________________________________________ xen-discuss mailing list xen-discuss@opensolaris.org