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

Commit 188e3955 authored by Jackeagle's avatar Jackeagle
Browse files

Fix erase/unlock/lock returning falsy empty string



runCommand() returns the response message text after the OKAY prefix,
which is an empty string for bare OKAY responses. The controller
checks return values for truthiness, so empty string was treated as
failure. Await the command and explicitly return true instead.

Signed-off-by: default avatarJackeagle <jackeagle102@gmail.com>
parent 59e993ac
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -128,8 +128,9 @@ export class DeviceManager {
    return false;
  }

  erase(partition) {
    return this.bootloader.runCommand(`erase:${partition}`);
  async erase(partition) {
    await this.bootloader.runCommand(`erase:${partition}`);
    return true;
  }

  format() {
@@ -138,12 +139,14 @@ export class DeviceManager {
    //        the fastboot format md_udc is not supported evne by the official fastboot program
  }

  unlock(command) {
    return this.bootloader.runCommand(command);
  async unlock(command) {
    await this.bootloader.runCommand(command);
    return true;
  }

  lock(command) {
    return this.bootloader.runCommand(command);
  async lock(command) {
    await this.bootloader.runCommand(command);
    return true;
  }

  async flash(file, partition, onProgress) {