kamaaina / macropad_tool

tool to program a macropad
43 stars 5 forks source link

15 Key 3 knobs read error #23

Closed Skitcher closed 3 months ago

Skitcher commented 4 months ago

When trying to read out my 15 key + 3 knob macropad from aliexpress (HID\VID_1189&PID_8840&REV_0100&MI_01&Col01) I get the following error:

Error: reading macropad configuration

Caused by:
    unable to guess rows/cols for 15 

Let me know if you need more info, I'm happy to perform tests with my macropad to improve the compatibility of your amazing program.

kamaaina commented 4 months ago

thank you for contacting me about this issue.

couple of questions for you since i do not have this device to test with. i have similar ones (1189:8849 and 1189:8890)

  1. i assume you ran macropad-tool read and got this error. can you please confirm?
  2. if you were to program your device (ie. macropad-tool program -c my_config.ron did you get the following message? Unable perform sanity check - device does not support reading of configuration. Programming macropad.

from a few macropads i do have, many have different microcontrollers and thus get programmed different ways. a few of mine support the reading of the configuration and a few do not. if the answer to the above two questions are yes, unfortunately there are a few conclusions we can infer.

  1. you have a device that does not support reading of configuration. would you happen to know if this device supports it?
  2. my code does not support reading data from this device - if it is supported, we could add in support for it if you are willing to help :)
Skitcher commented 4 months ago
  1. Indeed I get the error when running the command macropad-tool.exe read.
  2. When programming the macropad the only output printed to the terminal is a sequence of 15 questionmarks in boxes , which I assume is some issue with unsupported characters in the standard windows terminal. If I try to copy the terminal output to this comment it shows up as デバイスのプログラミングが完了しました.

Let me know how I can help you. I can't promise swift replies from my side, but I will try to get any required input when I've got some time to do so :)

spikerguy commented 4 months ago

@Skitcher Do you have one of these ?

image

I was able to compile and update the keys so smoothly using the documentation. It was very nice.

I would like to change @kamaaina for all his work. Read throws error indeed. I will have to bring my windows backup pc out to test if this board have read function. the chip details are scratched off. My unit is 1189:8840 with led

output when upload is successful デバイスのプログラミングが完了しました

Skitcher commented 4 months ago

@spikerguy I have the same model (although without the USB-dongle) and indeed it works great for the programming of both the keys and backlights. @kamaaina did an amazing job with this piece of software.

kamaaina commented 3 months ago

@spikerguy @Skitcher thank you guys for the testing and feedback and for the kind words. i will change the japanese text to print english, but basically it is saying your device was successfully programmed.

i would be interested to know if this model does support "reading of config" and if it does we can work together to get it implemented.

spikerguy commented 3 months ago

@spikerguy @Skitcher thank you guys for the testing and feedback and for the kind words. i will change the japanese text to print english, but basically it is saying your device was successfully programmed.

i would be interested to know if this model does support "reading of config" and if it does we can work together to get it implemented.

I checked with the vendor and they said it does have read function. Might have to check with windows app which I was able to launch from wine but could detect the device, will try again on windows and try to grab some usb pcap.

kamaaina commented 3 months ago

@spikerguy if you could get the capture, that would be a big help

spikerguy commented 3 months ago

Hey @kamaaina

Here is the file from usbcap 15-3-keypad-port3-1.txt

In this I have connected and disconnected the device 3 time and read device config 3 times from their windows app.

rename it to .pcap please

kamaaina commented 3 months ago

@spikerguy thank you for taking the time to get the capture. i have a few questions for you.

  1. file name says port 3-1, but it looking at the capture, it seems like device is on 1.4.1 (usb src), can you please confirm.
  2. could you provide how your device is setup (ie. how is your device currently programmed when you captured the data)
  3. would you be willing to test from a branch? since i don't have the device, i do not want to merge it into the main branch until we get it working. however, this could be a iterative process. my apologizes in advance
spikerguy commented 3 months ago

@spikerguy thank you for taking the time to get the capture. i have a few questions for you.

