Compare commits

..
5 Commits
Author SHA1 Message Date
nwiltshire d928ba9e30 patch k100 air 2026-06-18 13:06:34 -06:00
nwiltshire 6b3dac51cc patch k100 air 2026-06-18 12:52:24 -06:00
nwiltshire 1a88dee766 Fix openlinkhub manifest and add K100 Air OpenRGB patch 2026-06-18 12:50:45 -06:00
nwiltshire 33087a8560 patch k100 air 2026-06-18 12:48:20 -06:00
nwiltshire a647c19386 perms fix 2026-06-18 12:35:23 -06:00
3 changed files with 267 additions and 2 deletions
+2 -1
View File
@@ -1,8 +1,9 @@
AUX openlinkhub-0.8.8-openrgb-k100air.patch 7899 BLAKE2B 18c92f08eb1c5da5687ce5abb9b4eb52fa87ced6521a5e2d65e1586f440d1c76fb8a2666ada7148dce9375e73fd7a32065967d9477beaddea2e37a0fdf78a9f5 SHA512 e892f7c1c5c4e4c1423b38eac2879e498be27ea4b4f22406492c96ccdcf1a4f10b3e11c27806c1466b38bfbffec03d9c06a457828c4f70f03f484187734cfc1f
AUX openlinkhub.confd 176 BLAKE2B 5301872630e14a77b477f83af977863491c2c503690d35bb45fa8d32265c27db7fc9583b61ba8bfa7a2d12b02e18e82842f65c4e326a4ad4d04720ce98320b02 SHA512 632ffc6866fa5e4082b8d6d6229b923dd5a5e01ecb846a6a18c8631ac6b0815b285c7f2290353f2194c21babd5cfd53e22bb61f9daad8330b33e8c18c240366f
AUX openlinkhub.initd 743 BLAKE2B efdc6f9b2c962b386eb776de16ece53d34ccca6360d4e1c7f01ae51da4b1c5f94c26229b3141f9e60f8a991413cb575f9d805c886623c87264fa9f1e64a4ccc7 SHA512 e4d2c8830fc37ddf66b4a1e11a4a40485e589714e7bc312fd5191bd79f03a1bebdec49e8bb2bb0cf575c6e2e918f64f1c27d3c14c40bb202e5c105cc124323f0
AUX openlinkhub.service 311 BLAKE2B b6366807f0b5268b78388243c91ade1622456eebeea05f00911d3f08838fe6a5f9a2f306c6b0100849e48c51a208ca899ea4ead2cd8b0c58ad0c283ef96961ee SHA512 f6f4077f7970cff54167a613657fdc16a942732c27f60a817dc72d9584774f85e63f43713b2c9eaa9636460a98658ef1f7343c6d593b84ce7755728cf12786ba
AUX openlinkhub.tmpfiles 54 BLAKE2B b9d4baff6c69fc52affed923cc4fc09bd11a5b22bc9954c293f80006f253494c08347693d4ae4260c8b81759e9bc663bf3bdf1e3740af1c706b60b82f8c82ea5 SHA512 32f052480210de470fbe056b85b4ae6054e39fa2c20ca54c737623eb4b3883b5529c8b92f2554272b2ef6baeae15c549f126d958a3bff49bbaa1e463e3a7125f
DIST openlinkhub-0.8.8-deps.tar.xz 20985188 BLAKE2B c22b6b1d3f86a725f7a60ba7c36bb8c14a6f3fc6b89373a49d77388d7693aa9afcf82dc0fabadd739d9fa3eaad4d247673ada39879c14ad4c53c8c80a1da268e SHA512 4780a687e92464ca27db31ddb003ca9d789c7b9d2d1be9328321a8dab137951358bc4c19558c87cb92db32e1539a49ba2b5eb82ab71c6fd7a219db0a5adeca8f
DIST openlinkhub-0.8.8.tar.gz 5230346 BLAKE2B 0d06c458068c3f06071b799ec74ebfe4ad08e5602fdab9554bcf8b4358d4bab404e3db739d3b75e0c517a3632d3956532660bdfe94d679cb10406e9f9cc9ca36 SHA512 a42b35f8ada4d64a5a9df93944ed19a45b9a2a0ce6b4d17f901712e0dd0f79e00eaa9cd42bf288ba46cf49344ab1fd4bcc33413613ab373e921e2d2abe535b26
EBUILD openlinkhub-0.8.8.ebuild 1368 BLAKE2B 42f7c513b5450bd790ba9b4b30401ff9eabb038c76b8f04ca6cee91385dbcff7bf129fdbae75de5d8d87f918c7b21a520402c5d9dbf41f2fa619add3fad0feb5 SHA512 9986cf023116eea51b6cddceaff41d8cae8000f683771cd0dafd2dd66087c1a8b654a7c0b65034f3157a4ee5b89d8c8307fddda3eb04ace3d72976a1ac6db48b
EBUILD openlinkhub-0.8.8.ebuild 1606 BLAKE2B 19f0c24a0acd9a3e896272a0ea0133348ea9815a0e0c05957721a2e168730dfe8848dbeab118984b3263542f260eebb481226fc9532d8738faadc12deb945055 SHA512 bfbd8bd9bc69f7dc9fa402ad4bb3191ec7c8e9031b0693f4d2c279da36c0346459049cccfa2921ba289305a4da99866d88d1a32be740eeaa9a1b35106e59ba7d
MISC metadata.xml 558 BLAKE2B b5a10bc1b437d1f0dc04125740e065b1821786eb9d832d44f757c031a5a7b24f4c9fe0995cbc0ab169cf46874e6c43ebf7bf2770607bc3d0290a39d61ffbc4a6 SHA512 18bb2abac8ca4923efa55f6757654979c5b37b32a9ce93a390bf5c80feee6a1fac467333b7988d4cf9b7b5b2496236b612c0d40773f8df5a3796efd5392e77f0
@@ -0,0 +1,257 @@
--- a/src/devices/k100airWU/k100airWU.go 2026-06-13 21:26:01.000000000 -0600
+++ b/src/devices/k100airWU/k100airWU.go 2026-06-18 13:03:58.116016558 -0600
@@ -13,6 +13,7 @@
"OpenLinkHub/src/keyboards"
"OpenLinkHub/src/logger"
"OpenLinkHub/src/macro"
+ "OpenLinkHub/src/openrgb"
"OpenLinkHub/src/rgb"
"OpenLinkHub/src/stats"
"OpenLinkHub/src/temperatures"
@@ -57,6 +58,7 @@
AutoBrightness int
Profiles []string
RGBCluster bool
+ OpenRGBIntegration bool
DisableAltTab bool
DisableAltF4 bool
DisableShiftTab bool
@@ -73,6 +75,7 @@
Product string `json:"product"`
Serial string `json:"serial"`
Firmware string `json:"firmware"`
+ Path string
activeRgb *rgb.ActiveRGB
UserProfiles map[string]*DeviceProfile `json:"userProfiles"`
Devices map[int]string `json:"devices"`
@@ -202,6 +205,7 @@
3: "100 %",
},
Product: "K100 AIR",
+ Path: path,
LEDChannels: 137,
Layouts: keyboards.GetLayouts(keyboardKey),
KeyAssignmentTypes: map[int]string{
@@ -256,6 +260,9 @@
d.setupClusterController() // RGB Cluster
d.setupPerformance() // Performance
d.setAutoBrightness() // Auto brightness
+ if d.DeviceProfile != nil && d.DeviceProfile.OpenRGBIntegration {
+ d.setupOpenRGBController() // OpenRGB Controller
+ }
d.createDevice() // Device register
logger.Log(logger.Fields{"serial": d.Serial, "product": d.Product}).Info("Device successfully initialized")
@@ -411,7 +418,16 @@
// getKeyData will return key data for given key hash
func (d *Device) getKeyData(keyHash string) *keyboards.Key {
- for _, value := range d.DeviceProfile.Keyboards[d.DeviceProfile.Profile].Row {
+ if d.DeviceProfile == nil {
+ return nil
+ }
+
+ keyboard := d.DeviceProfile.Keyboards[d.DeviceProfile.Profile]
+ if keyboard == nil {
+ return nil
+ }
+
+ for _, value := range keyboard.Row {
for _, key := range value.Keys {
for _, hash := range key.KeyHash {
if hash == keyHash {
@@ -776,6 +792,7 @@
deviceProfile.LCDMode = d.DeviceProfile.LCDMode
deviceProfile.LCDRotation = d.DeviceProfile.LCDRotation
deviceProfile.RGBCluster = d.DeviceProfile.RGBCluster
+ deviceProfile.OpenRGBIntegration = d.DeviceProfile.OpenRGBIntegration
deviceProfile.DisableAltTab = d.DeviceProfile.DisableAltTab
deviceProfile.DisableAltF4 = d.DeviceProfile.DisableAltF4
deviceProfile.DisableShiftTab = d.DeviceProfile.DisableShiftTab
@@ -1153,11 +1170,69 @@
cluster.Get().AddDeviceController(clusterController)
}
+// setupOpenRGBController will create RGBController object for OpenRGB Client Integration
+func (d *Device) setupOpenRGBController() {
+ openrgb.RemoveDeviceControllerBySerial(d.Serial)
+
+ controller := &common.OpenRGBController{
+ Name: d.Product,
+ Vendor: "Corsair",
+ Description: "OpenLinkHub Backend Device",
+ FwVersion: d.Firmware,
+ Serial: d.Serial,
+ Location: fmt.Sprintf("HID: %s", d.Path),
+ Zones: nil,
+ Colors: make([]byte, d.LEDChannels*3),
+ ActiveMode: 0,
+ WriteColorEx: d.writeColorEx,
+ DeviceType: common.DeviceTypeKeyboard,
+ ColorMode: common.ColorModePerLed,
+ }
+
+ controller.Zones = append(controller.Zones,
+ common.OpenRGBZone{
+ Name: "Keyboard",
+ NumLEDs: uint32(d.LEDChannels),
+ ZoneType: common.ZoneTypeLinear,
+ },
+ )
+ openrgb.AddDeviceController(controller)
+ openrgb.SendToOpenRGB()
+}
+
+// ProcessSetOpenRgbIntegration will update OpenRGB integration status
+func (d *Device) ProcessSetOpenRgbIntegration(enabled bool) uint8 {
+ if d.DeviceProfile == nil {
+ return 0
+ }
+ if d.DeviceProfile.RGBCluster {
+ return 2
+ }
+
+ d.DeviceProfile.OpenRGBIntegration = enabled
+ d.saveDeviceProfile()
+ if d.activeRgb != nil {
+ d.activeRgb.Exit <- true
+ d.activeRgb = nil
+ }
+ if enabled {
+ d.setupOpenRGBController()
+ } else {
+ openrgb.RemoveDeviceControllerBySerial(d.Serial)
+ openrgb.SendToOpenRGB()
+ }
+ d.setDeviceColor()
+ return 1
+}
+
// ProcessSetRgbCluster will update OpenRGB integration status
func (d *Device) ProcessSetRgbCluster(enabled bool) uint8 {
if d.DeviceProfile == nil {
return 0
}
+ if d.DeviceProfile.OpenRGBIntegration {
+ return 2
+ }
d.DeviceProfile.RGBCluster = enabled
d.saveDeviceProfile() // Save profile
@@ -1743,6 +1818,12 @@
return
}
+ // OpenRGB
+ if d.DeviceProfile.OpenRGBIntegration {
+ logger.Log(logger.Fields{}).Info("Exiting setDeviceColor() due to OpenRGB client")
+ return
+ }
+
// RGB Cluster
if d.DeviceProfile.RGBCluster {
logger.Log(logger.Fields{}).Info("Exiting setDeviceColor() due to RGB Cluster")
@@ -2071,6 +2152,85 @@
}
}
}
+
+ if d.DeviceProfile.Performance {
+ buf[6] = 255
+ buf[7] = 255
+ buf[8] = 255
+ buf[lockLedIndex] = 255
+ buf[lockLedIndex+1] = 0
+ buf[lockLedIndex+2] = 0
+ }
+
+ buffer := make([]byte, len(dataTypeSetColor)+len(buf)+headerWriteSize)
+ binary.LittleEndian.PutUint16(buffer[0:2], uint16(len(buf)))
+ copy(buffer[headerWriteSize:headerWriteSize+len(dataTypeSetColor)], dataTypeSetColor)
+ copy(buffer[headerWriteSize+len(dataTypeSetColor):], buf)
+
+ chunks := common.ProcessMultiChunkPacket(buffer, maxBufferSizePerRequest)
+ for i, chunk := range chunks {
+ if i == 0 {
+ _, err := d.transfer(cmdWriteColor, chunk)
+ if err != nil {
+ logger.Log(logger.Fields{"error": err, "serial": d.Serial}).Error("Unable to write to color endpoint")
+ }
+ } else {
+ _, err := d.transfer(dataTypeSubColor, chunk)
+ if err != nil {
+ logger.Log(logger.Fields{"error": err, "serial": d.Serial}).Error("Unable to write to color endpoint")
+ }
+ }
+ }
+}
+
+// writeColorEx will write data to the device from OpenRGB client
+func (d *Device) writeColorEx(data []byte, _ int) {
+ if d.DeviceProfile == nil || !d.DeviceProfile.OpenRGBIntegration {
+ return
+ }
+
+ if d.Exit {
+ return
+ }
+
+ d.writeOpenRGBColors(data)
+}
+
+// writeOpenRGBColors maps sequential OpenRGB LED data onto the keyboard packet
+func (d *Device) writeOpenRGBColors(data []byte) {
+ d.deviceLock.Lock()
+ defer d.deviceLock.Unlock()
+
+ if d.DeviceProfile == nil {
+ return
+ }
+
+ keyboard := d.DeviceProfile.Keyboards[d.DeviceProfile.Profile]
+ if keyboard == nil {
+ return
+ }
+
+ var buf = make([]byte, colorPacketLength)
+ led := 0
+
+ for _, rows := range keyboard.Row {
+ for _, key := range rows.Keys {
+ if key.NoColor {
+ continue
+ }
+ for _, packetIndex := range key.PacketIndex {
+ base := led * 3
+ if base+2 >= len(data) {
+ led++
+ continue
+ }
+ buf[packetIndex] = data[base]
+ buf[packetIndex+1] = data[base+1]
+ buf[packetIndex+2] = data[base+2]
+ led++
+ }
+ }
+ }
if d.DeviceProfile.Performance {
buf[6] = 255
--- a/web/k100airW.html 2026-06-13 21:26:01.000000000 -0600
+++ b/web/k100airW.html 2026-06-18 13:03:58.116981931 -0600
@@ -148,6 +148,15 @@
<span class="toggle-track"></span>
</label>
</div>
+
+ <!-- OpenRGB -->
+ <div class="settings-row">
+ <span class="settings-label text-ellipsis">{{ .Lang "txtOpenRGB" }}</span>
+ <label class="system-toggle compact">
+ <input type="checkbox" class="toggleOpenRGB" {{ if $deviceProfile.OpenRGBIntegration }} checked {{ end }}>
+ <span class="toggle-track"></span>
+ </label>
+ </div>
{{ end }}
<!-- Auto Brightness -->
@@ -28,6 +28,8 @@ BDEPEND=">=dev-lang/go-1.25"
S="${WORKDIR}/OpenLinkHub-${PV}"
PATCHES=( "${FILESDIR}/${P}-openrgb-k100air.patch" )
src_compile() {
export CGO_CFLAGS_ALLOW='-fno-strict-overflow'
ego build -o OpenLinkHub .
@@ -48,10 +50,15 @@ src_install() {
newtmpfiles "${FILESDIR}/${PN}.tmpfiles" ${PN}.conf
keepdir /var/lib/${PN}
fowners openlinkhub:openlinkhub /var/lib/${PN}
fowners -R openlinkhub:openlinkhub /var/lib/${PN}
}
pkg_postinst() {
tmpfiles_process ${PN}.conf
udev_reload
# Ensure runtime data dirs are writable after upgrades from older ebuilds.
if [[ -d ${ROOT}/var/lib/${PN} ]]; then
chown -R openlinkhub:openlinkhub "${ROOT}/var/lib/${PN}"
fi
}