On Wed, Sep 25, 2002 at 07:19:06AM -0700, Eric Miao wrote: > > 1. How can I switch to another virtual terminal by > normal user process? > VT_ACTIVATE ioctl can only be called by processes > having root rights. > This is a snippet of a little program I wrote called vtswitch that shows how to use the VT_ACTIVATE ioctl. This works as a normal user, so you might be using it wrong. I can send the whole program if you want to see how the whole thing works but this is the guts: <--- begin code block ----> int vtfd; #define VT_DEVICE_FILE "/dev/tty" vtfd = open(VT_DEVICE_FILE, O_RDWR, 0); if(vtfd < 0) { printf("*error* Could not open /dev/tty\n"); } /* Save the current vt index to the history file */ save_cur_vt_index(vtfd); /* Switch to the terminal if there wasn't an error looking up the alias */ if(ioctl(vtfd, VT_ACTIVATE, terminal)) { printf("*error* Error switching to terminal %s (%d)\n", vt, terminal); return -1; } <-- end code block --> > 2. When I switch away from and again back to the > virtual terminal where I do frame buffer drawing, > screen content is destroyed and replaced by original > console text? > How can I avoid this problem? You can save the framebuffer contents to a program array and then poll the current vt every once and a while (using VT_GETSTATE and vt_stat.vt_active), check to see if your program is on the visible vt and then copy it back to restore it. This could also keep your program from drawing to the framebuffer when it's not visible. > > 3. What is FBIOPUT_CON2FBMAP? What does it do? Not sure. > > 4. How can I do flipping between primary frame and > secondary frame? Create an offscreen surface using malloc and do your rendering to that and then do a memcpy (simple way) or hardware accellerated blt (faster but harder to setup). burton