diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-02-06 14:25:04 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-02-06 14:44:46 +0100 |
commit | 4e2fe88944220ab6c6390f4aff69ecab7a9278be (patch) | |
tree | 97bf6cafdb5290fd4ba09bf7c3dafd91daf4bf0b /common/console.c | |
parent | b1a8c1897db4285d6cfbb3cd75f3e0393ada814b (diff) | |
download | barebox-4e2fe88944220ab6c6390f4aff69ecab7a9278be.tar.gz barebox-4e2fe88944220ab6c6390f4aff69ecab7a9278be.tar.xz |
Console: Fix baudrate switching
When waiting for the user to confirm the new baudrate, wait
for '\n' and '\r' instead of only '\r'
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/console.c')
-rw-r--r-- | common/console.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/console.c b/common/console.c index 7a94f57392..de487fc140 100644 --- a/common/console.c +++ b/common/console.c @@ -85,6 +85,7 @@ static int console_baudrate_set(struct device_d *dev, struct param_d *param, { struct console_device *cdev = dev->type_data; int baudrate; + unsigned char c; baudrate = simple_strtoul(val, NULL, 10); @@ -94,7 +95,9 @@ static int console_baudrate_set(struct device_d *dev, struct param_d *param, mdelay(50); cdev->setbrg(cdev, baudrate); mdelay(50); - while (getc() != '\r'); + do { + c = getc(); + } while (c != '\r' && c != '\n'); } else cdev->setbrg(cdev, baudrate); |