Skip to content

Commit 92b9e8b

Browse files
authored
Merge pull request #1 from qualcomm/topic/reset_drop
topic/reset_drop
2 parents 7538a8d + e58e9f1 commit 92b9e8b

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

cli/src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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!(

qdl/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub trait QdlReadWrite: Read + Write {}
9696
pub 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

102102
impl 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(),

qramdump/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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(

0 commit comments

Comments
 (0)