Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34b6a093 authored by Daniel Jacob Chittoor's avatar Daniel Jacob Chittoor Committed by Jackeagle
Browse files

Call resetDevice() before retry after timeout

When flash times out, attempt USB device reset before retrying to
clear any stale hardware state that may be causing communication issues.
parent 74923192
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -124,6 +124,12 @@ export class Bootloader extends Device {
          WDebug.log(`Waiting ${RETRY_DELAY_MS}ms before retry...`);
          await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS));

          // Try to reset USB device to clear stale state
          if (typeof this.device.resetDevice === 'function') {
            WDebug.log("Attempting USB device reset...");
            await this.device.resetDevice();
          }

          // Check if device is still connected before retry
          if (!this.device.isConnected) {
            throw new Error(