mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexey Galakhov <agalakhov@gmail.com>
To: barebox@lists.infradead.org
Cc: Alexey Galakhov <agalakhov@gmail.com>
Subject: [PATCH 2/2] Force set console baudrate at enable time
Date: Wed, 10 Jul 2013 16:15:10 +0600	[thread overview]
Message-ID: <1373451310-8131-2-git-send-email-agalakhov@gmail.com> (raw)
In-Reply-To: <1373451310-8131-1-git-send-email-agalakhov@gmail.com>
In-Reply-To: <20130710090131.GE516@pengutronix.de>

Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
---
 common/console.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/common/console.c b/common/console.c
index a0a06f6..28941d6 100644
--- a/common/console.c
+++ b/common/console.c
@@ -80,6 +80,12 @@ static int console_std_set(struct device_d *dev, struct param_d *param,
 		flag |= CONSOLE_STDERR;
 	}
 
+	if (flag && !cdev->f_active) {
+		/* The device is being activated, set its baudrate */
+		if (cdev->setbrg)
+			cdev->setbrg(cdev, cdev->baudrate);
+	}
+
 	active[i] = 0;
 	cdev->f_active = flag;
 
@@ -104,6 +110,8 @@ static int console_baudrate_set(struct param_d *param, void *priv)
 	struct console_device *cdev = priv;
 	unsigned char c;
 
+	/* If the device is already active, change its baudrate.
+	The baudrate of an inactive device will be set at activation time. */
 	if (cdev->f_active) {
 		printf("## Switch baudrate to %d bps and press ENTER ...\n",
 			cdev->baudrate);
@@ -113,8 +121,7 @@ static int console_baudrate_set(struct param_d *param, void *priv)
 		do {
 			c = getc();
 		} while (c != '\r' && c != '\n');
-	} else
-		cdev->setbrg(cdev, cdev->baudrate);
+	}
 
 	return 0;
 }
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-07-10 10:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 15:22 [PATCH] Force set console baudrate Alexey Galakhov
2013-07-09 17:43 ` Sascha Hauer
2013-07-09 18:57   ` Jean-Christophe PLAGNIOL-VILLARD
2013-07-09 20:09     ` Alexey Galakhov
2013-07-10  8:07       ` Jean-Christophe PLAGNIOL-VILLARD
2013-07-10  8:36         ` Alexey Galakhov
2013-07-10  9:01           ` Sascha Hauer
2013-07-10  9:36             ` Alexey Galakhov
2013-07-10 10:15             ` [PATCH 1/2] Revert "Force set console baudrate" Alexey Galakhov
2013-07-10 10:15               ` Alexey Galakhov [this message]
2013-07-10 21:28                 ` [PATCH 2/2] Force set console baudrate at enable time Sascha Hauer
2013-07-11  7:13                   ` Alexey Galakhov

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=1373451310-8131-2-git-send-email-agalakhov@gmail.com \
    --to=agalakhov@gmail.com \
    --cc=barebox@lists.infradead.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