kriomant / ch57x-keyboard-tool

Utility for programming ch57x small keyboard
MIT License
437 stars 50 forks source link

v1.4.2 broken for 3x1-1 keyboard #88

Open BlinxFox opened 1 month ago

BlinxFox commented 1 month ago

Hi,

I tried to upload a keys.yaml with v1.4.2. There was no output when running ch57x-keyboard-tool. But also the keyboard mapping was not updated.

Tested with v1.2.0 which worked.

Currently running on Ubuntu 22.04.3 LTS

thelegend09 commented 2 weeks ago

Same problem, same solution, but on Windows 10 Pro 22H2.

BlinxFox commented 1 week ago

Had a quick look with Wireshark:

Running these commands:

./ch57x-keyboard-tool led 1
./ch57x-keyboard-tool led 0

I found that for the working v1.2.0 sends HID-Data as the following: 0000 03 a1 01 00 00 00 00 00 00 00 00 00 00 00 00 00

The broken v1.4.2 sends the following: 0000 aa a1 00 00 00 00 00 00 00 00 00 00 00 00 00 00

-> The broken does not send the starting 0x03.

Hacking the 0x03 in the HID-Data fixes LED for me.

diff --git a/src/keyboard/k8890.rs b/src/keyboard/k8890.rs
index 4c05b77..e6beef8 100644
--- a/src/keyboard/k8890.rs
+++ b/src/keyboard/k8890.rs
@@ -60,9 +60,9 @@ impl Keyboard for Keyboard8890 {
     }

     fn set_led(&mut self, n: u8) -> Result<()> {
-        self.send(&[0xa1, 0x01, 0, 0, 0, 0, 0, 0])?;
-        self.send(&[0xb0, 0x18, n, 0, 0, 0, 0, 0])?;
-        self.send(&[0xaa, 0xa1, 0, 0, 0, 0, 0, 0])?;
+        self.send(&[0x03, 0xa1, 0x01, 0, 0, 0, 0, 0, 0])?;
+        self.send(&[0x03, 0xb0, 0x18, n, 0, 0, 0, 0, 0])?;
+        self.send(&[0x03, 0xaa, 0xa1, 0, 0, 0, 0, 0, 0])?;
         Ok(())
     }
WayneManion commented 1 week ago

I had the same problem. I used 1.24, but it has another issue.

I have the knob set to volumeup on cw, volumedown on ccw.

The macro pad works fine initially, but any time I unplug it and plug it back in cw and ccw both trigger volumedown.

BlinxFox commented 1 week ago

cw and ccw both trigger volumedown.

Works for me. I'm not sure if you also have a broken knob...

WayneManion commented 1 week ago

I was using a Windows box with 1.2.4 yesterday. I kept getting strange results with the knob.

I installed v1.2.0 on my Arch machine. I uploaded the config and it worked fine.

The latest version does not work on my 3x1+K macro pad.