diff options
| author | Bernard Xiong <[email protected]> | 2015-05-22 17:38:25 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2015-05-22 17:38:25 +0800 |
| commit | ac66401a25975dd4872e07df4c4f973a4934d353 (patch) | |
| tree | 8f2885fb589bc79431b7e482f4fa376fe06d644d /components | |
| parent | 2dd8b560edb3847b73d5fd80a25855e498dd286f (diff) | |
| parent | 084a8dcd0c879f772672210e3d9674624a723015 (diff) | |
Merge pull request #487 from ArdaFu/master
[finsh] Clear buffer before switching to new shell device
Diffstat (limited to 'components')
| -rw-r--r-- | components/finsh/shell.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/components/finsh/shell.c b/components/finsh/shell.c index f28e235b3f..c4708cee11 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -122,7 +122,11 @@ void finsh_set_device(const char* device_name) rt_device_close(shell->device); rt_device_set_rx_indicate(shell->device, RT_NULL); } - + + /* clear line buffer before switch to new device */ + memset(shell->line, 0, sizeof(shell->line)); + shell->line_curpos = shell->line_position = 0; + shell->device = dev; rt_device_set_rx_indicate(dev, finsh_rx_ind); } |
