diff options
author | Alexey Galakhov <agalakhov@gmail.com> | 2013-07-10 16:15:10 +0600 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-07-10 23:25:22 +0200 |
commit | 3d85dae2be1839e23c04d0a8b93a39dea3be46b6 (patch) | |
tree | dca15ab77a302e76323dd313480258b54ef2ac73 | |
parent | 4ccf45db0a5f27b998a5dc7560bfb7a228bf5e96 (diff) | |
download | barebox-3d85dae2be1839e23c04d0a8b93a39dea3be46b6.tar.gz barebox-3d85dae2be1839e23c04d0a8b93a39dea3be46b6.tar.xz |
Force set console baudrate at enable time
Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | common/console.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/common/console.c b/common/console.c index 8a4b224740..402dcf53ec 100644 --- a/common/console.c +++ b/common/console.c @@ -79,6 +79,12 @@ static int console_std_set(struct device_d *dev, struct param_d *param, } } + 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; @@ -103,6 +109,10 @@ 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); @@ -112,8 +122,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; } |