File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -94,8 +94,8 @@ impl SerialTerm {
9494
9595 while handle. is_running ( ) {
9696 // 非阻塞读取键盘事件
97- if event:: poll ( Duration :: from_millis ( 10 ) ) ?
98- && let Event :: Key ( key) = event:: read ( ) ?
97+ if event:: poll ( Duration :: from_millis ( 10 ) ) . is_ok ( )
98+ && let Ok ( Event :: Key ( key) ) = event:: read ( )
9999 && key. kind == KeyEventKind :: Press
100100 {
101101 // 检测 Ctrl+A+x 退出序列
@@ -134,7 +134,7 @@ impl SerialTerm {
134134
135135 // 等待接收线程结束
136136 let _ = rx_handle. join ( ) ;
137-
137+ info ! ( "Serial terminal exited" ) ;
138138 Ok ( ( ) )
139139 }
140140
Original file line number Diff line number Diff line change @@ -170,13 +170,14 @@ impl UbootShell {
170170 pub fn cmd_without_reply ( & mut self , cmd : & str ) -> Result < ( ) > {
171171 self . tx ( ) . write_all ( cmd. as_bytes ( ) ) ?;
172172 self . tx ( ) . write_all ( "\n " . as_bytes ( ) ) ?;
173- self . tx ( ) . flush ( ) ?;
173+ // self.tx().flush()?;
174174 // self.wait_for_reply(cmd)?;
175175 // debug!("cmd ok");
176176 Ok ( ( ) )
177177 }
178178
179179 fn _cmd ( & mut self , cmd : & str ) -> Result < String > {
180+ let _ = self . read_to_end ( & mut vec ! [ ] ) ;
180181 let ok_str = "cmd-ok" ;
181182 let cmd_with_id = format ! ( "{cmd}&& echo {ok_str}" ) ;
182183 self . cmd_without_reply ( & cmd_with_id) ?;
You can’t perform that action at this time.
0 commit comments