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

Supporting 1189:8840 #60

Open
pferreir opened this issue Feb 24, 2024 · 45 comments
Open

Supporting 1189:8840 #60

pferreir opened this issue Feb 24, 2024 · 45 comments

Comments

@pferreir
Copy link
Contributor

I have one of those, which don't seem to work with this tool.

$ sudo RUST_LOG=debug .cargo/bin/ch57x-keyboard-tool --vendor-id 0x1189 --product-id 0x8840 upload < mapping.yaml
[...]
[2024-02-24T13:53:23Z DEBUG ch57x_keyboard_tool] Bus 001 Device 012 ID 1189:8840
[...]
[2024-02-24T13:53:23Z DEBUG ch57x_keyboard_tool::keyboard] send: [03, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00]
Error: init keyboard

Caused by:
    Invalid parameter

Any way I can figure out what is going on?

The lettering on the MCU seems to have been sanded off, unfortunately.

image

Is there anything I can do to help reverse-engineer this variant?

@kriomant
Copy link
Owner

Product ID is different. Can it be programmed with some software?
If yes, it's possible to reverse-engineer it using wireshark + usb plugin.

@pferreir
Copy link
Contributor Author

pferreir commented Feb 25, 2024 via email

@djipaul
Copy link

djipaul commented Feb 25, 2024

Hi,
Same issue here. Unable to programm it because of "Invalid Parameter" message.. Device Manger shows exactly the same Product ID than @pferreir.
(https://imgur.com/a/uPrm2RG)

Interesting because the Keyboard looks identical to that of the readme..
(https://imgur.com/a/Bxxx5mN)

Anything we could try?

@pferreir
Copy link
Contributor Author

pferreir commented Feb 25, 2024 via email

@pferreir
Copy link
Contributor Author

pferreir commented Feb 25, 2024

@djipaul could you try compiling and running this branch?

You need to run it like so:

cargo run -- --vendor-id 0x1189 --product-id 0x8840 --endpoint-address 4 --interface-number 0 upload < mapping.yaml

It does work fine for me, so that's already a win.

@djipaul
Copy link

djipaul commented Feb 26, 2024

Would be happy to test it, although I can not compil it myself. So would it be possible to give me a prebuilt version wich I could run? Thanks!

@hchastelaramis
Copy link

Hello there!
I'm stuck like you with my mac and the new product ID:

          Product ID: 0x8840
          Vendor ID: 0x1189  (Trisat Industrial Co., Ltd.)
          Version: 1.00
          Serial Number: CD70134330363135
          Speed: Up to 12 Mb/s
          Location ID: 0x02100000 / 2
          Current Available (mA): 500
          Current Required (mA): 100
          Extra Operating Current (mA): 0

I tried to run the following with the last release:

➜  ch57x-keyboard-tool-universal-apple-darwin sudo ch57x-keyboard-tool --vendor-id 0x1189 --product-id 0x8840 upload < your-config.yaml
Error: init keyboard

Caused by:
    Invalid parameter

And then I found @pferreir 's post and tried

➜  ch57x-keyboard-tool git:(master) ✗ cargo run -- --vendor-id 0x1189 --product-id 0x8840 --endpoint-address 4 --interface-number 0 upload < your-config.yaml
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/ch57x-keyboard-tool --vendor-id 0x1189 --product-id 0x8840 --endpoint-address 4 --interface-number 0 upload`
error: Found argument '--interface-number' which wasn't expected, or isn't valid in this context

Usage: ch57x-keyboard-tool <--vendor-id <VENDOR_ID>|--product-id <PRODUCT_ID>|--address <ADDRESS>|--endpoint-address <ENDPOINT_ADDRESS>> <COMMAND>

For more information try '--help'

Can't go any further as I don't want to download the shady PC tool :(

@pferreir
Copy link
Contributor Author

pferreir commented Feb 26, 2024 via email

@hchastelaramis
Copy link

That's what I did, I cloned your branch and ran this.
I forgot to mention it on my comment

@hchastelaramis
Copy link

my bad, I was on master.
Not a dev here!
Thanks it works! You are the best

@pferreir
Copy link
Contributor Author

Glad to hear! I will have to fix a few things, and then if @kriomant agrees, I will open a PR.

@djipaul
Copy link

djipaul commented Feb 26, 2024

@hchastelaramis could you explain what you have done, to compile that branch? Would be amazing.

@hchastelaramis
Copy link

@hchastelaramis could you explain what you have done, to compile that branch? Would be amazing.

Sure!
First make sure to install rustup
You need to clone @pferreir s project and move to his wip branch

git clone [email protected]:pferreir/ch57x-keyboard-tool.git
git checkout support-8840-wip

And then you can run the command directly to compile and run:

sudo cargo run -- --vendor-id 0x1189 --product-id 0x8840 --endpoint-address 4 --interface-number 0 upload < your-config.yaml

@hchastelaramis
Copy link

hchastelaramis commented Feb 26, 2024

Only problem here, but I don't know if it's related,
When the keyboard is wired, I can program my keys (I'm using it to control a googleMeet meeting) and it works fine as long as it's kept plugged
But when I unplug the controller, the keys mapping seem to be forgotten and I need to do the programming again.
I'm using the bluetooth 1 knob, 2 rows, 3 columns I bought on aliExpress.

@kriomant
Copy link
Owner

Glad to hear! I will have to fix a few things, and then if @kriomant agrees, I will open a PR.

I'm ready to incorporate support for another keyboard variation, but not the way used in branch. Too many copy-paste, no automatic keyboard detection. You may open PR and we'll polish code there.

@djipaul
Copy link

djipaul commented Feb 26, 2024

@hchastelaramis Thanks for that! Yes same thing for me, it worked until I unplug the Keyboard, than the Mapping seems to have gone. Until that is works perfectly fine. Hope that this also can be fixed.

@pferreir
Copy link
Contributor Author

@kriomant glad to do automatic detection. Not sure what you mean with "copy-paste", but I'll open the PR and we can discuss how to proceed.

@pferreir
Copy link
Contributor Author

@djipaul @hchastelaramis I tried plugging and unplugging and the settings seem to persist... maybe an issue with your hardware?

@djipaul
Copy link

djipaul commented Feb 27, 2024

Maybe @hchastelaramis can say something different, but for me the mapping is always gone after I unplug the keyboard. Tried now to flash on 2 different PCs but the problem still exists.

@damnkrat
Copy link
Contributor

damnkrat commented Feb 27, 2024

@djipaul could you try compiling and running this branch?

@pferreir tried to compile on Linux and got error

❯ cargo run -- --vendor-id 0x1189 --product-id 0x8840 --endpoint-address 4 --interface-number 0 upload
   Compiling rustix v0.36.6
error[E0554]: `#![feature]` may not be used on the stable release channel
  --> /home/dannkunt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.36.6/src/lib.rs:99:26
   |
99 | #![cfg_attr(rustc_attrs, feature(rustc_attrs))]
   |                          ^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
   --> /home/dannkunt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.36.6/src/lib.rs:116:5
    |
116 |     feature(core_intrinsics)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
   --> /home/dannkunt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.36.6/src/lib.rs:116:13
    |
116 |     feature(core_intrinsics)
    |             ^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `rustix` (lib) due to 3 previous errors

@EagleonePrimo
Copy link

EagleonePrimo commented Mar 2, 2024

@pferreir I has similar model one with vendor-id 0x514c and product-id 0x8842 buttons is work fine (I think so, I haven't tested it in detail yet.). but on knobs It hasn't been programmed. it still be factory bind. any idea.
20240302_172447

@thomas-louvigne
Copy link
Contributor

@EagleonePrimo : i got the same, if it works, tell me !

@damnkrat
Copy link
Contributor

damnkrat commented Mar 2, 2024

@pferreir I has similar model one with vendor-id 0x514c and product-id 0x8842 buttons is work fine (I think so, I haven't tested it in detail yet.). but on knobs It hasn't been programmed. it still be factory bind. any idea.
20240302_172447

My work(redirection to another driver). It is 8442

@EagleonePrimo
Copy link

@EagleonePrimo : i got the same, if it works, tell me !

I tested everything I could. No luck It only work on first layer of key and try to rotate orientation and it completely broken.

@pferreir
Copy link
Contributor Author

pferreir commented Mar 3, 2024

@EagleonePrimo no idea. We'd need to see what is being transmitted in the wire. I set up a VM with Windows and then used wireshark to sniff USB traffic while using the "official" programming tool. It's not a hard thing to do, you could just give us a dump of the data and that would be enough to figure out what is going on.

@damnkrat
Copy link
Contributor

damnkrat commented Mar 5, 2024

@EagleonePrimo What's in your mapping.yaml. My device with same params working.

Try mine and report does it work (remove .txt)
mapping.yaml.txt

@kamaaina
Copy link

kamaaina commented Mar 6, 2024

@pferreir stumbled across your branch and it works for me with 0x8840, thanks for sharing! @kriomant thanks for starting this project, i am learning a lot from looking through your code. i have a few variants as well, so i'll be glad to help test when things get merged in

@Trobeloo
Copy link

Trobeloo commented Mar 9, 2024

@pferreir thank you with your PR I was able to use this 5×3 with 3 knobs device:
ch57x-keyboard-tool.exe --vendor-id 0x1189 --product-id 0x8840 --endpoint-address 4 --interface-number 0 upload < Mapping.yaml
image

@EagleonePrimo
Copy link

@EagleonePrimo What's in your mapping.yaml. My device with same params working.

Try mine and report does it work (remove .txt) mapping.yaml.txt

sorry for this late. but same result. it only work on first layer of config other layer still factory config.

@EagleonePrimo
Copy link

@EagleonePrimo no idea. We'd need to see what is being transmitted in the wire. I set up a VM with Windows and then used wireshark to sniff USB traffic while using the "official" programming tool. It's not a hard thing to do, you could just give us a dump of the data and that would be enough to figure out what is going on.

I want to do that. But I don't have enough time to investigate in detail. I hope to have some free time to do it.

@JamesConlan96
Copy link

Only problem here, but I don't know if it's related, When the keyboard is wired, I can program my keys (I'm using it to control a googleMeet meeting) and it works fine as long as it's kept plugged But when I unplug the controller, the keys mapping seem to be forgotten and I need to do the programming again. I'm using the bluetooth 1 knob, 2 rows, 3 columns I bought on aliExpress.

Did you manage to fix this in the end? I'm experiencing the same issue.

@snowSBA
Copy link

snowSBA commented Mar 22, 2024

@pferreir Thank you for sharing your branch! I used it for my 1189:8842 device (4x3 keys + 2 knobs) with the help of this thread and it worked for all the keys and knobs. Additionally, it was able to retain the programmed keys after I unplugged it, though I'm not sure if the fact it is actively connected via bluetooth has anything to do with that. Maybe this is something device specific.

The only issue I encountered is that I am mapping single modifier keys, intending to use them simultaneously with other keys, but that doesn't work. For example, I map key 1 to shift and key 2 to 'a'. Holding key 1 with key 2 won't give me uppercase 'A' because the up event for key 1 is forcefully triggered the moment another key is pressed (the log shows key1 down -> key1 up -> key2 down -> key2 up). I am on a mac so I ended up going back to the original tool linked in the product page by running it in Parallels, which allowed programmed keys to be used simultaneously. Wondering if anyone has the same experience and if there's a solution to that somewhere.

@REXDES
Copy link

REXDES commented Apr 2, 2024

Any follow-up on this issue? I have the 4x3 with 2 knobs keyboard, but it following the orientations in this thread doesn`t seem to work in my case. Tried in both @pferreir and @kriomant branches, but it does not seem to recognize my keyboard...
my mapping.yaml file is only 1 layer, binding F13-F24 keys to the keyboard

Here is what shows up in my terminal:

$ cargo run -- --vendor-id 0x1189 --product-id 0x8840 --endpoint-address 4 --interface-number 0 upload < mapping.yaml
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
     Running `target\debug\ch57x-keyboard-tool.exe --vendor-id 0x1189 --product-id 0x8840 --endpoint-address 4 --interface-number 0 upload`
Error: find USB device

Caused by:
    CH57x keyboard device not found. Use --vendor-id and --product-id to override settings.
error: process didn't exit successfully: `target\debug\ch57x-keyboard-tool.exe --vendor-id 0x1189 --product-id 0x8840 --endpoint-address 4 --interface-number 0 upload` (exit code: 1)

if I try to compile the code without inserting parameters, i get this:

$ ch57x-keyboard-tool upload < mapping.yaml
Error: unexpected interface parameters: InterfaceDescriptor {
    bLength: 9,
    bDescriptorType: 4,
    bInterfaceNumber: 0,
    bAlternateSetting: 0,
    bNumEndpoints: 1,
    bInterfaceClass: 3,
    bInterfaceSubClass: 1,
    bInterfaceProtocol: 1,
    iInterface: 0,
}

...Even though the keyboard exists in the USB devices index as

USB Composite Device | USB\VID_1189&PID_8890\5&2CF64626&0&9 | (Standard USB Host Controller) | OK

@kamaaina
Copy link

to all those who have reported the issue about the device losing programming when disconnected, i have a fix for that. i will incorporate that fix when i finish the reading of the configuration of the device that i'm currently working on referenced here

@kamaaina
Copy link

until code changes get refactored and merged in, you can try using this tool. https://github.com/kamaaina/macropad_tool

@simon-something
Copy link
Contributor

simon-something commented Apr 22, 2024

until code changes get refactored and merged in, you can try using this tool. https://github.com/kamaaina/macropad_tool

I added the "termination" signal you've been adding to a quick fork of this repo @kamaaina, but couldn't make my configuration persisting when unplugging.

Where did you find this signal? wireshark? Where they really 65 long (tried 64 without success neither tho)?
I will try to sniff locally too, maybe there are some different protocol co-existing

Thanks for this nice repo @kriomant , pretty cool!

@kamaaina
Copy link

@drgorillamd - did my tool work for you? what type of macropad do you have?

@simon-something
Copy link
Contributor

simon-something commented Apr 23, 2024

So it's even weirder, I'm on 1189:8840 too (so kinda relevant to this issue) and noticed:

  • after sending a new key map, an extra packet is sent by the official windows configurator (same as for k8880-based I guess), 03fdfeff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  • my remapping wasn't persisting if I was sending it myself using this crate then unplugging, buuut after using their software to wireshark, config started to stick between plug/unplugin (even without the end message) -> this is the fix for the non-persisting config I guess, remap at least once on windows, then it looks like fixed even after remapping with this tool
  • funny thing, the hid header is slightly different (but doesn't seem like it changes anything?), this byte was 0xfd for me

@kamaaina
Copy link

right, that is one of the many changes i've made in my repo as you can see it here All programming of keys should be sent with 0xfd

Therefore, I was asking if you tried compiling and using my repo to make your changes and see if they persist? It works for me and my macropads and since you have the same one, it should work for you as well.

@simon-something
Copy link
Contributor

@pferreir Thank you for sharing your branch! I used it for my 1189:8842 device (4x3 keys + 2 knobs) with the help of this thread and it worked for all the keys and knobs. Additionally, it was able to retain the programmed keys after I unplugged it, though I'm not sure if the fact it is actively connected via bluetooth has anything to do with that. Maybe this is something device specific.

The only issue I encountered is that I am mapping single modifier keys, intending to use them simultaneously with other keys, but that doesn't work. For example, I map key 1 to shift and key 2 to 'a'. Holding key 1 with key 2 won't give me uppercase 'A' because the up event for key 1 is forcefully triggered the moment another key is pressed (the log shows key1 down -> key1 up -> key2 down -> key2 up). I am on a mac so I ended up going back to the original tool linked in the product page by running it in Parallels, which allowed programmed keys to be used simultaneously. Wondering if anyone has the same experience and if there's a solution to that somewhere.

@snowSBA I fixed this in the PR #77 feel free to check it out!

@simon-something
Copy link
Contributor

right, that is one of the many changes i've made in my repo as you can see it here All programming of keys should be sent with 0xfd

Therefore, I was asking if you tried compiling and using my repo to make your changes and see if they persist? It works for me and my macropads and since you have the same one, it should work for you as well.

As mentioned, this byte didn't change anything noticeable on my side (both 0xfd and 0xfe are part of persisting config,
without issue), same as with or without the extra end-packet. Maybe something in the very first interactions between the original software and keyboard? I didn't capture these unfortunately

You've made some nice additions @kamaaina , why not opening some PR with them:)?

@kamaaina
Copy link

at first, i started to go down the PR route, but i end up making large changes that @kriomant might not agree with and i listed the bigger changes here. I shared the repo so he could pick/choose what he wants. however, it has significantly diverged from what it was so that is why i didn't open a PR

@spikerguy
Copy link

spikerguy commented Jul 1, 2024

@pferreir thank you with your PR I was able to use this 5×3 with 3 knobs device: ch57x-keyboard-tool.exe --vendor-id 0x1189 --product-id 0x8840 --endpoint-address 4 --interface-number 0 upload < Mapping.yaml image

@Trobeloo Can you please share the mapping you used?

It is failing for me when I try to upload the example one with rows and columns changed.

I have exactly the same one but it fails to process led 1 I compiled it from @pferreir support-8840-wip branch

image

UPDATE: Fixed it there was a typo it seems.
I have issue with usb-dongle connection

last row and layer 2 and 3 are not saved after switching from usb-c connection to usb-dongle connection. I see there were similar reports before.

UPDATE 2: I used @kamaaina version from macropad-tool and it worked perfectly even after power cycles and also have more features like ready current values and detailed led as per colors.

Is there a way to keep led on even when using wirelessly? I Don't think that would be possible, so I found a hack, provide power to the macropad using power bank while using it wirelessly. :D

@KingDuckZ
Copy link

KingDuckZ commented Sep 12, 2024

Just wanted to say that for me this device identifies itself as 1189:8840 Acer Communications & Multimedia USB Composite Device - it's got no LEDs, no switches or layers, only 2 knobs. The board inside the plastic does have "on/off" printed on it and some space for what looks like a layer switch, but there is nothing connected, it's cut clean all around. Program worked just fine.

@Yannicflight
Copy link

Yannicflight commented Nov 10, 2024

I have succesfully used this tool to program my Aliexpress macro keypad: https://nl.aliexpress.com/item/1005006437127027.html?spm=a2g0o.order_list.order_list_main.53.21ef79d2ai8hjG&gatewayAdapt=glo2nld

All functions work as expected, so first of all big thanks kromiant!! great work it is so much better not having to use their (probable) malware SW package. At first I didnt install the USBDK tool which seems to be neccesary.

The only thing which does not seem to work on this one is the RGB led control.
The tool returns: "Error: If you have a device which supports backlight LEDs, please let us know at #60. We'll be glad to help you reverse-engineer it."

This keyboard should have RGB and I can see the Led`s below the buttons however I never seen them on so far.
Vendor ID product ID ali keyboard.txt
Key mapping yaml.txt

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