Subject: Re: Programmatic way of changing virtual terminals?
To: Brian de Alwis <bsd@cs.ubc.ca>
From: Simon Burge <simonb@wasabisystems.com>
List: netbsd-users
Date: 01/18/2002 16:36:49
Brian de Alwis wrote:

> My laptop's mouse cursor disappears in XFree86 after an APM resume.
> >From some web searches, this appears to be a rather common problem.

Common for NetBSD, or XFree86 on other OS's as well?

> Luckily there's a workaround: it reappears if I switch to and then
> from a text-console.
> 
> So my question: I was wondering if there was a way to do this VT-switching
> programmatically. It would be trivial to then incorporate this into
> the APM scripts. I'm using wscons; wsconsctl doesn't seem to have
> the ability to do this though.  Is there any way of doing this?

There's an VT_ACTIVATE ioctl that would seem to do what you're after.
Be careful - it looks like it uses `1' for the first screen, not `0'.
Something along the lines of:

	int screen;

	/* select the console (virtual screen 0) */
	screen = 1;
	error = ioctl(fd, VT_ACTIVATE, &screen);

showhorned into wsconsctl should be a good place to start.

If we do plan on adding this functionality to, say, wsconsctl, then
we probably should also make a WSDISPLAYIO_ACTIVATE ioctl too...

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD CDs, Support and Service:    http://www.wasabisystems.com/