From owner-freebsd-questions Thu Feb 27 11:17:55 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 97F4D37B405 for ; Thu, 27 Feb 2003 11:17:51 -0800 (PST) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id A32F443F75 for ; Thu, 27 Feb 2003 11:17:50 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.6/8.12.6) id h1RJHo4g066616 for freebsd-questions@FreeBSD.ORG; Thu, 27 Feb 2003 13:17:50 -0600 (CST) (envelope-from dan) Date: Thu, 27 Feb 2003 13:17:50 -0600 From: Dan Nelson To: freebsd-questions@FreeBSD.ORG Subject: Re: determining active console Message-ID: <20030227191750.GB6748@dan.emsphone.com> References: <20030227113959.GB610@gicco.homeip.net> <20030227134837.GD1297@gothmog.gr> <20030227165828.GA3638@gicco.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030227165828.GA3638@gicco.homeip.net> X-OS: FreeBSD 5.0-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.3i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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 dnelson@allantgroup.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message