Open cscheib opened 5 years ago
Forked and showed my work in #3
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!
@cscheib Thanks for letting me know that CK530 is compatible. The new release was created.
@vookimedlo awesome, thanks!
Note that although it works not all keys light up.
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)
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!