Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Johns-Q opened this issue Aug 12, 2022 · 0 comments
Open

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

Johns-Q opened this issue Aug 12, 2022 · 0 comments

Comments

@Johns-Q
Copy link

Johns-Q commented Aug 12, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant