trouble with virtual console and svgalib

Search this archive.

From: l_bee@hongkong.com
Date: Thu 08 Mar 2001 - 15:01:52 IST


  Refer to "Problem about open new virtual console with svgalib". I have tried to use this method ("Open" package with my svga program).It works with svgalib program 
  I want to embed the open virtual console code into my svgalib problem . (I need to use shell command "open -s -w program" to run a svgalib program at a new virtual console before ).As result , I try to use this source code with my program . But I have found that the a new virtual console will be displayed . but my svgalib program  will execute on the original console .
the sample code below :

==================================
#include "open.h"
#include <vga.h>
const char *SWITCHTOversion = "switchto: 1.0 (c) Jon Tombs 1994";


int 
main(int argc, char *argv[])
{

   int fd;
   int vtno     = -1;


   if (argc < 2) 
 	usage(1);

   vtno = (int) atol(argv[1]);

   if (vtno < 0 || vtno > 63)
	usage(2);

   if ((fd = open("/dev/console",O_WRONLY,0)) < 0) {
	perror("switchto: Can't open /dev/console\n");
	return(3);
   }
   

   if (ioctl(fd, VT_ACTIVATE, vtno) < 0) {
        fprintf(stderr, "switcho: Failed to select VT %d (%s)\n", vtno,
                strerror(errno));
	return(3);
   }
	
   /* wait to be really sure we have switched */
   (void) ioctl(fd, VT_WAITACTIVE, vtno);
/* vga lib code */

vga_init();
vga_setmode(4); 
vga_drawline(0,0,30,30);	
vga_getch(); 
vga_setmode(TEXT); 

   return 0;
}
      

========================================



----------------------------------------------
 歡迎使用HongKong.com郵件系統
 Thank you for using hongkong.com Email system


------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST