Skip to content

Commit

Permalink
scimitar rgb elite
Browse files Browse the repository at this point in the history
  • Loading branch information
jurkovic-nikola committed Dec 12, 2024
1 parent 8ba8f98 commit 6179fa2
Show file tree
Hide file tree
Showing 11 changed files with 1,752 additions and 36 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Open source Linux interface for iCUE LINK Hub and other Corsair AIOs, Hubs.
| IRONCLAW RGB | `1b1c` | `1b5d` | DPI Control<br />RGB Control |
| IRONCLAW RGB WIRELESS | `1b1c` | `1b4c` | DPI Control<br />RGB Control |
| NIGHTSABRE WIRELESS | `1b1c` | `1bb8` | DPI Control<br />RGB Control |
| SCIMITAR RGB ELITE | `1b1c` | `1be3` | DPI Control<br />RGB Control |
| ST100 RGB | `1b1c` | `0a34` | RGB |
| MM700 RGB | `1b1c` | `1b9b` | RGB |
| LT100 Smart Lighting Tower | `1b1c` | `0c23` | RGB |
Expand Down
4 changes: 4 additions & 0 deletions database/devices.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@
{
"productId": "1bb8",
"kernel": "hidraw*"
},
{
"productId": "1be3",
"kernel": "hidraw*"
}
]
}
Expand Down
102 changes: 72 additions & 30 deletions src/devices/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"OpenLinkHub/src/devices/nightsabreW"
"OpenLinkHub/src/devices/nightsabreWU"
"OpenLinkHub/src/devices/psuhid"
"OpenLinkHub/src/devices/scimitar"
"OpenLinkHub/src/devices/slipstream"
"OpenLinkHub/src/devices/st100"
"OpenLinkHub/src/devices/xc7"
Expand All @@ -43,34 +44,35 @@ import (
)

const (
productTypeLinkHub = 0
productTypeCC = 1
productTypeCCXT = 2
productTypeElite = 3
productTypeLNCore = 4
productTypeLnPro = 5
productTypeCPro = 6
productTypeXC7 = 7
productTypeMemory = 8
productTypeK65PM = 101
productTypeK70Core = 102
productTypeK55Core = 103
productTypeK70Pro = 104
productTypeK65Plus = 105
productTypeK65PlusW = 106
productTypeK100Air = 107
productTypeK100AirW = 108
productTypeK100 = 109
productTypeKatarPro = 201
productTypeIronClawRgb = 202
productTypeIronClawRgbW = 203
productTypeIronClawRgbWU = 204
productTypeNightsabreW = 205
productTypeNightsabreWU = 206
productTypeST100 = 401
productTypeMM700 = 402
productTypeLT100 = 403
productTypePSUHid = 501
productTypeLinkHub = 0
productTypeCC = 1
productTypeCCXT = 2
productTypeElite = 3
productTypeLNCore = 4
productTypeLnPro = 5
productTypeCPro = 6
productTypeXC7 = 7
productTypeMemory = 8
productTypeK65PM = 101
productTypeK70Core = 102
productTypeK55Core = 103
productTypeK70Pro = 104
productTypeK65Plus = 105
productTypeK65PlusW = 106
productTypeK100Air = 107
productTypeK100AirW = 108
productTypeK100 = 109
productTypeKatarPro = 201
productTypeIronClawRgb = 202
productTypeIronClawRgbW = 203
productTypeIronClawRgbWU = 204
productTypeNightsabreW = 205
productTypeNightsabreWU = 206
productTypeScimitarRgbElite = 207
productTypeST100 = 401
productTypeMM700 = 402
productTypeLT100 = 403
productTypePSUHid = 501
)

type AIOData struct {
Expand Down Expand Up @@ -101,7 +103,7 @@ var (
devices = make(map[string]*Device, 0)
products = make(map[string]Product, 0)
keyboards = []uint16{7127, 7165, 7166, 7110, 7083, 11024, 11015, 7109, 7091}
mouses = []uint16{7059, 7005, 6988, 7096}
mouses = []uint16{7059, 7005, 6988, 7096, 7139}
pads = []uint16{7067}
dongles = []uint16{7132, 7078}
)
Expand Down Expand Up @@ -280,7 +282,7 @@ func SaveMouseDPI(deviceId string, stages map[int]uint16) uint8 {
return 0
}

// SaveMouseZoneColors will save mouse DPI values
// SaveMouseZoneColors will save mouse zone colors
func SaveMouseZoneColors(deviceId string, dpi rgb.Color, zones map[int]rgb.Color) uint8 {
if device, ok := devices[deviceId]; ok {
methodName := "SaveMouseZoneColors"
Expand All @@ -303,6 +305,29 @@ func SaveMouseZoneColors(deviceId string, dpi rgb.Color, zones map[int]rgb.Color
return 0
}

// SaveMouseDpiColors will save mouse DPI colors
func SaveMouseDpiColors(deviceId string, dpi rgb.Color, zones map[int]rgb.Color) uint8 {
if device, ok := devices[deviceId]; ok {
methodName := "SaveMouseDpiColors"
method := reflect.ValueOf(GetDevice(device.Serial)).MethodByName(methodName)
if !method.IsValid() {
logger.Log(logger.Fields{"method": methodName}).Warn("Method not found or method is not supported for this device type")
return 0
} else {
var reflectArgs []reflect.Value
reflectArgs = append(reflectArgs, reflect.ValueOf(dpi))
reflectArgs = append(reflectArgs, reflect.ValueOf(zones))
results := method.Call(reflectArgs)
if len(results) > 0 {
val := results[0]
uintResult := val.Uint()
return uint8(uintResult)
}
}
}
return 0
}

// UpdateExternalHubDeviceAmount will update a device amount connected to an external-LED hub
func UpdateExternalHubDeviceAmount(deviceId string, portId, deviceType int) uint8 {
if device, ok := devices[deviceId]; ok {
Expand Down Expand Up @@ -1459,6 +1484,23 @@ func Init() {
}
}(vendorId, productId, key)
}
case 7139:
{
go func(vendorId, productId uint16, key string) {
dev := scimitar.Init(vendorId, productId, key)
if dev == nil {
return
}
devices[dev.Serial] = &Device{
ProductType: productTypeScimitarRgbElite,
Product: dev.Product,
Serial: dev.Serial,
Firmware: dev.Firmware,
Image: "icon-mouse.svg",
Instance: dev,
}
}(vendorId, productId, key)
}
case 0: // Memory
{
go func(serialId string) {
Expand Down
2 changes: 1 addition & 1 deletion src/devices/elite/elite.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ func (d *Device) setDeviceColor() {
r.RGBBrightness = rgb.GetBrightnessValueFloat(*d.DeviceProfile.BrightnessSlider)
r.RGBStartColor.Brightness = r.RGBBrightness
r.RGBEndColor.Brightness = r.RGBBrightness

r.Inverted = d.InvertRgb
switch d.Devices[k].RGB {
case "off":
Expand Down
4 changes: 2 additions & 2 deletions src/devices/nightsabreWU/nightsabreWU.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ func (d *Device) saveDeviceProfile() {
3: {
Name: "Stage 4",
Value: 1600,
PackerIndex: 3,
PackerIndex: 4,
ColorIndex: map[int][]int{
0: {13, 28, 43},
1: {14, 29, 44},
Expand All @@ -709,7 +709,7 @@ func (d *Device) saveDeviceProfile() {
4: {
Name: "Stage 5",
Value: 3200,
PackerIndex: 3,
PackerIndex: 5,
ColorIndex: map[int][]int{
0: {14, 29, 44},
},
Expand Down
Loading

0 comments on commit 6179fa2

Please sign in to comment.