Skip to content

AnnePro2 C18 ISO: AnnePro2-Tools hangs in write_ap_flag  #16

Description

@Johns-Q

I have a AnnePro 2 Version C18 ISO layout keyboard.

When i flash with my for ISO patched AnnePro-Tools, it flashs the keyboard, but hangs.

After a little search in the discord channel, it found it is in the function 'write_ap_flag'.

I tried this fix:

@@ -111,8 +119,21 @@ pub fn flash_firmware<R: std::io::Read>(
 }
 
 pub fn write_ap_flag(handle: &HidDevice, flag: u8) -> HidResult<()> {
-    let buffer: Vec<u8> = vec![L2Command::FW as u8, KeyCommand::IapWriteApFlag as u8, flag];
-    write_to_target(handle, AP2Target::McuMain, &buffer)?;
+    //let buffer: Vec<u8> = vec![L2Command::FW as u8, KeyCommand::IapWriteApFlag as u8, flag];
+    //write_to_target(handle, AP2Target::McuMain, &buffer)?;
+    let buffer: Vec<u8> = vec![
+        //                            len                     target,what,flag
+        0x00, 0x7b, 0x10, 0x31, 0x10, 0x03, 0x00, 0x00, 0x7d, 0x02, 0x50, 0x02,
+    ];
+
+    // directly use write because we shouldn't pad this command to 64 bytes
+    let lol = handle.write(&buffer);
+
+    if lol.is_err() {
+        let err = handle.check_error();
+        println!("err: {:?}", err);
+    }
+
     Ok(())
 }

I copied it from 'boot_device', I don't know if this is correct, but now it flashes without hangup.

Johns

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions