vookimedlo / ck550-macos

MacOS effect control SW for a CoolMaster CK550 & CK530 Keyboard (US Layout).
MIT License
14 stars 4 forks source link

Support for other CoolerMaster CK5xx keyboards #2

Open cscheib opened 5 years ago

cscheib commented 5 years ago

These keyboards all use the same SDK, so you'd only need to listen for more USB IDs. I'm not a Swift developer, otherwise I'd submit a PR.

I cracked open the code, changed the product_id (pid) to 0x009f:

func startHIDMonitoring() -> Bool { return hid.monitorEnumeration(vid: 0x2516, pid: 0x009f, usagePage: 0xFF00, usage: 0x00) }

and was able to get my CK530 working with this... so it's definitely possible. I just don't know how to monitor more than one USB ID!

cscheib commented 5 years ago

Forked and showed my work in #3

vookimedlo commented 5 years ago

Perfect! I will find some time to refactor the code to include your changes. The code is based on the sniffed USB communication, so I'm glad to hear that it works also for 530 series. Thanks!

vookimedlo commented 5 years ago

@cscheib Thanks for letting me know that CK530 is compatible. The new release was created.

cscheib commented 5 years ago

@vookimedlo awesome, thanks!

wenbert commented 5 years ago

Note that although it works not all keys light up.

vookimedlo commented 4 years ago

I don't have a CK530 keyboard, so I cannot do USB communication sniffs and see where those mentioned keys are encoded.

However, you can debug it without a USB sniffer on your side, by changing offsets in map below (by 3 - // R,G,B -> three bytes).

https://github.com/vookimedlo/ck550-macos/blob/master/src/CK550OffEffectCustomizationLayoutUS.swift

required init() {
        mapping[Key.escape.rawValue] = KeyData(packet: 0, offset: 0x18)
        mapping[Key.backQuote.rawValue] = KeyData(packet: 0, offset: 0x1B)
        mapping[Key.tab.rawValue] = KeyData(packet: 0, offset: 0x1E)
        mapping[Key.capslock.rawValue] = KeyData(packet: 0, offset: 0x21)
        mapping[Key.leftShift.rawValue] = KeyData(packet: 0, offset: 0x24)
        mapping[Key.leftCtrl.rawValue] = KeyData(packet: 0, offset: 0x27)
        mapping[Key.leftWin.rawValue] = KeyData(packet: 0, offset: 0x39)