From 099ada66992796a08d765a97bb00a418a5745423 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Sun, 4 Jan 2015 19:42:58 +0800 Subject: finsh: open the finsh device with RT_DEVICE_FLAG_STREAM --- components/finsh/shell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/finsh/shell.c b/components/finsh/shell.c index ad3b49534d..125dcec198 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -113,7 +113,8 @@ void finsh_set_device(const char* device_name) /* check whether it's a same device */ if (dev == shell->device) return; /* open this device and set the new device in finsh shell */ - if (rt_device_open(dev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX) == RT_EOK) + if (rt_device_open(dev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX |\ + RT_DEVICE_FLAG_STREAM) == RT_EOK) { if (shell->device != RT_NULL) { -- cgit v1.3.1 From 57b5c74a71a48bbd55826cff5f709a2f028fc4d7 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Sun, 4 Jan 2015 19:43:33 +0800 Subject: rt_kprintf: force the open_flag to be RT_DEVICE_FLAG_STREAM Commit a6251a439e7385f changed the serial device to check open_flag instead of flag. So we should change the rt_kprintf counterpart as well. --- src/kservice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kservice.c b/src/kservice.c index 12878e67d1..fef284e8af 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -1114,11 +1114,11 @@ void rt_kprintf(const char *fmt, ...) } else { - rt_uint16_t old_flag = _console_device->flag; + rt_uint16_t old_flag = _console_device->open_flag; - _console_device->flag |= RT_DEVICE_FLAG_STREAM; + _console_device->open_flag |= RT_DEVICE_FLAG_STREAM; rt_device_write(_console_device, 0, rt_log_buf, length); - _console_device->flag = old_flag; + _console_device->open_flag = old_flag; } #else rt_hw_console_output(rt_log_buf); -- cgit v1.3.1