mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: gregkh@suse.de, torvalds@linux-foundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jason Wessel <jason.wessel@windriver.com>,
	Alan Stern <stern@rowland.harvard.edu>
Subject: [PATCH 2/2] usb console: pass initial console baud on to first tty open
Date: Sat,  5 Sep 2009 16:08:38 -0500	[thread overview]
Message-ID: <1252184918-9577-3-git-send-email-jason.wessel@windriver.com> (raw)
In-Reply-To: <1252184918-9577-2-git-send-email-jason.wessel@windriver.com>

The first open of the usb serial HW has the termios initialized to the
default of 9600 baud, and this will override what ever was setup via
the original console initialization.

The solution is to save the console baud rate and re-use it later on
the first open, so as to allow the use of baud rates other than 9600
for the usb serial console.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Cc: Greg KH <gregkh@suse.de>
Cc: Alan Stern <stern@rowland.harvard.edu>

---
 drivers/usb/serial/console.c    |    1 +
 drivers/usb/serial/usb-serial.c |    4 +++-
 include/linux/usb/serial.h      |    1 +
 3 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 0e4f2e4..35ba616 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -175,6 +175,7 @@ static int usb_console_setup(struct console *co, char *options)
 	/* The console is special in terms of closing the device so
 	 * indicate this port is now acting as a system console. */
 	port->console = 1;
+	port->console_init_baud = baud;
 	retval = 0;
 
 out:
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 7ca4ced..7ec5e0c 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -245,7 +245,9 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
 		 * first time the port is opened and it is not a
 		 * console port where the HW has already been
 		 * initialized */
-		if (!port->console) {
+		if (port->console) {
+			tty_encode_baud_rate(tty, port->console_init_baud, port->console_init_baud);
+		} else {
 			retval = serial->type->open(tty, port, filp);
 			if (retval)
 				goto bailout_interface_put;
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 0ec50ba..d5e586f 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -107,6 +107,7 @@ struct usb_serial_port {
 	char			throttled;
 	char			throttle_req;
 	char			console;
+	int			console_init_baud;
 	unsigned long		sysrq; /* sysrq timeout */
 	struct device		dev;
 	enum port_dev_state	dev_state;
-- 
1.6.3.1.9.g95405b


  reply	other threads:[~2009-09-05 21:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-05 21:08 [PATCH 0/2] usb console: 2.6.31 regression fixes Jason Wessel
2009-09-05 21:08 ` [PATCH 1/2] usb console: fix kernel crash on stty -a < /dev/ttyUSB0 Jason Wessel
2009-09-05 21:08   ` Jason Wessel [this message]
2009-09-15 22:45   ` USB: " Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1252184918-9577-3-git-send-email-jason.wessel@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®