diff --git a/sys-apps/openlinkhub/Manifest b/sys-apps/openlinkhub/Manifest index 571690a..4c5b4d3 100644 --- a/sys-apps/openlinkhub/Manifest +++ b/sys-apps/openlinkhub/Manifest @@ -1,8 +1,11 @@ +AUX openlinkhub-0.8.8-openrgb-k100air.patch 7545 BLAKE2B ffde364fab705d890e14b74dd44a0d927bdbe4ce9ab2d731ce99d0e284ec4a121c5db2edc2cf2ec05f922452cde9931dcb1e7e9c0aca2035275ed3a0b3babc3a SHA512 f0c0f33bb2a48fa58515bf3fbeace1a24287d58b8382339abb692eb7e79f14953ac4333607d3e448b137a3e14673ef22fbdc31697902470722db76d341f36435 +AUX openlinkhub-0.8.8-openrgb-k100air.patch.part1 6641 BLAKE2B fd77f6a6964a67f9885ee02f2b1ecb1b4753573e7477ead1fd308cd4d7734514ccc4f57aa7201cc2c55f70e897eac6e0bd602c71f5fef902b3a2efd096dc5d24 SHA512 7888766068383346322e3e45fcf2d85c024511837d331832091c6154d0de69e81f4b70c2316abf7f2aa03c4dc8eb633f07f49195cda1a3978b385e176a064fa0 +AUX openlinkhub-0.8.8-openrgb-k100air.patch.part2 1018 BLAKE2B a29688f3f30050c6dfb42b6dac9a8c865e717e9d9dfe9a37ffe7850c92cd5c2d32e0293e7d9bce2c716ce179f8f6403a006914dee7b2b3ee59aa5e5eb16684be SHA512 f163d8e657d98fecc283d167163c763345175d22025ed96aac289eedc71882d7be8812bf1dcde0c731fbb2996b73546b7195c1e66a925a50ff18f0ff7d76b663 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 1552 BLAKE2B bd88d50d5191212ee61847798282aba3dede768f26ad0d4944e9ebc222edad0b2ade01f33af315d6cf89a228316c99a140ddd618ea1e1cf9175948ed113af7e4 SHA512 3a2694a102b0d271881f3c0fa5e45a690bf82eafb91ff6058b4903362dcc3905894c48ae8256038a2789521b6ed3df3ef6324b5aa12d5703093ba010a5dd1fa1 +EBUILD openlinkhub-0.8.8.ebuild 1658 BLAKE2B 4a017a0bdb7c1dbdb0783e6806da940b2fff295b3152540d676c490f587eda8e84336325efac35751a83a61cec4acdc2ab17b2787e1869433536335883f4b647 SHA512 b0b807a9c6aad760c169692e54f4efad44f0abcdd500e0b779e35992fb9f8c11a3bd02b7afa0dadd571cf4a7b36a3d379735a992d2c3429dc45640c62a839aff MISC metadata.xml 558 BLAKE2B b5a10bc1b437d1f0dc04125740e065b1821786eb9d832d44f757c031a5a7b24f4c9fe0995cbc0ab169cf46874e6c43ebf7bf2770607bc3d0290a39d61ffbc4a6 SHA512 18bb2abac8ca4923efa55f6757654979c5b37b32a9ce93a390bf5c80feee6a1fac467333b7988d4cf9b7b5b2496236b612c0d40773f8df5a3796efd5392e77f0 diff --git a/sys-apps/openlinkhub/files/openlinkhub-0.8.8-openrgb-k100air.patch b/sys-apps/openlinkhub/files/openlinkhub-0.8.8-openrgb-k100air.patch new file mode 100644 index 0000000..4d12d07 --- /dev/null +++ b/sys-apps/openlinkhub/files/openlinkhub-0.8.8-openrgb-k100air.patch @@ -0,0 +1,251 @@ +--- a/src/devices/k100airWU/k100airWU.go ++++ b/src/devices/k100airWU/k100airWU.go +@@ -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{ +@@ -253,6 +257,7 @@ + d.setDeviceColor() // Device color + d.setBrightnessLevel() // Brightness + d.backendListener() // Control listener ++ d.setupOpenRGBController() // OpenRGB Controller + d.setupClusterController() // RGB Cluster + d.setupPerformance() // Performance + d.setAutoBrightness() // Auto brightness +@@ -411,7 +416,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 +790,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 +1168,65 @@ + cluster.Get().AddDeviceController(clusterController) + } + ++// setupOpenRGBController will create RGBController object for OpenRGB Client Integration ++func (d *Device) setupOpenRGBController() { ++ 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) ++} ++ ++// 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.NotifyControllerChange(d.Serial) ++ } ++ 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 +1812,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 +2146,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 ++++ b/web/k100airW.html +@@ -148,6 +148,15 @@ + + + ++ ++ ++