1. file name says port 3-1, but it looking at the capture, it seems like device is on 1.4.1 (usb src), can you please confirm.

2. could you provide how your device is setup (ie. how is your device currently programmed when you captured the data)

3. would you be willing to test from a branch? since i don't have the device, i do not want to merge it into the main branch until we get it working. however, this could be a iterative process. my apologizes in advance

Hello @kamaaina

  1. ignore the file name.
  2. The data was captured on windows pc connected over usb, i checked which port this device is being attached to in usbpcap monitor and then started recording and then plugged in the device and removed it 3 times and then plugged again and opened windows app and read device data 3 times. the data on the device was uploaded using macropad-tool itself. as I don't have windows pc, I only pull it our of drawer when I need to capture such data.
  3. yes I can compile from different branch and test it. I can also provide capture data from linux too.

Thanks for your effort.

kamaaina commented 3 months ago

2 - i am asking if you can provide me with the mapping.ron file that you used to program the device.

I will have to decode the HID data (hopefully it is the same as what i already do for other devices) and i want to verify what i am reading with what you already programmed

spikerguy commented 3 months ago

2 - i am asking if you can provide me with the mapping.ron file that you used to program the device.

I will have to decode the HID data (hopefully it is the same as what i already do for other devices) and i want to verify what i am reading with what you already programmed

Sure here is the mapping that is available on the device when reading on windows. mapping.ron.txt

kamaaina commented 3 months ago

could you please checkout and compile the branch called

read-config-8840

and try running macropad-tool read

spikerguy commented 3 months ago

Hey @kamaaina

[furkan@furkan-pc release]$ ./macropad-tool read
thread 'main' panicked at src/main.rs:292:46:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

here

[furkan@furkan-pc release]$ RUST_BACKTRACE=full ./macropad-tool read
thread 'main' panicked at src/main.rs:292:46:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x64e35610b0e5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5380d7966cb17a9f
   1:     0x64e35612ba93 - core::fmt::write::h6fa818808d2fec0f
   2:     0x64e35610911f - std::io::Write::write_fmt::hbfd4c6dab598cc2c
   3:     0x64e35610aef0 - std::sys_common::backtrace::print::hb21cc8c989d23e92
   4:     0x64e35610c1a5 - std::panicking::default_hook::{{closure}}::h51c1387cbe610b14
   5:     0x64e35610befd - std::panicking::default_hook::hb83d6607ca85d71e
   6:     0x64e35610c634 - std::panicking::rust_panic_with_hook::h31c39679964b4a51
   7:     0x64e35610c4db - std::panicking::begin_panic_handler::{{closure}}::hc9bfccb70659e9b8
   8:     0x64e35610b5d9 - std::sys_common::backtrace::__rust_end_short_backtrace::h075f1cf7d2316222
   9:     0x64e35610c267 - rust_begin_unwind
  10:     0x64e355f7a733 - core::panicking::panic_fmt::hd482fa9e8da4b1ed
  11:     0x64e355f7a7dc - core::panicking::panic::h5ebb97ce3fdc8cc6
  12:     0x64e355f7a6d9 - core::option::unwrap_failed::h95d864315f6c4c63
  13:     0x64e355fbb168 - macropad_tool::open_keyboard::h60f4fe74941e79f7
  14:     0x64e355fb8e37 - macropad_tool::main::h44afc36f68ad75dc
  15:     0x64e355fa6373 - std::sys_common::backtrace::__rust_begin_short_backtrace::h23b4e66c7449116b
  16:     0x64e355fa8aad - std::rt::lang_start::{{closure}}::h9e757ed525aed76c
  17:     0x64e356103c7f - std::rt::lang_start_internal::h0ae654f50e15aeea
  18:     0x64e355fbc285 - main
  19:     0x746d3a09fc88 - <unknown>
  20:     0x746d3a09fd4c - __libc_start_main
  21:     0x64e355f7ada5 - _start
kamaaina commented 3 months ago

