Skip to content

Commit

Permalink
bulk:
Browse files Browse the repository at this point in the history
- scimitar rgb elite wireless (wireless)
- scimitar side buttons
  • Loading branch information
jurkovic-nikola committed Dec 13, 2024
1 parent 34e343a commit 09bd841
Show file tree
Hide file tree
Showing 16 changed files with 1,947 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Open source Linux interface for iCUE LINK Hub and other Corsair AIOs, Hubs.
| VENGEANCE RGB | `1b1c` | DDR5 | |
| DOMINATOR PLATINUM RGB | `1b1c` | DDR5 | |
| DOMINATOR TITANIUM RGB | `1b1c` | DDR5 | |
| Slipstream Wireless | `1b1c` | `1bdc`<br />`1ba6` | K100 AIR RGB<br />IRONCLAW RGB WIRELESS<br />NIGHTSABRE WIRELESS |
| Slipstream Wireless | `1b1c` | `1bdc`<br />`1ba6` | K100 AIR RGB<br />IRONCLAW RGB WIRELESS<br />NIGHTSABRE WIRELESS<br />SCIMITAR RGB ELITE WIRELESS |
| K55 CORE RGB | `1b1c` | `1bfe` | |
| K65 PRO MINI | `1b1c` | `1bd7` | |
| K70 CORE RGB | `1b1c` | `1bfd` | |
Expand Down
6 changes: 3 additions & 3 deletions database/devices.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
},
{
"productId": "1bdc",
"kernel": "hidraw*"
"kernel": ""
},
{
"productId": "0a34",
Expand Down Expand Up @@ -202,11 +202,11 @@
},
{
"productId": "1be3",
"kernel": "hidraw*"
"kernel": ""
},
{
"productId": "1bdb",
"kernel": "hidraw*"
"kernel": ""
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion device-permissions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ vendor_id=$(echo "$ids" | cut -d':' -f1)
device_id=$(echo "$ids" | cut -d':' -f2)

match=false
usb_array=("1bc5" "2b10" "2b07" "1bfd" "1bfe")
usb_array=("1bc5" "2b10" "2b07" "1bfd" "1bfe" "1be3" "1bdb" "1bdc")
for hex in "${usb_array[@]}"; do
if [ "$hex" == "$device_id" ]; then
match=true
Expand Down
26 changes: 6 additions & 20 deletions src/common/common.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package common

import (
"fmt"
"math"
"os"
"os/exec"
"path/filepath"
"strconv"
"time"
Expand Down Expand Up @@ -35,6 +33,12 @@ func Clamp(value, min, max int) int {
return value
}

// Atoi string to integer
func Atoi(s string) int {
val, _ := strconv.Atoi(s)
return val
}

// FClamp function restricts the value within the specified range [min, max].
func FClamp(value, min, max float64) float64 {
if value < min {
Expand Down Expand Up @@ -114,24 +118,6 @@ func IndexOfString(slice []string, target string) int {
return -1 // Return -1 if the target is not found
}

// ChangeVolume will change the volume by the given percentage.
func ChangeVolume(percent int, increases bool) error {
if increases {
return exec.Command("pactl", "set-sink-volume", "@DEFAULT_SINK@", fmt.Sprintf("+%d%%", percent)).Run()
} else {
return exec.Command("pactl", "set-sink-volume", "@DEFAULT_SINK@", fmt.Sprintf("-%d%%", percent)).Run()
}
}

// MuteSound mutes the default sink
func MuteSound(mute bool) error {
if mute {
return exec.Command("pactl", "set-sink-mute", "@DEFAULT_SINK@", "1").Run()
} else {
return exec.Command("pactl", "set-sink-mute", "@DEFAULT_SINK@", "0").Run()
}
}

func FromLinear11(bytes []byte) float32 {
val := int(bytes[2]) | int(bytes[3])<<8
fraction := val & 0x7FF
Expand Down
25 changes: 25 additions & 0 deletions src/devices/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"OpenLinkHub/src/devices/nightsabreWU"
"OpenLinkHub/src/devices/psuhid"
"OpenLinkHub/src/devices/scimitar"
"OpenLinkHub/src/devices/scimitarW"
"OpenLinkHub/src/devices/scimitarWU"
"OpenLinkHub/src/devices/slipstream"
"OpenLinkHub/src/devices/st100"
Expand Down Expand Up @@ -70,6 +71,7 @@ const (
productTypeNightsabreW = 205
productTypeNightsabreWU = 206
productTypeScimitarRgbElite = 207
productTypeScimitarRgbEliteW = 208
productTypeScimitarRgbEliteWU = 209
productTypeST100 = 401
productTypeMM700 = 402
Expand Down Expand Up @@ -131,6 +133,9 @@ func Stop() {

// GetDeviceTemplate will return device template
func GetDeviceTemplate(device interface{}) string {
if device == nil {
return "404.html"
}
methodName := "GetDeviceTemplate"
method := reflect.ValueOf(device).MethodByName(methodName)
if !method.IsValid() {
Expand Down Expand Up @@ -1274,6 +1279,26 @@ func Init() {
}
for _, value := range dev.Devices {
switch value.ProductId {
case 7131:
{
d := scimitarW.Init(
value.VendorId,
productId,
value.ProductId,
dev.GetDevice(),
value.Endpoint,
value.Serial,
)
devices[d.Serial] = &Device{
ProductType: productTypeScimitarRgbEliteW,
Product: "SCIMITAR RGB ELITE",
Serial: d.Serial,
Firmware: d.Firmware,
Image: "icon-mouse.svg",
Instance: d,
}
dev.AddPairedDevice(value.ProductId, d)
}
case 7096: // NIGHTSABRE
{
d := nightsabreW.Init(
Expand Down
2 changes: 1 addition & 1 deletion src/devices/nightsabreW/nightsabreW.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ func (d *Device) SaveMouseZoneColors(dpi rgb.Color, zoneColors map[int]rgb.Color
return 0
}

// getManufacturer will return device manufacturer
// getDebugMode will set device debug
func (d *Device) getDebugMode() {
d.Debug = config.GetConfig().Debug
}
Expand Down
32 changes: 29 additions & 3 deletions src/devices/scimitar/scimitar.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package scimitar
import (
"OpenLinkHub/src/common"
"OpenLinkHub/src/config"
"OpenLinkHub/src/inputmanager"
"OpenLinkHub/src/logger"
"OpenLinkHub/src/rgb"
"encoding/binary"
Expand Down Expand Up @@ -1397,10 +1398,35 @@ func (d *Device) controlListener() {
break
}

if data[1] == 0x02 && data[2] == 0x08 {
d.ModifyDpi()
if data[1] == 0x02 {
if data[2] == 0x08 {
d.ModifyDpi()
} else if data[2] == 0x20 {
inputmanager.InputControl(inputmanager.Number1, d.Serial) // 1
} else if data[2] == 0x40 {
inputmanager.InputControl(inputmanager.Number2, d.Serial) // 2
} else if data[2] == 0x80 {
inputmanager.InputControl(inputmanager.Number3, d.Serial) // 3
} else if data[3] == 0x01 {
inputmanager.InputControl(inputmanager.Number4, d.Serial) // 4
} else if data[3] == 0x02 {
inputmanager.InputControl(inputmanager.Number5, d.Serial) // 5
} else if data[3] == 0x04 {
inputmanager.InputControl(inputmanager.Number6, d.Serial) // 6
} else if data[3] == 0x08 {
inputmanager.InputControl(inputmanager.Number7, d.Serial) // 7
} else if data[3] == 0x10 {
inputmanager.InputControl(inputmanager.Number8, d.Serial) // 8
} else if data[3] == 0x20 {
inputmanager.InputControl(inputmanager.Number9, d.Serial) // 8
} else if data[3] == 0x40 {
inputmanager.InputControl(inputmanager.Number10, d.Serial) // 10
} else if data[3] == 0x80 {
inputmanager.InputControl(inputmanager.Number11, d.Serial) // 11
} else if data[4] == 0x01 {
inputmanager.InputControl(inputmanager.Number12, d.Serial) // 12
}
}
time.Sleep(40 * time.Millisecond)
}
}()
}
Loading

0 comments on commit 09bd841

Please sign in to comment.