Add device function for USB serial console

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, January 2, 2009 - 1:00 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=39efd1...
Commit:     39efd191d01b5f1efc3d604baf74233dc525e6a8
Parent:     975a1a7d887048d4afc9201383e11b7af991866b
Author:     Kevin Hao <kexin.hao@windriver.com>
AuthorDate: Fri Jan 2 13:44:34 2009 +0000
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Fri Jan 2 10:19:38 2009 -0800

    Add device function for USB serial console
    
    Add device funtion for usb serial console, so we can open /dev/console
    when we use a usb serial device as console.
    
    (Typecast removed as noted by Sergei Shtylyov)
    
    Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
    Signed-off-by: Alan Cox <alan@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 drivers/usb/serial/console.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 5b95009..19e2404 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -241,12 +241,25 @@ static void usb_console_write(struct console *co,
 	}
 }
 
+static struct tty_driver *usb_console_device(struct console *co, int *index)
+{
+	struct tty_driver **p = (struct tty_driver **)co->data;
+
+	if (!*p)
+		return NULL;
+
+	*index = co->index;
+	return *p;
+}
+
 static struct console usbcons = {
 	.name =		"ttyUSB",
 	.write =	usb_console_write,
+	.device =	usb_console_device,
 	.setup =	usb_console_setup,
 	.flags =	CON_PRINTBUFFER,
 	.index =	-1,
+	.data = 	&usb_serial_tty_driver,
 };
 
 void usb_serial_console_disconnect(struct usb_serial *serial)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Add device function for USB serial console, Linux Kernel Mailing ..., (Fri Jan 2, 1:00 pm)