GithubHelp home page GithubHelp logo

openannepro / annepro2-tools Goto Github PK

View Code? Open in Web Editor NEW
157.0 157.0 35.0 61 KB

Firmware flashing tool for Anne Pro 2. Allows custom firmware download.

Home Page: https://ci.codetector.org/job/OpenAnnePro/job/AnnePro2-Tools/

License: GNU General Public License v2.0

Rust 100.00%
annepro2

annepro2-tools's People

Contributors

alexfacciorusso avatar brunosabenca avatar codetector1374 avatar hitsmaxft avatar jmarmstrong1207 avatar muffin4 avatar nik012003 avatar packorf avatar tech2077 avatar weirdgiraffe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

annepro2-tools's Issues

Error when flashing C15 firmware

Hi There, thanks for made an alternative Anne Pro 2 firmware.

When I try to flash the firmware on Linux Ubuntu, I got this error. It seems like the device is not connect but the OS was detected the keyboard.

./target/release/annepro2_tools annepro-qmk/annepro2_c15_default.bin 
args: ArgOpts {
    vid: 0x4d9,
    pid: 0x8008,
    base: 0x4000,
    loosy: false,
    target: "main",
    file: "annepro-qmk/annepro2_c15_default.bin",
}
HID Dev: 046d:c077 if: 0
HID Dev: 04d9:a292 if: 0
HID Dev: 04d9:a292 if: 1
HID Dev: 04d9:a292 if: 2
HID Dev: 04d9:a292 if: 3
HID Dev: 0810:0001 if: 0
thread 'main' panicked at 'No device found. (If you have the c18 revision, you need to specify -p 8009)', src/annepro2.rs:57:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Checking for device (Holtek Semiconductor)

$lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0bda:b725 Realtek Semiconductor Corp. 
Bus 001 Device 004: ID 0bda:57b5 Realtek Semiconductor Corp. 
Bus 001 Device 003: ID 046d:c077 Logitech, Inc. M105 Optical Mouse
Bus 001 Device 017: ID 04d9:a292 Holtek Semiconductor, Inc. 
Bus 001 Device 002: ID 0810:0001 Personal Communication Systems, Inc. Dual PSX Adaptor
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

[Question] Will this project fix the bluetooth problems of AP2?

I was having massive bt issues with my AP2. I didn't try for some time now.
Read in your docs you don't touch bt firmware so I suppose those problems are still present when using your software.
Is there a chance these problems will ever be fixed by this project?

Compile error on linux

Hi when I try to manually compile the program on Manjaro Linux Kernel 6.4.2-3 I get an error.

The error.

When I compile the program I get the following ouput:
"warning: dependency (hidapi) specified without providing a local path, Git repository, or version to use. This will be considered
an error in future versions
Compiling annepro2_tools v0.1.0 (My-project-path)
error[E0599]: no method named `usage` found for reference `&DeviceInfo` in the current scope
--> src/annepro2.rs:111:17
|
111 | dev.usage(),
| ^^^^^ private field, not a method

error[E0599]: no method named `usage_page` found for reference `&DeviceInfo` in the current scope
--> src/annepro2.rs:112:17
|
112 | dev.usage_page(),
| ^^^^^^^^^^ private field, not a method

For more information about this error, try rustc --explain E0599.
error: could not compile annepro2_tools (bin "annepro2_tools") due to 2 previous errors"

I found that the newer versions of hidapi does not have those methods. It has private fields instead.

The solution.

In the Cargo.toml I added a specific earlier version of hidapi. Since i could see that some of the project was 3 years old I took a 3 year old version.

Under [dependencies]
Put:
hidapi = {version = "1.2.3", default-features = false, features = ["linux-static-libusb"]}

Instead of

hidapi = {default-features = false, features = ["linux-static-libusb"]}

It now compiles.

bash: annepro2_tools command not found

Hi there, I'm trying to use AnnePro2-Tools to flash QMK but for some reason the tool is not running. It looks like it's compiled fine and I'm running it from the directory that it lives in. Is there some thing obvious I'm missing?

Thank you in advance!

