Re: determining active console

2003-02-27 Thread Dave2206
In a message dated 2/27/03 1:01:23 PM Central Standard Time, 
[EMAIL PROTECTED] writes:

> On 2003-02-27 17:58, Hanspeter Roth <[EMAIL PROTECTED]> wrote:
>  > On Feb 27 at 15:48, Giorgos Keramidas spoke:
>  > > On 2003-02-27 12:39, Hanspeter Roth <[EMAIL PROTECTED]> wrote:
>  > > > Hello,
>  > > > how can I determine the active console?
>  > >
>  > > Use the tty(1) command:
>  >
>  > But this seems to yield the tty from which the command was launched.
>  > So if I do
>  >
>  > sleep 9; tty
>  
>  Hmmm, this is the "definition" of a virtual console.  You can run
>  long-running commands on one and still switch to another.
>  
>  > and then switch to an another console, that `tty` yields the tty
>  > that was active when the command line was started.
>  
>  Yep.  That's the idea.
>  
>  > But I'd like to know the console that has got the keyboard focus by
>  > switching with --.
>  
>  So, run "tty" on the console *after* switching to it :-)
>  
>  

This may be somthing you can add to your prompt.  Depending on your shell of 
course 
cdw 

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message


Re: determining active console

2003-02-27 Thread Dan Nelson
In the last episode (Feb 27), Hanspeter Roth said:
> On Feb 27 at 15:48, Giorgos Keramidas spoke:
> > On 2003-02-27 12:39, Hanspeter Roth <[EMAIL PROTECTED]> wrote:
> > > Hello,
> > > how can I determine the active console?
> > 
> > Use the tty(1) command:
>
> But I'd like to know the console that has got the keyboard focus by
> switching with --.

Use the undocumented VT_GETACTIVE ioctl on stdin (or anything else
connected to a vty) which will return the active vty number.  You can
also disable vty switching, programmatically switch to a particular
vty, and do other neat stuff.  Take a look at
/usr/src/usr.sbin/vidcontrolfor usage examples and
/usr/src/sys/dev/syscons/syscons.c for all the possible ioctls.

-- 
Dan Nelson
[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message


Re: determining active console

2003-02-27 Thread Giorgos Keramidas
On 2003-02-27 17:58, Hanspeter Roth <[EMAIL PROTECTED]> wrote:
> On Feb 27 at 15:48, Giorgos Keramidas spoke:
> > On 2003-02-27 12:39, Hanspeter Roth <[EMAIL PROTECTED]> wrote:
> > > Hello,
> > > how can I determine the active console?
> >
> > Use the tty(1) command:
>
> But this seems to yield the tty from which the command was launched.
> So if I do
>
> sleep 9; tty

Hmmm, this is the "definition" of a virtual console.  You can run
long-running commands on one and still switch to another.

> and then switch to an another console, that `tty` yields the tty
> that was active when the command line was started.

Yep.  That's the idea.

> But I'd like to know the console that has got the keyboard focus by
> switching with --.

So, run "tty" on the console *after* switching to it :-)


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message


Re: determining active console

2003-02-27 Thread Hanspeter Roth
  On Feb 27 at 15:48, Giorgos Keramidas spoke:

> On 2003-02-27 12:39, Hanspeter Roth <[EMAIL PROTECTED]> wrote:
> > Hello,
> > how can I determine the active console?
> 
> Use the tty(1) command:

But this seems to yield the tty from which the command was launched.
So if I do

sleep 9; tty

and then switch to an another console, that `tty` yields the tty
that was active when the command line was started.
But I'd like to know the console that has got the keyboard focus by
switching with --.

-Hanspeter

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message


Re: determining active console

2003-02-27 Thread Giorgos Keramidas
On 2003-02-27 12:39, Hanspeter Roth <[EMAIL PROTECTED]> wrote:
> Hello,
> how can I determine the active console?

Use the tty(1) command:

: [EMAIL PROTECTED]:47]/home/giorgos$ tty
: /dev/ttyv1
: [EMAIL PROTECTED]:47]/home/giorgos$

/dev/ttyv0 is the first virtual console, ttyv1 the second, etc.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message


determining active console

2003-02-27 Thread Hanspeter Roth
Hello,

how can I determine the active console?

-Hanspeter

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message