ShayBox / Wooting-Profile-Switcher

Automatically switch Wooting keyboard profiles based on focused window
MIT License
58 stars 1 forks source link

[Request] Update for 60HE+ #15

Open Sparoney opened 8 months ago

Sparoney commented 8 months ago

Any chance of updating this plus the Rust SDK bindings for the 60HE+? Thanks!

ShayBox commented 8 months ago

They should both support 60he, anything brand new requires the official RGB sdk be updated first. The rust bindings build from the RGB sdk.

ShayBox commented 8 months ago

I'm also not able to update this until tauri-egui updates, this project doesn't compile. https://github.com/tauri-apps/tauri-egui/issues/18

Sparoney commented 8 months ago

The Official SDK was updated on Feb 1 for the 60HE+.

Unfortunate about tarui-egui though that's annoying.

Reason why I assume this needed an update is because the program unfortunately doesn't detect my 60HE+

ShayBox commented 8 months ago

I was able to get a new release out with 60HE+ support
https://github.com/ShayBox/Wooting-Profile-Switcher/releases

I was having issues with Visual Studio's Build Tools, and had to patch tauri-cli@2.0.0-alpha.10 with deflate, but it works. https://github.com/Shays-Forks/tauri

I found a new template that I plan on migrating this project to instead of tauri-egui and to update to the latest Tauri v2 beta. https://github.com/noxware/egui-tauri-template

Sparoney commented 8 months ago

You're a legend thank you!

Sparoney commented 8 months ago

Hey, I've installed the new update and it doesn't seem to be detecting my 60HE+ for some reason. I completely uninstalled and reinstalled, trying both the user and system versions.

In the config json file, devices is empty so the profiles indices in the program say -1. I did notice however when I open the program, my RGB on my keyboard pauses/flickers for a split second. Wootility is closed.

Do you have any idea what could be causing this?

ShayBox commented 8 months ago

Try deleting the config file, the program fetches devices from Wootility on new config creation.

Sparoney commented 8 months ago

Yeah I tried that, still doesn't work unfortunately. Does your program have logs at all?

ShayBox commented 8 months ago

If you run the portable debug build in a terminal there are visible logs, what version of Wootility are you using?

Sparoney commented 8 months ago

I ended up checking those logs, there were no errors just it saying whenever the active window changed. I am using Wootility v4.6.15 and the Analog SDK v0.7.5, both of which are the latest

My keyboard shows up as: Wooting 60HE Plus Firmware: v2.7.2

and the serial number is 26 characters long

ShayBox commented 8 months ago

Can you give me your serial number or a modified version of it, 26 characters is longer than expected

impl From<&Device> for DeviceSerial {
    fn from(device: &Device) -> Self {
        Self(format!(
            "A{:02X}B{:02}{:02}W{:02X}{}H{:05}",
            device.supplier,
            device.year,
            device.week,
            device.product,
            device.production as u8,
            device.product_id
        ))
    }
}
ShayBox commented 8 months ago

Could you send me the Serial Number Buffer line from this debug build https://gofile.io/d/j2vA8K You can change the numbers I just need to know which bytes are populated past the 15th

Example

