summaryrefslogtreecommitdiff
path: root/components/finsh
diff options
context:
space:
mode:
authorprife <[email protected]>2013-11-18 21:08:10 +0800
committerprife <[email protected]>2013-11-18 21:17:49 +0800
commitb79b9be19f73733e2796ab35457360fda2a13633 (patch)
tree3a5d1bffbd61abf16cebc528a3b596d6e65ebb13 /components/finsh
parenta2bd42c81a8caacaf295a40209ae92ffc4fa9f9e (diff)
finsh: fix finsh device setting
1. rt_console_get_device should be call to set shell device only when it is null, or it will make finsh_set_device useless. 2. RT_USING_CONSOLE can be disabled in bsp/rtconfig.h
Diffstat (limited to 'components/finsh')
-rw-r--r--components/finsh/shell.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/components/finsh/shell.c b/components/finsh/shell.c
index 9793108a17..fcb34878aa 100644
--- a/components/finsh/shell.c
+++ b/components/finsh/shell.c
@@ -308,11 +308,16 @@ void finsh_thread_entry(void* parameter)
rt_kprintf(FINSH_PROMPT);
/* set console device as shell device */
- shell->device = rt_console_get_device();
- if (shell->device != RT_NULL)
+ if (shell->device == RT_NULL)
{
+#ifdef RT_USING_CONSOLE
+ shell->device = rt_console_get_device();
+ RT_ASSERT(shell->device);
rt_device_open(shell->device, RT_DEVICE_OFLAG_RDWR);
rt_device_set_rx_indicate(shell->device, finsh_rx_ind);
+#else
+ RT_ASSERT(shell->device);
+#endif
}
while (1)