Skip to content

Commit

Permalink
Add device function for USB serial console
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kevin Hao authored and Linus Torvalds committed Jan 2, 2009
1 parent 975a1a7 commit 39efd19
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/usb/serial/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 39efd19

Please sign in to comment.