[PATCH 2/2] Force set console baudrate at enable time
Alexey Galakhov
agalakhov at gmail.com
Wed Jul 10 06:15:10 EDT 2013
Signed-off-by: Alexey Galakhov <agalakhov at 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
More information about the barebox
mailing list