Serial Number Buffer: [208, 218, 3, 136, 11, 2, 0, 21, 6, 3, 0, 1, 0, 162, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
ShayBox commented 8 months ago

I also need the device ID from Wootility (Ctrl + Shift + I -> Application -> Local Storage -> file:// -> persist:root

image

ShayBox commented 8 months ago

I figured out there's a new variant of the GetSerial command with the 2 parameter that includes 3 new bytes of data, try this build and see if it works, it'll have a new serial number buffer format I need if it doesn't work. https://gofile.io/d/EbUrOU

ShayBox commented 8 months ago

I believe I have everything working, can you test out this pre-release build https://github.com/ShayBox/Wooting-Profile-Switcher/releases/tag/2.3.3

Make sure to clear your config, check if it generated the same serial number as Wootility, and was able to pull your Wootility profile names into the config.

ShayBox commented 8 months ago

Okay I believe it should work https://github.com/ShayBox/Wooting-Profile-Switcher/releases/tag/2.3.3

Sparoney commented 8 months ago

Amazing it works perfectly! Thanks so much for the quick fixes as well

aminesemlalidev commented 7 months ago

Hello, with the versions 2.3.3 and 2.3.4, I'm still having the same issue: devices are empty (Wooting 60HE+) I also have a 26 digits Serial Number, (A02B2409W05T02100S02H11694), Product ID: 4896 (Not sure about that, I found it in the wootility log file, but maybe it's 11694) But thank you for proposing this feature, much appreciated <3 I really want this to work

Sparoney commented 7 months ago

FWIW, I actually think 2.3.4 has broken the 60HE+ again. I'm still on 2.3.3 and it's working fine for me. Have you deleted your config file and tried again?

ShayBox commented 7 months ago

When you fix one issue you make another, it's hard to get the reverse engineered code right without physical hardware.

I need the log from v2.3.4 with an empty config, the serial number, and device id reported by Wootility (Dev Tools: Ctrl + Shift + I -> Application -> Local Storage -> file:// -> persist:root)

aminesemlalidev commented 7 months ago

FWIW, I actually think 2.3.4 has broken the 60HE+ again. I'm still on 2.3.3 and it's working fine for me. Have you deleted your config file and tried again?

I did yes, with both versions

Sparoney commented 7 months ago

@ShayBox Hey so. I have updated Wootility to v4.6.16. This renamed the device from Wooting 60HE Plus to Wooting 60HE+ (idk if that makes a difference). Also prompted to update my keyboard firmware to 2.7.3-beta.5 (said it was better than stable) which I have done.

Sparoney commented 7 months ago

Here's the log from build 2.3.4. It actually detects my keyboard and profiles, but never writes it to the config:

Serial Buffer: [8, 2, 16, 24, 24, 4, 32, 5, 40, 1, 48, 180, 127, 56, 0, 72, 2, 80, 1, 88, 0]
Args {
    profile_index: None,
    device_serial: None,
    paused: false,
}
Config {
    auto_launch: Some(
        false,
    ),
    auto_update: Some(
        false,
    ),
    devices: {},
    loop_sleep_ms: 250,
    send_sleep_ms: 250,
    show_serial: false,
    swap_lighting: true,
    rules: [
        Rule {
            alias: "The Binding of Isaac",
            device_indices: {},
            match_app_name: None,
            match_bin_name: None,
            match_bin_path: Some(
                "C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth*",
            ),
            match_win_name: None,
        },
        Rule {
            alias: "Default Fallback",
            device_indices: {
                DeviceSerial(
                    "A02B2404W05T01100S02H16308",
                ): 0,
            },
            match_app_name: Some(
                "*",
            ),
            match_bin_name: Some(
                "*",
            ),
            match_bin_path: Some(
                "*",
            ),
            match_win_name: Some(
                "*",
            ),
        },
    ],
    ui: Ui {
        scale: 1.25,
        theme: Dark,
    },
}
Scanning Wootility for devices and profiles to save
Serial Buffer: [8, 2, 16, 24, 24, 4, 32, 5, 40, 1, 48, 180, 127, 56, 0, 72, 2, 80, 1, 88, 0]
Found Devices: [
    Device {
        model_name: "Wooting 60HE+",
        supplier: 2,
        year: 24,
        week: 4,
        product: 5,
        revision: 1,
        product_id: 16308,
        stage: H,
        variant: Some(
            2,
        ),
        pcb_design: Some(
            1,
        ),
        minor_rev: Some(
            0,
        ),
        profiles: [],
    },
]
Device ID: 91630851424T0100S02
Device Serial: A02B2404W05T01100S02H16308
Found Profiles: Profiles {
    current: Current {
        device_profile: 0,
        device_id: DeviceID(
            "91630851424102",
        ),
    },
    devices: {
        DeviceID(
            "demo",
        ): [
            Profile {
                details: Details {
                    name: "Digital Profile",
                    uuid: "~",
                },
            },
            Profile {
                details: Details {
                    name: "Analog Profile 1",
                    uuid: "~",
                },
            },
            Profile {
                details: Details {
                    name: "Analog Profile 2",
                    uuid: "~",
                },
            },
            Profile {
                details: Details {
                    name: "Analog Profile 3",
                    uuid: "~",
                },
            },
        ],
        DeviceID(
            "91630851424102",
        ): [
            Profile {
                details: Details {
                    name: "Typing Profile",
                    uuid: "~",
                },
            },
            Profile {
                details: Details {
                    name: "General Gaming",
                    uuid: "~",
                },
            },
            Profile {
                details: Details {
                    name: "League of Legends",
                    uuid: "~",
                },
            },
            Profile {
                details: Details {
                    name: "Fortnite Mixed Movement",
                    uuid: "~",
                },
            },
        ],
    },
}
Auto Launch Disabled
Serial Buffer: [8, 2, 16, 24, 24, 4, 32, 5, 40, 1, 48, 180, 127, 56, 0, 72, 2, 80, 1, 88, 0]
Sparoney commented 7 months ago

2.3.3 still works with the Wootility and firmware updates

ShayBox commented 7 months ago

I don't know how I managed to copy code from the serial number format to the device id format.

Try this version https://github.com/ShayBox/Wooting-Profile-Switcher/releases/tag/2.3.5

Sparoney commented 7 months ago

Works for me! Hopefully works for @aminesemlalidev

aminesemlalidev commented 7 months ago

For some reasons, my keyboard is detected, but it does not switch automatically, maybe my config is wrong ?

ShayBox commented 7 months ago

Try opening from a terminal to get the active window output and see if your rule matches one or more of the rulesets, and share your config.