/* Subject: Commandline screen switching To: None From: Michael Kukat List: netbsd-users Date: 11/13/2002 09:00:20 Hello all, someone using a notebook? I think the problem is quite normal, that in suspending the machine or switching off the display, the X doesn't come up fine after resuming. The only thing to get this done right: switch to text console after suspending, and after waking up, switch back to screen 5 to get a fine working X. Aren't computers made to make things easier? We want to do this automatically. wsconscfg/wsconsctl don't have these features included. Why not? Will this be added in future releases? Until then, here is a very simple code fragment (okay, it is a fully working program :): */ #include #include #include #include #include int main(int argc, char **argv) { int fd, screen; if(argc != 2) { fprintf(stderr, "Usage: %s \n", argv[0]); return(1); } screen = atoi(argv[1]); if(screen < 1 || screen > 8) { fprintf(stderr, "Screen number %d invalid\n", screen); return(1); } fd = open("/dev/ttyCcfg", O_RDWR, 0); /* /dev/ttyEcfg for netbsd, /dev/ttyCcfg for openbsd 4.0 --joshua.dunfield at gmail*/ if(fd != -1) { printf("Switching"); if(ioctl(fd, VT_ACTIVATE, screen) != 0) perror("ioctl"); close(fd); } else perror("open"); } /* Save this as wsswitch.c, compile it with gcc -s -O2 -o wsswitch wsswitch.c and edit your scripts in /etc/apm to do wsswitch 1 in standby/suspend and do wsswitch 5 in resume This doesn't avoid the real problem but is a fine workaround for the problem. Other purposes: s script like while true; do wsswitch 1; sleep 5; wsswitch 2; sleep 5; wsswitch 3; sleep 5; d one to monitor the activities on multiple ttys, where things like this cute i4b monitor are running. No warranties, usual disclaimer stuff, i hope, someone has a use for this, otherwise just ignore this mail :) This is just a little hack which doesn't get any version number nor is it supported in any way. ...Michael -- http://www.bsdfans.org/ Home Powered by: (Net|Open|Free)BSD IRIX NonStop-UX Solaris AIX HP-UX Tru64 MUNIX Ultrix VMS SINIX Dolphin_Unix OpenStep MacOS A/UX */