Skip to content

Commit 7b0c6ac

Browse files
DaneSlatterySergioGasquezjessebraham
authored
Update download mode detection (#685)
* Update download mode detection Previously, this failed to detect download mode during this regex match in the following message. ``` ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x1 (POWERON),boot:0x0 (DOWNLOAD(USB/UART0)) waiting for download ``` `.*` only matches on any character EXCEPT line breaks, where as [\s\S]` will match on anything. * fix fmt * Update CHANGELOG.md * Update espflash/src/connection/mod.rs Co-authored-by: Sergio Gasquez Arcos <[email protected]> * Update mod.rs --------- Co-authored-by: Sergio Gasquez Arcos <[email protected]> Co-authored-by: Jesse Braham <[email protected]>
1 parent 30300c4 commit 7b0c6ac

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
- Fixed `partition-table-offset` argument to accept offsets in hexadecimal (#682)
1717
- espflash defmt log didn't display timestamp, according to [defmt doc](https://defmt.ferrous-systems.com/timestamps). (#680)
18+
- Fixed pattern matching to detect download mode over multiple lines (#685)
1819

1920
### Changed
2021

espflash/src/connection/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ impl Connection {
173173

174174
let read_slice = String::from_utf8_lossy(&buff[..read_bytes as usize]).into_owned();
175175

176-
let pattern = Regex::new(r"boot:(0x[0-9a-fA-F]+)(.*waiting for download)?").unwrap();
176+
let pattern =
177+
Regex::new(r"boot:(0x[0-9a-fA-F]+)([\s\S]*waiting for download)?").unwrap();
177178

178179
// Search for the pattern in the read data
179180
if let Some(data) = pattern.captures(&read_slice) {

0 commit comments

Comments
 (0)