Skip to content

Commit

Permalink
rebooting by the default for all known devices/bootloaders
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossless committed Mar 10, 2024
1 parent ca6cce8 commit 8841663
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,14 @@ sinowealth-kb-tool write \

| ISP MD5 | Windows | macOS | Linux |
| -------------------------------- | -------- | -------- | ----- |
| 13df4ce2933f9654ffef80d6a3c27199 | ? | ? | ok |
| 2d169670eae0d36eae8188562c1f66e8 | ok | ? | ok |
| 3e0ebd0c440af5236d7ff8872343f85d | ok | ok | ok |
| cfc8661da8c9d7e351b36c0a763426aa | ok | fail[^1] | ok |
| 2d169670eae0d36eae8188562c1f66e8 | ok | ? | ok |
| e57490acebcaabfcff84a0ff013955d9 | ok | ? | ? |
| 13df4ce2933f9654ffef80d6a3c27199 | ? | ? | ok |

[^1]: macOS does not recognize the composite device as an HID device

### Functions

| ISP MD5 | Reboot |
| -------------------------------- | ------ |
| 3e0ebd0c440af5236d7ff8872343f85d | no |
| cfc8661da8c9d7e351b36c0a763426aa | yes |
| 2d169670eae0d36eae8188562c1f66e8 | ? |
| e57490acebcaabfcff84a0ff013955d9 | ? |
| 13df4ce2933f9654ffef80d6a3c27199 | ? |

## Prerequisites

### Linux
Expand Down
10 changes: 6 additions & 4 deletions src/isp.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{thread, time};
use std::{default, thread, time};

use log::{debug, info};
use thiserror::Error;
Expand Down Expand Up @@ -452,12 +452,14 @@ impl ISPDevice {
Ok(())
}

/// Causes the device to start running the main firmware
fn reboot(&self) -> Result<(), ISPError> {
info!("Rebooting...");
let cmd: [u8; COMMAND_LENGTH] = [REPORT_ID_CMD, CMD_REBOOT, 0, 0, 0, 0];
// explicitly ignore the result
let _ = self.request_device.send_feature_report(&cmd);

if let Err(err) = self.request_device.send_feature_report(&cmd) {
// only log failures
debug!("Reboot error: {:}", err);
}
thread::sleep(time::Duration::from_millis(2000));
Ok(())
}
Expand Down
6 changes: 1 addition & 5 deletions src/part.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub const PART_BASE_DEFAULT: Part = Part {
isp_usage: 0x0001,
isp_index: 0,

reboot: false,
reboot: true,
};

pub const PART_BASE_SH68F90: Part = Part {
Expand Down Expand Up @@ -122,28 +122,24 @@ pub const PART_ROYALKLUDGE_RK68_ISO_RETURN: Part = Part {
pub const PART_ROYALKLUDGE_RK68_BT_DUAL: Part = Part {
vendor_id: 0x258a,
product_id: 0x008b,
reboot: true,
..PART_BASE_SH68F90
};

pub const PART_ROYALKLUDGE_RK71: Part = Part {
vendor_id: 0x258a,
product_id: 0x00ea,
reboot: true,
..PART_BASE_SH68F90
};

pub const PART_ROYALKLUDGE_RK84_ISO_RETURN: Part = Part {
vendor_id: 0x258a,
product_id: 0x00f4,
reboot: true,
..PART_BASE_SH68F90
};

pub const PART_ROYALKLUDGE_RK100: Part = Part {
vendor_id: 0x258a,
product_id: 0x0056,
reboot: true,
..PART_BASE_SH68F90
};

Expand Down

0 comments on commit 8841663

Please sign in to comment.