~/Documents/AnnePro2-Tools-master/target/release$ ls
annepro2_c18_default.bin* annepro2_tools.d          deps/                     incremental/
annepro2_tools*           build/                    examples/
~/Documents/AnnePro2-Tools-master/target/release$ annepro2_tools annepro2_c15_default.bin
-bash: annepro2_tools: command not found

Compilation error - no method named `usage`

Compilation for ae843cd
Arch Linux
rustc 1.75.0 (82e1608df 2023-12-21)

cargo build --release

   Compiling proc-macro2 v1.0.60
   Compiling version_check v0.9.4
   Compiling unicode-ident v1.0.9
   Compiling quote v1.0.28
   Compiling libc v0.2.146
   Compiling syn v1.0.109
   Compiling unicode-width v0.1.10
   Compiling cc v1.0.79
   Compiling unicode-segmentation v1.10.1
   Compiling pkg-config v0.3.27
   Compiling strsim v0.8.0
   Compiling ansi_term v0.12.1
   Compiling bitflags v1.3.2
   Compiling vec_map v0.8.2
   Compiling lazy_static v1.4.0
   Compiling pretty-hex v0.3.0
   Compiling textwrap v0.11.0
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling heck v0.3.3
   Compiling hidapi v2.4.1
   Compiling atty v0.2.14
   Compiling clap v2.34.0
   Compiling structopt-derive v0.4.18
   Compiling structopt v0.3.26
   Compiling annepro2_tools v0.1.0 (/home/roland/AnnePro2-Tools)
error[E0599]: no method named `usage` found for reference `&DeviceInfo` in the current scope
   --> src/annepro2.rs:111:17
    |
111 |             dev.usage(),
    |                 ^^^^^ private field, not a method

error[E0599]: no method named `usage_page` found for reference `&DeviceInfo` in the current scope
   --> src/annepro2.rs:112:17
    |
112 |             dev.usage_page(),
    |                 ^^^^^^^^^^ private field, not a method

For more information about this error, try `rustc --explain E0599`.
error: could not compile `annepro2_tools` (bin "annepro2_tools") due to 2 previous errors

different vendor and product IDs

My Anne Pro 2 (norwegian keys) has these ids:

HID Dev: 3311:a297 usage #: 00 usage_page #: 0000 Some("HEXCORE\nANNEPRO2 ISO")

Had to update the constants in code to get the keyboard recognized, should probably be a flag or something.

Can't flash AP2 c18 due to OpenHidDeviceError

The program selects the correct device (HID Dev: 04d9:8009 if: 0 None) but fails to open it. What could be going wrong here?

$ lsusb | grep IAP
Bus 001 Device 012: ID 04d9:8009 Holtek Semiconductor, Inc. USB-HID IAP
$ target/release/annepro2_tools ../qmk_firmware/annepro2_c18_default.bin -i0
args: ArgOpts {
    interface: 0x0,
    base: 0x4000,
    boot: false,
    target: "main",
    file: "../qmk_firmware/annepro2_c18_default.bin",
}
HID Dev: 04d9:8009 if: 0 None
HID Dev: 1038:170e if: 0 None
HID Dev: 1038:170e if: 1 None
HID Dev: 1038:170e if: 2 None
HID Dev: 04d9:0125 if: 0 None
HID Dev: 04d9:0125 if: 1 None
HID Dev: 04d9:0125 if: 2 None
ERROR: OpenHidDeviceError
thread 'main' panicked at 'unable to open device: ()', src/annepro2.rs:66:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Build issue with hidapi

This is probably only something I've neglected to install but I can't seem to build the Tools because of the following error.

error: failed to run custom build command for `hidapi v1.2.3`

process didn't exit successfully: `~/builds/annepro2/AnnePro2-Tools/target/release/build/hidapi-27c1822486569db1/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to find libusb-1.0: "`\"pkg-config\" \"--libs\" \"--cflags\" \"libusb-1.0\"` did not exit successfully: 
exit code: 1\n--- stderr\nPackage libusb-1.0 was not found in the pkg-config search path.\nPerhaps you should add the directory containing `libusb-1.0.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'libusb-1.0\' found\n"', 
~/.cargo/registry/src/github.com-1ecc6299db9ec823/hidapi-1.2.3/build.rs:65:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...

AnnePro2 C18 ISO: AnnePro2-Tools hangs in write_ap_flag

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.