Timur Tabi | 25 Oct 2010 20:23
Favicon

Question about 'device' field of struct console

I'm trying to write a console and TTY driver that's not based on a serial port,
and I'm confused by the "device' field of 'struct console'.  I found this text
in http://www.linux.it/~rubini/docs/sercons/sercons.html:

"The purpose of the UDP console device is sending kernel messages through the
network. Unlike serial or vt consoles, which are associated to real tty devices,
this console has no tty associated, and that's why the device function is not
defined.

In a real console device, the device function is used to return the device
number associated to this console as a kdev_t value. Only one serial port can be
elected as a console, for example, and the device function defined by the serial
driver is used to tell the caller which one is. The function is used in
drivers/char/tty_io.c to redirect any access to /dev/console. Thus, a process
that opens /dev/console will actually open a different device, provided at least
one of the active console drivers has a device function and the device returned
is known to the tty layer. "

I don't really understand this.  What is a "real tty device"?  What am I missing
if I don't have a real TTY device?

Using other drivers as an example, I can fill the 'device' field with a pointer
to this function ehv_bc_console_device():

static struct tty_driver *ehv_bc_driver;

static struct tty_driver *ehv_bc_console_device(struct console *c, int *index)
{
	*index = c->index;

(Continue reading)

Timur Tabi | 25 Oct 2010 23:30
Favicon

Warning: unable to open an initial console.

Hi,

I'm trying to write a console/tty driver, and I need help.  When the kernel
boots, I can see that console output is working through my driver.  However,
after the initial kernel boot, my console stops working.  Here are the relevant
parts of the boot log:

Using P4080DS HV machine description
Memory CAM mapping: 256/256 Mb, residual: 0Mb
Linux version 2.6.34-6506-00741-gbd4ea2b-dirty (b04825 <at> efes) (gcc version 4.4.1
(Sourcery G++ Lite 4.4-194) ) #33 SMP Mon Oct 25 16:20:20 CDT 2010
Found initrd at 0xc1300000:0xc3b00000
...
Kernel command line: console=ttyEHV
...
console [ttyEHV0] enabled
...
NET: Registered protocol family 10
IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
NET: Registered protocol family 15
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
Warning: unable to open an initial console. -19
RAMDISK: gzip image found at block 0
VFS: Mounted root (ext2 filesystem) readonly on device 1:0.
Freeing unused kernel memory: 236k init

And this is where it stops.

As you can see, I have a console, and then I lose it.  What could cause this to
(Continue reading)

Timur Tabi | 27 Oct 2010 22:38
Favicon

Is this mailing list dead?

Is anyone reading this mailing list?  I presume that since it's called
"linux-console" and hosted on kernel.org, that this is the right place to ask
for help with writing console drivers.  However, it doesn't appear that anyone
is actually reading this list, so I want to make sure I'm not wasting my time here.

I'm trying to write a console/TTY driver that is not a UART driver, and I can't
seem to find a good example of such a driver out there.  Specfically, my driver
has an interrupt handler that calls tty_insert_flip_string() when it receives
new input.  What I don't understand is how am I supposed to know what "struct
tty_struct" to use for this function.  It appears that it's possible to open the
TTY device multiple times, each time with a different struct tty_struct.  But I
can only have one interrupt handler, so I don't know how I'm supposed to
determine which of the many struct tty_struct pointers to use.

--

-- 
Timur Tabi
Linux kernel developer at Freescale

--
To unsubscribe from this list: send the line "unsubscribe linux-console" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane