[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101118121256.GA19884@boole.suse.de>
Date: Thu, 18 Nov 2010 13:12:56 +0100
From: "Dr. Werner Fink" <werner@...e.de>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: Greg KH <greg@...ah.com>,
Lennart Poettering <mzxreary@...inter.de>,
Kay Sievers <kay.sievers@...y.org>, Valdis.Kletnieks@...edu,
linux-kernel <linux-kernel@...r.kernel.org>,
Randy Dunlap <rdunlap@...otime.net>,
Jiri Slaby <jslaby@...e.cz>
Subject: Re: tty: add 'active' sysfs attribute to tty0 and console device
On Thu, Nov 18, 2010 at 11:23:35AM +0000, Alan Cox wrote:
> > is the most pressing case e.g. on s390 or zSeries) and this without
> > forcing (and maybe stealing) the controlling tty on the system console
> > to be able to detect the primary tty/console.
>
> What do you mean by console in this context
>
> The console in printk context and the "console" in "active vt window" are
> unrelated concepts with the same name, so its a bit confusing to follow
> here.
Example: running a boot script on /dev/console and after fsck
sulogin has to called to be able to asked the system admin.
Now the question is which console device the system admin is
waiting in front of (before /dev/ttyS0 or /dev/tty3270 or whatever).
> > facilities (having device, read, write, and unblank) are also shown
> > in the new file /sys/class/tty/console/active ... but maybe Randy
> > could says a few words for what this is usable.
>
> The system console does not even need to be a tty device, and on many
> embedded devices is not (it may for example by a RAM buffer not wiped
> over reboots or it may be jtag or MIPI trace ports.
>
> "tty0" is *currently* a shorthand for "the VT the keyboard/display are
> showing". That's a shorthand that in itself will make no sense in future.
I'm aware of. For using tty devices of the system console it requires
to have e.g. with my patch:
bash> cat /proc/tty/consoles
tty0 -WU (ECp) 4:7
the `W' flag for write and the major:minor pair, beside this the `U'
flag indicates the tty can do an unblank operation, the `-' shows that
there is no read operation (never seen such a console tty). On an other
system here I see:
bash> cat /proc/tty/consoles
ttyS0 -W- (ECp) 4:64
tty0 -WU (Ep) 4:1
which I'm using in user space with
dev_t dev = 0;
FILE * fc;
if ((fc = fopen("/proc/tty/consoles", "r"))) {
char fbuf[16];
int maj, min;
while ((fscanf(fc, "%*s %*s (%[^)]) %d:%d", &fbuf[0], &maj, &min) == 3)) {
if (!strchr(fbuf, 'E'))
continue;
if (strchr(fbuf, 'C')) {
dev = makedev(maj, min);
break;
}
}
fclose(fc);
}
to detect the primary console device here.
Werner
--
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists