File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ fn main() -> Result<()> {
217217 // The remaining values are overwritten at runtime through a <configure> handshake
218218 ..Default :: default ( )
219219 } ,
220- session_done : false ,
220+ reset_on_drop : false ,
221221 } ;
222222
223223 // In case another program on the system has already consumed the HELLO packet,
@@ -261,6 +261,9 @@ fn main() -> Result<()> {
261261 args. verbose_sahara ,
262262 ) ?;
263263
264+ // If we're past Sahara, activate the Firehose reset-on-drop listener
265+ fh_dev. reset_on_drop = true ;
266+
264267 // Get any "welcome" logs
265268 firehose_read ( & mut fh_dev, firehose_parser_ack_nak) ?;
266269
@@ -377,7 +380,7 @@ fn main() -> Result<()> {
377380 } ;
378381
379382 // Finally, reset the device
380- fh_dev. session_done = true ;
383+ fh_dev. reset_on_drop = false ;
381384 firehose_reset ( & mut fh_dev, & reset_mode, 0 ) ?;
382385
383386 println ! (
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ pub trait QdlReadWrite: Read + Write {}
9696pub struct FirehoseDevice < ' a > {
9797 pub rw : & ' a mut dyn QdlReadWrite ,
9898 pub fh_cfg : FirehoseConfiguration ,
99- pub session_done : bool ,
99+ pub reset_on_drop : bool ,
100100}
101101
102102impl Read for FirehoseDevice < ' _ > {
@@ -129,7 +129,7 @@ impl Drop for FirehoseDevice<'_> {
129129 fn drop ( & mut self ) {
130130 // Avoid having the board be stuck in EDL limbo in case of errors
131131 // TODO: watch 'rawmode' and adjust accordingly
132- if ! self . session_done {
132+ if self . reset_on_drop {
133133 println ! (
134134 "Firehose {}. Resetting the board to {}, try again." ,
135135 "failed" . bright_red( ) ,
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ pub fn main() -> Result<()> {
4747 let mut fh_dev = FirehoseDevice {
4848 rw : rw_channel. as_mut ( ) ,
4949 fh_cfg : FirehoseConfiguration :: default ( ) ,
50- session_done : true ,
50+ reset_on_drop : false ,
5151 } ;
5252
5353 sahara_run (
You can’t perform that action at this time.
0 commit comments