tty's

tty's

Post by non » Sat, 15 Mar 2003 01:05:48



on a linux box you can switch through 6 virtual terminals (<alt>+F1 -
<alt>+F6)
can you increase or decrease the number of the virtual terminals ?
xfree86 server runs on <alt>+F7. normally the isn't anything.
how can i 'request' (in a programm) another (new) virtual terminal, like
xfree does ?

thanks
tom

 
 
 

tty's

Post by Bill Marcu » Sat, 15 Mar 2003 19:48:11




> on a linux box you can switch through 6 virtual terminals (<alt>+F1 -
><alt>+F6)
> can you increase or decrease the number of the virtual terminals ?
> xfree86 server runs on <alt>+F7. normally the isn't anything.
> how can i 'request' (in a programm) another (new) virtual terminal, like
> xfree does ?

man openvt

--
"Trusted Computing": the biggest oxymoron since "Military Intelligence"
or "Congressional Ethics"

 
 
 

tty's

Post by non » Sun, 16 Mar 2003 05:04:20





>>on a linux box you can switch through 6 virtual terminals (<alt>+F1 -
>><alt>+F6)
>>can you increase or decrease the number of the virtual terminals ?
>>xfree86 server runs on <alt>+F7. normally the isn't anything.
>>how can i 'request' (in a programm) another (new) virtual terminal, like
>>xfree does ?

> man openvt

and in a C programm?
if you start the X-Server (with startx) on the first console (tty0), the
server shows on console 7 (tty6), how is it done ?

perhaps with close(0), close(1), close(2) and then three times
open("/dev/tty6", ..) ?

but how does the kernel know where to put the graphics ?
does the graphics go always to tty6 ?
or can you have more than one X-Server running ?

tom

 
 
 

tty's

Post by Kasper Dupon » Mon, 17 Mar 2003 20:46:06



> man openvt

Have you ever been able to get openvt working? It never worked
when I tried it. There is another command open that is supposed
to do exactly the same, and that actually works.

--
Kasper Dupont -- der bruger for meget tid p? usenet.

for(_=52;_;(_%5)||(_/=5),(_%5)&&(_-=2))putchar(_);

 
 
 

tty's

Post by Kasper Dupon » Mon, 17 Mar 2003 21:00:22






> >>on a linux box you can switch through 6 virtual terminals (<alt>+F1 -
> >><alt>+F6)
> >>can you increase or decrease the number of the virtual terminals ?
> >>xfree86 server runs on <alt>+F7. normally the isn't anything.
> >>how can i 'request' (in a programm) another (new) virtual terminal, like
> >>xfree does ?

> > man openvt

> and in a C programm?

Use VT_OPENQRY to get the number of the first available tty.
Then open the device in /dev.

Quote:> if you start the X-Server (with startx) on the first console (tty0), the
> server shows on console 7 (tty6), how is it done ?

No, you are wrong. That would be tty1 and tty7. The number
zero is reserved. In fact tty0 means the active tty, that
is the one that is active when you open it.

Quote:

> perhaps with close(0), close(1), close(2) and then three times
> open("/dev/tty6", ..) ?

I don't think that is how X does, but you are close to the
way the open/openvt commands do. However you shouldn't use
open more than once, rather use dup2. And don't use close,
just dup2 over the original, then it is automatically
closed.

The code would look similar to this:

  char buf[42];
  sprintf(buf,"/dev/tty%d",number);
  fd=open(buf,O_RDWR);
  if (fd==-1) return -1;
  dup2(fd,0);
  dup2(fd,1);
  dup2(fd,2);
  if (fd>2) close(fd);

The number you can get by using VT_OPENQRY on any tty, I
would recomend tty1:

  fd=open("/dev/tty1",O_WRONLY);
  if (fd==-1) return -1;
  ioctl(fd,VT_OPENQRY,&number);
  close(fd);

Quote:

> but how does the kernel know where to put the graphics ?
> does the graphics go always to tty6 ?

That is more complicated. X does use some ioctls to
tell the kernel that it intends to use the tty for
graphics. It also tells the kernel not to switch without
first allowing X to do whatever it has to do to the gfx
chips. But it is X that does all the graphics hardware
setup and cleanup. If you want to use graphics you might
find svgalib a help.

Quote:> or can you have more than one X-Server running ?

Yes, at least sometimes you can. I have not been able to
start two instances of XFree86 with my i810 chipset, but
on all computers I tried it, it worked without problems.

You just need to tell XFree86 to use different display
numbers, it doesn't know how to find an unused display
number.

If you are using startx just type:
   startx -- :1
to use display number 1 instead of number 0.

--
Kasper Dupont -- der bruger for meget tid p? usenet.

for(_=52;_;(_%5)||(_/=5),(_%5)&&(_-=2))putchar(_);