thanks for trying. instead of doing a release build, could you just do a debug build? i pushed a new commit, please update and you can then run with:

cargo run -- read

spikerguy commented 3 months ago

@kamaaina Thanks for update

Works fine can be merged to main and then we can test it one more time while others can test on their other devices to make sure the new changes does not affect them and cause any regression.

 macropad_tool]$ cargo run -- read
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/macropad-tool read`
(
    device: (
        orientation: Normal,
        rows: 3,
        cols: 5,
        knobs: 3,
    ),
    layers: [
        (
            buttons: [
                [(delay: 0, mapping: "1"), (delay: 0, mapping: "f"), (delay: 0, mapping: "k"), (delay: 0, mapping: "alt-4"), (delay: 0, mapping: "alt-1")],
                [(delay: 0, mapping: "alt-5"), (delay: 0, mapping: "c"), (delay: 0, mapping: "h"), (delay: 0, mapping: "0"), (delay: 0, mapping: "alt-2")],
                [(delay: 0, mapping: "alt-6"), (delay: 0, mapping: "d"), (delay: 0, mapping: "a"), (delay: 0, mapping: "0"), (delay: 0, mapping: "alt-3")],
            ],
            knobs: [
                (ccw: (delay: 0, mapping: "wheeldown"), press: (delay: 0, mapping: "mute"), cw: (delay: 0, mapping: "wheelup")),
                (ccw: (delay: 0, mapping: "wheeldown"), press: (delay: 0, mapping: "mute"), cw: (delay: 0, mapping: "wheelup")),
                (ccw: (delay: 0, mapping: "wheeldown"), press: (delay: 0, mapping: "mute"), cw: (delay: 0, mapping: "wheelup")),
            ],
        ),
        (
            buttons: [
                [(delay: 0, mapping: "2"), (delay: 0, mapping: "f"), (delay: 0, mapping: "k"), (delay: 0, mapping: "space"), (delay: 0, mapping: "t")],
                [(delay: 0, mapping: "e"), (delay: 0, mapping: "c"), (delay: 0, mapping: "h"), (delay: 0, mapping: "k"), (delay: 0, mapping: "a")],
                [(delay: 0, mapping: "r"), (delay: 0, mapping: "d"), (delay: 0, mapping: "a"), (delay: 0, mapping: "m"), (delay: 0, mapping: "e")],
            ],
            knobs: [
                (ccw: (delay: 0, mapping: "h"), press: (delay: 0, mapping: "2"), cw: (delay: 0, mapping: "t")),
                (ccw: (delay: 0, mapping: "h"), press: (delay: 0, mapping: "2"), cw: (delay: 0, mapping: "t")),
                (ccw: (delay: 0, mapping: "h"), press: (delay: 0, mapping: "2"), cw: (delay: 0, mapping: "t")),
            ],
        ),
        (
            buttons: [
                [(delay: 0, mapping: "3"), (delay: 0, mapping: "f"), (delay: 0, mapping: "k"), (delay: 0, mapping: "space"), (delay: 0, mapping: "t")],
                [(delay: 0, mapping: "e"), (delay: 0, mapping: "c"), (delay: 0, mapping: "h"), (delay: 0, mapping: "k"), (delay: 0, mapping: "a")],
                [(delay: 0, mapping: "r"), (delay: 0, mapping: "d"), (delay: 0, mapping: "a"), (delay: 0, mapping: "m"), (delay: 0, mapping: "e")],
            ],
            knobs: [
                (ccw: (delay: 0, mapping: "f"), press: (delay: 0, mapping: "3"), cw: (delay: 0, mapping: "k")),
                (ccw: (delay: 0, mapping: "f"), press: (delay: 0, mapping: "3"), cw: (delay: 0, mapping: "k")),
                (ccw: (delay: 0, mapping: "f"), press: (delay: 0, mapping: "3"), cw: (delay: 0, mapping: "k")),
            ],
        ),
    ],
)
kamaaina commented 3 months ago

@spikerguy thanks for testing and for providing the captures so we could get this working. it has been merged with the main branch, so please give it another try using the main branch when you get a chance. if it still works, we should be able to close this issue.

spikerguy commented 3 months ago

Yeayyyy @kamaaina

[furkan@furkan-pc macropad_tool]$ git branch
* main
[furkan@furkan-pc macropad_tool]$ cargo run -- read
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/macropad-tool read`
(
    device: (
        orientation: Normal,
        rows: 3,
        cols: 5,
        knobs: 3,
    ),
    layers: [
        (
            buttons: [
                [(delay: 0, mapping: "1"), (delay: 0, mapping: "f"), (delay: 0, mapping: "k"), (delay: 0, mapping: "alt-4"), (delay: 0, mapping: "alt-1")],
                [(delay: 0, mapping: "alt-5"), (delay: 0, mapping: "c"), (delay: 0, mapping: "h"), (delay: 0, mapping: "0"), (delay: 0, mapping: "alt-2")],
                [(delay: 0, mapping: "alt-6"), (delay: 0, mapping: "d"), (delay: 0, mapping: "a"), (delay: 0, mapping: "0"), (delay: 0, mapping: "alt-3")],
            ],
            knobs: [
                (ccw: (delay: 0, mapping: "wheeldown"), press: (delay: 0, mapping: "mute"), cw: (delay: 0, mapping: "wheelup")),
                (ccw: (delay: 0, mapping: "wheeldown"), press: (delay: 0, mapping: "mute"), cw: (delay: 0, mapping: "wheelup")),
                (ccw: (delay: 0, mapping: "wheeldown"), press: (delay: 0, mapping: "mute"), cw: (delay: 0, mapping: "wheelup")),
            ],
        ),
        (
            buttons: [
                [(delay: 0, mapping: "2"), (delay: 0, mapping: "f"), (delay: 0, mapping: "k"), (delay: 0, mapping: "space"), (delay: 0, mapping: "t")],
                [(delay: 0, mapping: "e"), (delay: 0, mapping: "c"), (delay: 0, mapping: "h"), (delay: 0, mapping: "k"), (delay: 0, mapping: "a")],
                [(delay: 0, mapping: "r"), (delay: 0, mapping: "d"), (delay: 0, mapping: "a"), (delay: 0, mapping: "m"), (delay: 0, mapping: "e")],
            ],
            knobs: [
                (ccw: (delay: 0, mapping: "h"), press: (delay: 0, mapping: "2"), cw: (delay: 0, mapping: "t")),
                (ccw: (delay: 0, mapping: "h"), press: (delay: 0, mapping: "2"), cw: (delay: 0, mapping: "t")),
                (ccw: (delay: 0, mapping: "h"), press: (delay: 0, mapping: "2"), cw: (delay: 0, mapping: "t")),
            ],
        ),
        (
            buttons: [
                [(delay: 0, mapping: "3"), (delay: 0, mapping: "f"), (delay: 0, mapping: "k"), (delay: 0, mapping: "space"), (delay: 0, mapping: "t")],
                [(delay: 0, mapping: "e"), (delay: 0, mapping: "c"), (delay: 0, mapping: "h"), (delay: 0, mapping: "k"), (delay: 0, mapping: "a")],
                [(delay: 0, mapping: "r"), (delay: 0, mapping: "d"), (delay: 0, mapping: "a"), (delay: 0, mapping: "m"), (delay: 0, mapping: "e")],
            ],
            knobs: [
                (ccw: (delay: 0, mapping: "f"), press: (delay: 0, mapping: "3"), cw: (delay: 0, mapping: "k")),
                (ccw: (delay: 0, mapping: "f"), press: (delay: 0, mapping: "3"), cw: (delay: 0, mapping: "k")),
                (ccw: (delay: 0, mapping: "f"), press: (delay: 0, mapping: "3"), cw: (delay: 0, mapping: "k")),
            ],
        ),
    ],
)

Test successful. We can close this issue.

kamaaina commented 3 months ago

@spikerguy thank you for your help with this!