package devices // Package: devices // Author: Nikola Jurkovic // License: GPL-3.0 or later import ( "OpenLinkHub/src/appmonitor" "OpenLinkHub/src/cluster" "OpenLinkHub/src/common" "OpenLinkHub/src/config" "OpenLinkHub/src/devices/cc" "OpenLinkHub/src/devices/ccxt" "OpenLinkHub/src/devices/cduo" "OpenLinkHub/src/devices/clipperpromini60" "OpenLinkHub/src/devices/cone" "OpenLinkHub/src/devices/cpro" "OpenLinkHub/src/devices/darkcorergbproWU" "OpenLinkHub/src/devices/darkcorergbproseWU" "OpenLinkHub/src/devices/darkcorergbseWU" "OpenLinkHub/src/devices/darkcorergbsesongle" "OpenLinkHub/src/devices/darkstarWU" "OpenLinkHub/src/devices/elite" "OpenLinkHub/src/devices/galleon100sd" "OpenLinkHub/src/devices/glaivergb" "OpenLinkHub/src/devices/glaivergbpro" "OpenLinkHub/src/devices/harpoonV2WU" "OpenLinkHub/src/devices/harpoonWU" "OpenLinkHub/src/devices/harpoonrgbpro" "OpenLinkHub/src/devices/headsetdongle" "OpenLinkHub/src/devices/hs80maxdongle" "OpenLinkHub/src/devices/hs80rgb" "OpenLinkHub/src/devices/hs80rgbWU" "OpenLinkHub/src/devices/hydro" "OpenLinkHub/src/devices/ironclaw" "OpenLinkHub/src/devices/ironclawSEWU" "OpenLinkHub/src/devices/ironclawWU" "OpenLinkHub/src/devices/k100" "OpenLinkHub/src/devices/k100airWU" "OpenLinkHub/src/devices/k55" "OpenLinkHub/src/devices/k55core" "OpenLinkHub/src/devices/k55coretkl" "OpenLinkHub/src/devices/k55pro" "OpenLinkHub/src/devices/k55proXT" "OpenLinkHub/src/devices/k57rgbWU" "OpenLinkHub/src/devices/k60rgbpro" "OpenLinkHub/src/devices/k60rgbprolp" "OpenLinkHub/src/devices/k65plusWU" "OpenLinkHub/src/devices/k65plusWdongle" "OpenLinkHub/src/devices/k65pm" "OpenLinkHub/src/devices/k65rgb" "OpenLinkHub/src/devices/k65rgbRF" "OpenLinkHub/src/devices/k65rm" "OpenLinkHub/src/devices/k68rgb" "OpenLinkHub/src/devices/k70core" "OpenLinkHub/src/devices/k70coretkl" "OpenLinkHub/src/devices/k70coretklWU" "OpenLinkHub/src/devices/k70lux" "OpenLinkHub/src/devices/k70luxrgb" "OpenLinkHub/src/devices/k70max" "OpenLinkHub/src/devices/k70mk2" "OpenLinkHub/src/devices/k70pmWU" "OpenLinkHub/src/devices/k70pro" "OpenLinkHub/src/devices/k70protkl" "OpenLinkHub/src/devices/k70rgbRF" "OpenLinkHub/src/devices/k70rgbtklcs" "OpenLinkHub/src/devices/k95" "OpenLinkHub/src/devices/k95platinum" "OpenLinkHub/src/devices/k95platinumXT" "OpenLinkHub/src/devices/katarpro" "OpenLinkHub/src/devices/katarproW" "OpenLinkHub/src/devices/katarproxt" "OpenLinkHub/src/devices/lncore" "OpenLinkHub/src/devices/lnpro" "OpenLinkHub/src/devices/lsh" "OpenLinkHub/src/devices/lt100" "OpenLinkHub/src/devices/m55" "OpenLinkHub/src/devices/m55rgbpro" "OpenLinkHub/src/devices/m65prorgb" "OpenLinkHub/src/devices/m65rgbelite" "OpenLinkHub/src/devices/m65rgbultra" "OpenLinkHub/src/devices/m65rgbultraWU" "OpenLinkHub/src/devices/m75" "OpenLinkHub/src/devices/m75AirWU" "OpenLinkHub/src/devices/m75WU" "OpenLinkHub/src/devices/makr75WU" "OpenLinkHub/src/devices/memory" "OpenLinkHub/src/devices/mm700" "OpenLinkHub/src/devices/mm800" "OpenLinkHub/src/devices/motherboard" "OpenLinkHub/src/devices/nautilusLcd" "OpenLinkHub/src/devices/nexus" "OpenLinkHub/src/devices/nightsabreWU" "OpenLinkHub/src/devices/nightswordrgb" "OpenLinkHub/src/devices/nightswordv2WU" "OpenLinkHub/src/devices/platinum" "OpenLinkHub/src/devices/psudongle" "OpenLinkHub/src/devices/psuhid" "OpenLinkHub/src/devices/sabreprocs" "OpenLinkHub/src/devices/sabrergbpro" "OpenLinkHub/src/devices/sabrergbproWU" "OpenLinkHub/src/devices/sabrev2proWU" "OpenLinkHub/src/devices/sabrev2prodongle" "OpenLinkHub/src/devices/sabrev3proWU" "OpenLinkHub/src/devices/scimitar" "OpenLinkHub/src/devices/scimitarSEWU" "OpenLinkHub/src/devices/scimitarWU" "OpenLinkHub/src/devices/scimitarprorgb" "OpenLinkHub/src/devices/scimitarrgb" "OpenLinkHub/src/devices/scimitarrgbelite" "OpenLinkHub/src/devices/scufdongle" "OpenLinkHub/src/devices/scufdongleV2" "OpenLinkHub/src/devices/scufenvisionproV2WU" "OpenLinkHub/src/devices/scufenvisionproWU" "OpenLinkHub/src/devices/slipstream" "OpenLinkHub/src/devices/slipstreamV2" "OpenLinkHub/src/devices/st100" "OpenLinkHub/src/devices/strafergb" "OpenLinkHub/src/devices/strafergbmk2" "OpenLinkHub/src/devices/vanguard96" "OpenLinkHub/src/devices/vanguard96WU" "OpenLinkHub/src/devices/vanguard96pro" "OpenLinkHub/src/devices/vanguard99airWU" "OpenLinkHub/src/devices/virtuosoSEWU" "OpenLinkHub/src/devices/virtuosoWU" "OpenLinkHub/src/devices/virtuosomaxdongle" "OpenLinkHub/src/devices/virtuosorgbXTWU" "OpenLinkHub/src/devices/voidV2dongle" "OpenLinkHub/src/devices/voidelitedongle" "OpenLinkHub/src/devices/xc7" "OpenLinkHub/src/devices/xeneonedge" "OpenLinkHub/src/dispatcher" "OpenLinkHub/src/inputmanager" "OpenLinkHub/src/logger" "OpenLinkHub/src/metrics" "OpenLinkHub/src/motherboards" "OpenLinkHub/src/openrgb" "OpenLinkHub/src/rgb" "OpenLinkHub/src/smbus" "OpenLinkHub/src/usb" "OpenLinkHub/src/version" "github.com/sstallion/go-hid" "os" "path/filepath" "reflect" "slices" "strconv" "sync" ) type deviceRegister func(vid, pid uint16, serial, path string) *common.Device type deviceRegisterEx func(vid, pid uint16, serial, path string, callback func(device *common.Device)) *common.Device type AIOData struct { Rpm int16 Temperature float32 Serial string } type Device struct { ProductId uint16 Path string DevPath string Serial string } type Product struct { InterfaceId int UsagePage uint16 Name string DeviceRegister deviceRegister DeviceRegisterEx deviceRegisterEx } var ( mutex sync.Mutex cls *cluster.Device expectedPermissions = []os.FileMode{os.FileMode(0600), os.FileMode(0660)} vendorId = uint16(6940) // Corsair scufVendorId = uint16(11925) // Scuf Psu = []uint16{7198, 7203, 7199, 7173, 7174, 7175, 7176, 7181, 7180, 7207} interfaceId = 0 devices = make(map[string]*common.Device) deviceList = make(map[string]Device) legacyDevices = []uint16{3080, 3081, 3082, 3090, 3091, 3093, 7168} initWG sync.WaitGroup Dispatch dispatcher.DeviceDispatcher = CallDeviceMethod ) // Stop will stop all active devices func Stop() { // Stop all cluster operations cls.Stop() for _, device := range devices { CallDeviceMethod(device.Serial, "Stop") delete(devices, device.Serial) } err := hid.Exit() if err != nil { logger.Log(logger.Fields{"error": err}).Error("Unable to exit HID interface") } } // StopDirty will stop the device without closing the file handles. Used when device is unplugged func StopDirty(deviceId string, productId uint16) { device, ok := devices[deviceId] if !ok { device, ok = devices[strconv.Itoa(int(productId))] if !ok { return } } if config.GetConfig().EnableOpenRGBTargetServer { openrgb.RemoveDeviceControllerBySerial(device.Serial) } cluster.Get().RemoveDeviceControllerBySerial(device.Serial) res := CallDeviceMethod(device.Serial, "StopDirty") if res != nil { val := res[0] uintResult := val.Uint() if uint8(uintResult) == 2 { // USB only devices, remove them from the device list deleteDevice(device.Serial) } } } // StopDirtyDevPath will stop the device by devPath without closing the file handles. func StopDirtyDevPath(devPath string) { for _, v := range devices { if v.DevicePath == devPath { res := CallDeviceMethod(v.Serial, "StopDirty") if res != nil { val := res[0] uintResult := val.Uint() if uint8(uintResult) == 2 { deleteDevice(v.Serial) deleteDeviceLookup(v.DeviceLookup) metrics.RemoveDevice(v.Serial) } } } } } // GetSupportedDevices will return list of supported devices func GetSupportedDevices() interface{} { type product struct { ProductId uint16 Name string Enabled bool } var products []product for key, val := range deviceRegisterMap { if key > 0 { p := product{ ProductId: key, Name: val.Name, Enabled: true, } if slices.Contains(config.GetConfig().Exclude, key) { p.Enabled = false } products = append(products, p) } } return products } // GetRgbProfiles will return a list of all RGB profiles for every device func GetRgbProfiles() map[string]interface{} { profiles := make(map[string]interface{}, len(devices)) for _, device := range devices { res := CallDeviceMethod(device.Serial, "GetRgbProfiles") if res != nil { val := res[0] profiles[device.Serial] = val.Interface() } } return profiles } // ScheduleDeviceBrightness will change device brightness level based on scheduler func ScheduleDeviceBrightness(mode uint8) { for _, device := range GetDevices() { CallDeviceMethod(device.Serial, "SchedulerBrightness", mode) } } // ScheduleDeviceLcdBrightness will change LCD backlight brightness based on scheduler func ScheduleDeviceLcdBrightness(mode uint8) { for _, device := range GetDevices() { CallDeviceMethod(device.Serial, "SchedulerLcdBrightness", mode) } } // ControlDeviceRgb will disable / enable device RGB func ControlDeviceRgb(mode bool) { for _, device := range GetDevices() { CallDeviceMethod(device.Serial, "ControlDeviceRgb", mode) } } // UpdateGlobalRgbProfile will update device RGB profile func UpdateGlobalRgbProfile(profile string) uint8 { channelId := -1 for _, device := range devices { CallDeviceMethod(device.Serial, "UpdateRgbProfile", channelId, profile) } return 1 } // UpdateAllDevicesStaticColor will push a single static color to all registered devices func UpdateAllDevicesStaticColor(color rgb.Color) uint8 { channelId := -1 profile := rgb.Profile{ StartColor: color, EndColor: color, Brightness: 1.0, } for _, device := range devices { CallDeviceMethod(device.Serial, "UpdateRgbProfileData", "static", profile) CallDeviceMethod(device.Serial, "UpdateRgbProfile", channelId, "static") } return 1 } // ResetSpeedProfiles will reset the speed profile on each available device func ResetSpeedProfiles(profile string) { for _, device := range devices { if device.ProductType == common.ProductTypeLinkHub || device.ProductType == common.ProductTypeCC || device.ProductType == common.ProductTypeCCXT || device.ProductType == common.ProductTypeCPro || device.ProductType == common.ProductTypeElite || device.ProductType == common.ProductTypeHydro || device.ProductType == common.ProductTypeCorsairOne || device.ProductType == common.ProductTypePlatinum { CallDeviceMethod(device.Serial, "ResetSpeedProfiles", profile) } } } // GetDevicesLedData will return led data for all devices func GetDevicesLedData() interface{} { var leds []interface{} for _, device := range devices { res := CallDeviceMethod(device.Serial, "GetDeviceLedData") if res != nil && len(res) > 0 { val := res[0] leds = append(leds, val.Interface()) } } return leds } // GetTemperatureProbes will return a list of temperature probes func GetTemperatureProbes() interface{} { var probes []interface{} for _, device := range devices { if device.ProductType == common.ProductTypeLinkHub || device.ProductType == common.ProductTypeCC || device.ProductType == common.ProductTypeCCXT || device.ProductType == common.ProductTypeMemory || device.ProductType == common.ProductTypeCPro || device.ProductType == common.ProductTypeElite || device.ProductType == common.ProductTypeXC7 || device.ProductType == common.ProductTypeHydro || device.ProductType == common.ProductTypeCorsairOne || device.ProductType == common.ProductTypePlatinum { res := CallDeviceMethod(device.Serial, "GetTemperatureProbes") if res != nil && len(res) > 0 { val := res[0] probes = append(probes, val.Interface()) } } } return probes } // UpdateDeviceMetrics will update device metrics func UpdateDeviceMetrics() { metrics.PopulateDefault() metrics.PopulateStorage() for _, device := range devices { CallDeviceMethod(device.Serial, "UpdateDeviceMetrics") } } // deleteDevice will remove device from device list func deleteDevice(serial string) { mutex.Lock() defer mutex.Unlock() delete(devices, serial) } // deleteDeviceLookup will remove device deviceList lookup table func deleteDeviceLookup(deviceLookup string) { mutex.Lock() defer mutex.Unlock() delete(deviceList, deviceLookup) } // addDevice will add device to device list func addDevice(device *common.Device) { if device == nil { return } mutex.Lock() devices[device.Serial] = device mutex.Unlock() CallDeviceMethod(device.Serial, "SetDispatcher", Dispatch) } // CallDeviceMethod will call device method based on method name and arguments func CallDeviceMethod(deviceId string, methodName string, args ...interface{}) []reflect.Value { mutex.Lock() defer mutex.Unlock() device, ok := devices[deviceId] if !ok { logger.Log(logger.Fields{"deviceId": deviceId}).Warn("Device not found") return nil } method := reflect.ValueOf(GetDevice(device.Serial)).MethodByName(methodName) if !method.IsValid() { return nil } reflectArgs := make([]reflect.Value, len(args)) for i, a := range args { reflectArgs[i] = reflect.ValueOf(a) } return method.Call(reflectArgs) } // GetProducts will return all available products func GetProducts() map[string]Device { return deviceList } // GetDevice will return a device by device serial func GetDevice(deviceId string) interface{} { if device, ok := devices[deviceId]; ok { return device.Instance } return nil } // GetDevices will return all available devices func GetDevices() map[string]*common.Device { return devices } // GetMouse will return all available mouse devices func GetMouse() map[string]string { mutex.Lock() defer mutex.Unlock() val := make(map[string]string) for key, device := range devices { if device.DeviceType == common.DeviceTypeMouse { val[key] = device.Product } } return val } // GetDevicesEx will return all available devices with partial data func GetDevicesEx() map[string]*common.Device { out := make(map[string]*common.Device) for _, device := range devices { out[device.Serial] = &common.Device{ ProductType: 0, Product: device.Product, Serial: device.Serial, GetDevice: device.GetDevice, Hidden: device.Hidden, } } return out } // InitManual will initialize device manually when plugged in func InitManual(productId uint16, key string) { var device = Device{ ProductId: 0, Path: "", Serial: "", } enum := hid.EnumFunc(func(info *hid.DeviceInfo) error { logger.Log( logger.Fields{ "productId": info.ProductID, "interface": info.InterfaceNbr, "serial": info.SerialNbr, "device": info.ProductStr, "path": info.Path, }, ).Info("Processing device...") if val, ok := deviceRegisterMap[info.ProductID]; ok { if val.UsagePage > 0 { if info.UsagePage == val.UsagePage { interfaceId = info.InterfaceNbr } } else { interfaceId = val.InterfaceId } } if info.InterfaceNbr == interfaceId { if len(key) > 0 && info.SerialNbr != key { return nil } devPath := info.Path if config.GetConfig().CheckDevicePermission { dev, err := os.Stat(devPath) if err != nil { logger.Log(logger.Fields{"error": err}).Error("Unable to get device stat info") return nil } filePerm := dev.Mode().Perm() if !slices.Contains(expectedPermissions, filePerm) { logger.Log(logger.Fields{"productId": info.ProductID, "path": info.Path, "device": info.ProductStr}).Warn("Invalid permissions") return nil } } base := filepath.Base(info.Path) p, _ := common.GetShortUSBDevPath(base) if len(key) == 0 { key = info.SerialNbr if len(key) == 0 { key = strconv.Itoa(int(info.ProductID)) } } if interfaceId == 1 || interfaceId == 3 || interfaceId == 4 { key = info.Path } if slices.Contains(Psu, info.ProductID) { // We can have multiple PSU devices, and none of them have serial number. // Default to actual device path key = p } device = Device{ ProductId: info.ProductID, Path: info.Path, Serial: key, DevPath: p, } } return nil }) // Enumerate all Corsair devices err := hid.Enumerate(vendorId, productId, enum) if err != nil { logger.Log(logger.Fields{"error": err, "vendorId": vendorId}).Fatal("Unable to enumerate devices") } // Enumerate all Scuf devices err = hid.Enumerate(scufVendorId, productId, enum) if err != nil { logger.Log(logger.Fields{"error": err, "vendorId": scufVendorId}).Fatal("Unable to enumerate devices") } if device.ProductId > 0 && len(device.Path) > 0 { if slices.Contains(config.GetConfig().Exclude, productId) { logger.Log(logger.Fields{"productId": productId}).Warn("Product excluded via config.json") return } initializeDevice(productId, device.Serial, device.Path) } } // Init will initialize all compatible Corsair devices in your system func Init() { logger.Log(logger.Fields{ "buildVersion": version.GetBuildInfo().BuildVersion, "build": version.GetBuildInfo().Revision, }).Info("Application build") // Initialize general HID interface if err := hid.Init(); err != nil { logger.Log(logger.Fields{"error": err}).Fatal("Unable to initialize HID interface") } enum := hid.EnumFunc(func(info *hid.DeviceInfo) error { logger.Log( logger.Fields{ "productId": info.ProductID, "interface": info.InterfaceNbr, "serial": info.SerialNbr, "device": info.ProductStr, "path": info.Path, }, ).Info("Processing device...") if val, ok := deviceRegisterMap[info.ProductID]; ok { if val.UsagePage > 0 { if info.UsagePage == val.UsagePage { interfaceId = info.InterfaceNbr } } else { interfaceId = val.InterfaceId } } if info.InterfaceNbr == interfaceId { devPath := info.Path if config.GetConfig().CheckDevicePermission { dev, err := os.Stat(devPath) if err != nil { logger.Log(logger.Fields{"error": err}).Error("Unable to get device stat info") return nil } filePerm := dev.Mode().Perm() if !slices.Contains(expectedPermissions, filePerm) { logger.Log(logger.Fields{ "productId": info.ProductID, "path": info.Path, "device": info.ProductStr, "permissions": filePerm, "expectedPermissions": expectedPermissions, }).Warn("Invalid permissions") return nil } } base := filepath.Base(info.Path) p, _ := common.GetShortUSBDevPath(base) key := info.SerialNbr if len(key) == 0 { // Devices with no serial, make serial based of productId key = strconv.Itoa(int(info.ProductID)) } if interfaceId == 1 || interfaceId == 3 || interfaceId == 4 { key = info.Path } if slices.Contains(Psu, info.ProductID) { // We can have multiple PSU devices, and none of them have serial number. // Default to actual device path key = p } deviceList[key] = Device{ ProductId: info.ProductID, Path: info.Path, DevPath: p, Serial: info.SerialNbr, } } return nil }) // Enumerate all Corsair devices err := hid.Enumerate(vendorId, hid.ProductIDAny, enum) if err != nil { logger.Log(logger.Fields{"error": err, "vendorId": vendorId}).Fatal("Unable to enumerate devices") } // Enumerate all Scuf devices err = hid.Enumerate(scufVendorId, hid.ProductIDAny, enum) if err != nil { logger.Log(logger.Fields{"error": err, "vendorId": scufVendorId}).Fatal("Unable to enumerate devices") } // Memory if config.GetConfig().Memory { sm, err := smbus.GetSmBus() if err == nil { if len(sm.Path) > 0 { deviceList[sm.Path] = Device{ ProductId: 0, Path: sm.Path, } } } else { logger.Log(logger.Fields{"error": err}).Warn("No valid I2C devices found") } } // Motherboard if config.GetConfig().EnableMotherboard { mobo := motherboards.GetMotherboard() if mobo == nil || len(motherboards.GetMotherboardPath()) == 0 { logger.Log(logger.Fields{}).Warn("Unable to get motherboard") } else { devices[motherboards.GetMotherboardSerial()] = motherboard.Init() } } // Create dummy cluster object before any other object cls = cluster.Init() devices["cluster"] = &common.Device{ ProductType: common.ProductTypeCluster, Product: "Cluster", Serial: "cluster", Hidden: true, Instance: cls, } // Legacy devices res := usb.Init(legacyDevices) if res != 0 { for _, device := range usb.GetDevices() { deviceList[device.SerialNbr] = Device{ ProductId: device.ProductID, Path: device.Path, } } } // USB-HID for key, product := range deviceList { productId := product.ProductId productPath := product.Path if slices.Contains(config.GetConfig().Exclude, productId) { logger.Log(logger.Fields{"productId": productId}).Warn("Product excluded via config.json") continue } initializeDevice(productId, key, productPath) } if config.GetConfig().EnableOpenRGBTargetServer { initWG.Wait() openrgb.Init() openrgb.SendToOpenRGB() } inputmanager.SetDispatcher(Dispatch) appmonitor.SetDispatcher(Dispatch) } // deviceRegisterMap hold map of supported devices and their initialization call var deviceRegisterMap = map[uint16]Product{ 0: {0, 0, "Memory", memory.Init, nil}, // Memory 3135: {0, 0, "iCUE LINK SYSTEM HUB", lsh.Init, nil}, // iCUE Link System Hub 3122: {0, 0, "iCUE COMMANDER Core", cc.Init, nil}, // iCUE COMMANDER Core 3100: {0, 0, "iCUE COMMANDER Core", cc.Init, nil}, // iCUE COMMANDER Core 3114: {0, 0, "iCUE COMMANDER CORE XT", ccxt.Init, nil}, // iCUE COMMANDER CORE XT 3158: {0, 0, "iCUE COMMANDER DUO", cduo.Init, nil}, // iCUE COMMANDER DUO (USB) 3090: {0, 0, "H150i PLATINUM", platinum.Init, nil}, // H150i PLATINUM 3091: {0, 0, "H115i PLATINUM", platinum.Init, nil}, // H115i PLATINUM 3093: {0, 0, "H100i PLATINUM", platinum.Init, nil}, // H100i PLATINUM 3080: {0, 0, "H80i HYDRO", hydro.Init, nil}, // H80i HYDRO 3081: {0, 0, "H100i HYDRO", hydro.Init, nil}, // H100i HYDRO 3082: {0, 0, "H115i HYDRO", hydro.Init, nil}, // H115i HYDRO 3125: {0, 0, "iCUE H100i ELITE RGB", elite.Init, nil}, // iCUE H100i ELITE RGB 3126: {0, 0, "iCUE H115i ELITE RGB", elite.Init, nil}, // iCUE H115i ELITE RGB 3127: {0, 0, "iCUE H150i ELITE RGB", elite.Init, nil}, // iCUE H150i ELITE RGB 3136: {0, 0, "iCUE H100i ELITE RGB White", elite.Init, nil}, // iCUE H100i ELITE RGB White 3137: {0, 0, "iCUE H150i ELITE RGB White", elite.Init, nil}, // iCUE H150i ELITE RGB White 3104: {0, 0, "iCUE H100i RGB PRO XT", elite.Init, nil}, // iCUE H100i RGB PRO XT 3117: {0, 0, "iCUE H100i RGB PRO XT", elite.Init, nil}, // iCUE H100i RGB PRO XT 3105: {0, 0, "iCUE H115i RGB PRO XT", elite.Init, nil}, // iCUE H115i RGB PRO XT 3106: {0, 0, "iCUE H150i RGB PRO XT", elite.Init, nil}, // iCUE H150i RGB PRO XT 3092: {0, 0, "CORSAIR ONE", cone.Init, nil}, // CORSAIR ONE 3095: {0, 0, "H115i RGB PLATINUM", elite.Init, nil}, // H115i RGB PLATINUM 3096: {0, 0, "H100i RGB PLATINUM", elite.Init, nil}, // H100i RGB PLATINUM 3097: {0, 0, "H100i RGB PLATINUM SE", elite.Init, nil}, // H100i RGB PLATINUM SE 3098: {0, 0, "LIGHTING NODE CORE", lncore.Init, nil}, // Lighting Node CORE 3083: {0, 65472, "LIGHTING NODE PRO", lnpro.Init, nil}, // Lighting Node Pro 7428: {0, 0, "LIGHTING NODE PRO SPEC-OMEGA", lnpro.Init, nil}, // Lighting Node Pro bundled with SPEC-OMEGA RGB 3088: {0, 0, "COMMANDER PRO", cpro.Init, nil}, // Commander Pro 7424: {0, 0, "COMMANDER PRO 1000D", cpro.Init, nil}, // Obsidian 1000D Hub (Commander Pro) 3138: {0, 0, "XC7 ELITE LCD", xc7.Init, nil}, // XC7 ELITE LCD CPU Water Block 3159: {0, 0, "NAUTILUS LCD CAP", nautilusLcd.Init, nil}, // Nautilus LCD Cap 3157: {0, 0, "NAUTILUS LCD CAP", nautilusLcd.Init, nil}, // Nautilus LCD Cap 2612: {0, 0, "ST100", st100.Init, nil}, // ST100 LED Driver 7067: {1, 0, "MM700 RGB", mm700.Init, nil}, // MM700 RGB Gaming Mousepad 7113: {1, 0, "MM700 3XL RGB", mm700.Init, nil}, // MM700 3XL RGB Gaming Mousepad 6971: {0, 0, "MM800 RGB POLARIS", mm800.Init, nil}, // MM800 RGB POLARIS 3107: {0, 0, "LT100", lt100.Init, nil}, // LT100 Smart Lighting Tower 7198: {0, 0, "HX1000i", psuhid.Init, nil}, // HX1000i Power Supply 7203: {0, 0, "HX1200i", psuhid.Init, nil}, // HX1200i Power Supply 7199: {0, 0, "HX1500i", psuhid.Init, nil}, // HX1500i Power Supply 7173: {0, 0, "HX750i", psuhid.Init, nil}, // HX750i Power Supply 7174: {0, 0, "HX850i", psuhid.Init, nil}, // HX850i Power Supply 7175: {0, 0, "HX1000i", psuhid.Init, nil}, // HX1000i Power Supply 7176: {0, 0, "HX1200i", psuhid.Init, nil}, // HX1200i Power Supply 7181: {0, 0, "RM1000i", psuhid.Init, nil}, // RM1000i Power Supply 7180: {0, 0, "RM850i", psuhid.Init, nil}, // RM850i Power Supply 7207: {0, 0, "HX1200i", psuhid.Init, nil}, // HX1200i Power Supply 7054: {0, 0, "iCUE NEXUS", nexus.Init, nil}, // iCUE NEXUS 7127: {1, 0, "K65 PRO MINI", k65pm.Init, nil}, // K65 PRO MINI 7119: {1, 0, "K65 RGB MINI", k65rm.Init, nil}, // K65 RGB MINI 7087: {1, 0, "K65 RGB MINI", k65rm.Init, nil}, // K65 RGB MINI 7107: {1, 0, "K65 RGB MINI", k65rm.Init, nil}, // K65 RGB MINI 7094: {1, 0, "K70 PPO MINI", k70pmWU.Init, nil}, // K70 PPO MINI 7165: {1, 0, "K70 CORE RGB", k70core.Init, nil}, // K70 CORE RGB 7167: {1, 0, "K70 CORE RGB", k70core.Init, nil}, // K70 CORE RGB 11018: {1, 0, "K70 CORE RGB", k70core.Init, nil}, // K70 CORE RGB 11009: {1, 0, "K70 CORE TKL", k70coretkl.Init, nil}, // K70 CORE TKL 11010: {1, 0, "K70 CORE TKL", k70coretklWU.Init, nil}, // K70 CORE TKL WIRELESS 11028: {1, 0, "K70 PRO TKL", k70protkl.Init, nil}, // K70 PRO TKL WIRELESS 7097: {1, 0, "K70 RGB TKL CS", k70rgbtklcs.Init, nil}, // K70 RGB TKL CS 7027: {1, 0, "K70 RGB TKL", k70rgbtklcs.Init, nil}, // K70 RGB TKL 6973: {1, 0, "K55 RGB", k55.Init, nil}, // K55 RGB 7166: {1, 0, "K55 CORE RGB", k55core.Init, nil}, // K55 CORE RGB 11013: {1, 0, "K55 CORE RGB", k55core.Init, nil}, // K55 CORE RGB Gray 11040: {1, 0, "K55 CORE TKL RGB", k55coretkl.Init, nil}, // K55 CORE TKL RGB 7076: {1, 0, "K55 PRO RGB", k55pro.Init, nil}, // K55 PRO RGB 7073: {1, 0, "K55 RGB PRO XT", k55proXT.Init, nil}, // K55 RGB PRO XT 7022: {1, 0, "K57 RGB WIRELESS", k57rgbWU.Init, nil}, // K57 RGB WIRELESS 7072: {1, 0, "K60 RGB PRO", k60rgbpro.Init, nil}, // K60 RGB PRO 7085: {1, 0, "K60 RGB PRO LP", k60rgbprolp.Init, nil}, // K60 RGB PRO LP 7104: {1, 0, "K70 MAX", k70max.Init, nil}, // K70 MAX 7108: {1, 0, "K70 PRO", k70pro.Init, nil}, // K70 PRO 7110: {1, 0, "K70 PRO", k70pro.Init, nil}, // K70 PRO 7091: {1, 0, "K70 PRO", k70pro.Init, nil}, // K70 PRO 7124: {1, 0, "K70 PRO", k70pro.Init, nil}, // K70 PRO 6966: {1, 0, "K70 LUX", k70lux.Init, nil}, // K70 LUX 6963: {1, 0, "K70 LUX RGB", k70luxrgb.Init, nil}, // K70 LUX RGB 6968: {1, 0, "K70 RGB RAPIDFIRE", k70rgbRF.Init, nil}, // K70 RGB RAPIDFIRE 6985: {1, 0, "K70 RGB MK2", k70mk2.Init, nil}, // K70 RGB MK2 6997: {1, 0, "K70 RGB MK2", k70mk2.Init, nil}, // K70 RGB MK2 7019: {1, 0, "K70 RGB MK2", k70mk2.Init, nil}, // K70 RGB MK2 6935: {1, 0, "K65 RGB", k65rgb.Init, nil}, // K65 RGB 6969: {1, 0, "K65 RGB RAPIDFIRE", k65rgbRF.Init, nil}, // K65 RGB RAPIDFIRE 6984: {1, 0, "STRAFE RGB MK2", strafergbmk2.Init, nil}, // STRAFE RGB MK2 6944: {1, 0, "STRAFE RGB", strafergb.Init, nil}, // STRAFE RGB 11024: {1, 0, "K65 PLUS WIRELESS", k65plusWU.Init, nil}, // K65 PLUS WIRELESS USB 11025: {1, 0, "K65 PLUS WIRELESS", k65plusWU.Init, nil}, // K65 PLUS WIRELESS USB 11043: {1, 0, "K65 PLUS WIRELESS", k65plusWU.Init, nil}, // K65 PLUS WIRELESS USB 6929: {1, 0, "K95", k95.Init, nil}, // K95 6957: {1, 0, "K95 PLATINUM", k95platinum.Init, nil}, // K95 PLATINUM 7049: {1, 0, "K95 PLATINUM XT", k95platinumXT.Init, nil}, // K95 PLATINUM XT 6991: {1, 0, "K68 RGB", k68rgb.Init, nil}, // K68 RGB 7083: {1, 0, "K100 AIR", k100airWU.Init, nil}, // K100 AIR USB 7036: {1, 0, "K100", k100.Init, nil}, // K100 7109: {1, 0, "K100", k100.Init, nil}, // K100 7037: {1, 0, "K100", k100.Init, nil}, // K100 11012: {1, 0, "MAKR 75", makr75WU.Init, nil}, // MAKR 75 11020: {1, 0, "GALLEON 100 SD", galleon100sd.Init, nil}, // GALLEON 100 SD 11022: {2, 0, "VANGUARD 96 PRO", vanguard96pro.Init, nil}, // VANGUARD 96 PRO 11021: {2, 0, "VANGUARD 96", vanguard96.Init, nil}, // VANGUARD 96 11023: {2, 0, "VANGUARD 96 WIRELESS", vanguard96WU.Init, nil}, // VANGUARD 96 WIRELESS 11041: {2, 0, "VANGUARD 99 AIR", vanguard99airWU.Init, nil}, // VANGUARD 99 AIR 11057: {2, 0, "CLIPPER MINI PRO 60", clipperpromini60.Init, nil}, // CLIPPER MINI PRO 60 7059: {1, 0, "KATAR PRO", katarpro.Init, nil}, // KATAR PRO Gaming Mouse 7084: {1, 0, "KATAR PRO XT", katarproxt.Init, nil}, // KATAR PRO XT Gaming Mouse 7005: {1, 0, "IRONCLAW RGB", ironclaw.Init, nil}, // IRONCLAW RGB Gaming Mouse 6987: {1, 0, "DARK CORE RGB SE", darkcorergbseWU.Init, nil}, // DARK CORE RGB SE 6988: {1, 0, "IRONCLAW RGB WIRELESS", ironclawWU.Init, nil}, // IRONCLAW RGB WIRELESS Gaming Mouse 11058: {1, 0, "IRONCLAW WIRELESS SE", ironclawSEWU.Init, nil}, // IRONCLAW WIRELESS SE Gaming Mouse 7096: {1, 0, "NIGHTSABRE WIRELESS", nightsabreWU.Init, nil}, // NIGHTSABRE WIRELESS Mouse 7139: {1, 0, "SCIMITAR RGB ELITE", scimitar.Init, nil}, // SCIMITAR RGB ELITE 6974: {1, 0, "SCIMITAR PRO RGB", scimitarprorgb.Init, nil}, // SCIMITAR PRO RGB 6942: {1, 0, "SCIMITAR RGB", scimitarrgb.Init, nil}, // SCIMITAR RGB 7051: {1, 0, "SCIMITAR RGB ELITE", scimitarrgbelite.Init, nil}, // SCIMITAR RGB ELITE 7131: {1, 0, "SCIMITAR RGB ELITE WIRELESS", scimitarWU.Init, nil}, // SCIMITAR RGB ELITE WIRELESS 11042: {1, 0, "SCIMITAR ELITE WIRELESS SE", scimitarSEWU.Init, nil}, // SCIMITAR ELITE WIRELESS SE 11011: {1, 0, "M55", m55.Init, nil}, // M55 Gaming Mouse 7024: {1, 0, "M55 RGB PRO", m55rgbpro.Init, nil}, // M55 RGB PRO Gaming Mouse 7060: {1, 0, "KATAR PRO WIRELESS", katarproW.Init, nil}, // KATAR PRO Wireless Gaming Dongle 7038: {1, 0, "DARK CORE RGB PRO SE", darkcorergbproseWU.Init, nil}, // DARK CORE RGB PRO SE Gaming Mouse 7040: {1, 0, "DARK CORE RGB PRO", darkcorergbproWU.Init, nil}, // DARK CORE RGB PRO Gaming Mouse 7152: {1, 0, "M75", m75.Init, nil}, // M75 Gaming Mouse 7153: {1, 0, "M75 WIRELESS", m75WU.Init, nil}, // M75 WIRELESS Gaming Mouse 11016: {1, 0, "M75 WIRELESS", m75WU.Init, nil}, // M75 WIRELESS Gaming Mouse 7154: {1, 0, "M75 AIR WIRELESS", m75AirWU.Init, nil}, // M75 AIR WIRELESS Gaming Mouse 7070: {1, 0, "M65 RGB ULTRA", m65rgbultra.Init, nil}, // M65 RGB ULTRA Gaming Mouse 7093: {1, 0, "M65 RGB ULTRA WIRELESS", m65rgbultraWU.Init, nil}, // M65 RGB ULTRA WIRELESS Gaming Mouse 7126: {1, 0, "M65 RGB ULTRA WIRELESS", m65rgbultraWU.Init, nil}, // M65 RGB ULTRA WIRELESS Gaming Mouse 7002: {1, 0, "M65 RGB ELITE", m65rgbelite.Init, nil}, // M65 RGB ELITE Gaming Mouse 6958: {1, 0, "M65 PRO RGB", m65prorgb.Init, nil}, // M65 PRO RGB Mouse 7029: {1, 0, "HARPOON RGB PRO", harpoonrgbpro.Init, nil}, // HARPOON RGB PRO Gaming Mouse 7006: {1, 0, "HARPOON", harpoonWU.Init, nil}, // HARPOON Gaming Mouse 11054: {1, 0, "HARPOON V2", harpoonV2WU.Init, nil}, // HARPOON Gaming Mouse 7004: {1, 0, "NIGHTSWORD RGB", nightswordrgb.Init, nil}, // NIGHTSWORD RGB Gaming Mouse 7028: {1, 0, "GLAIVE RGB PRO", glaivergbpro.Init, nil}, // GLAIVE RGB PRO Gaming Mouse 6964: {1, 0, "GLAIVE RGB", glaivergb.Init, nil}, // GLAIVE RGB Gaming Mouse 7064: {1, 0, "SABRE RGB PRO WIRELESS", sabrergbproWU.Init, nil}, // SABRE RGB PRO WIRELESS Gaming Mouse 7033: {1, 0, "SABRE RGB PRO", sabrergbpro.Init, nil}, // SABRE RGB PRO 7034: {1, 0, "SABRE PRO CS", sabreprocs.Init, nil}, // SABRE PRO CS 11048: {1, 0, "SABRE V2 PRO", sabrev2proWU.Init, nil}, // SABRE V2 PRO 11049: {1, 0, "SABRE V2 PRO MG", sabrev2proWU.Init, nil}, // SABRE V2 PRO MG 11045: {1, 0, "SABRE V2 PRO CF", sabrev2proWU.Init, nil}, // SABRE V2 PRO CF 11036: {1, 0, "NIGHTSWORD V2", nightswordv2WU.Init, nil}, // NIGHTSWORD v2 WIRELESS SD 11075: {1, 0, "SABRE V3 PRO", sabrev3proWU.Init, nil}, // CORSAIR SABRE v3 PRO 7090: {1, 0, "DARKSTAR RGB WIRELESS", darkstarWU.Init, nil}, // DARKSTAR RGB WIRELESS Gaming Mouse 2658: {3, 0, "VIRTUOSO RGB WIRELESS XT", virtuosorgbXTWU.Init, nil}, // VIRTUOSO RGB WIRELESS XT 2627: {3, 0, "VIRTUOSO", virtuosoWU.Init, nil}, // VIRTUOSO USB Gaming Headset 2625: {3, 0, "VIRTUOSO", virtuosoWU.Init, nil}, // VIRTUOSO USB Gaming Headset 2696: {3, 0, "HS80 RGB USB", hs80rgb.Init, nil}, // HS80 RGB USB Gaming Headset 2665: {3, 0, "HS80 RGB WIRELESS", hs80rgbWU.Init, nil}, // HS80 RGB WIRELESS Gaming Headset 7132: {1, 0, "SLIPSTREAM WIRELESS", nil, slipstream.Init}, // SLIPSTREAM WIRELESS USB Receiver 7039: {1, 0, "SLIPSTREAM WIRELESS", nil, slipstream.Init}, // CORSAIR DARK CORE RGB PRO SE Gaming Dongle 7078: {1, 0, "SLIPSTREAM WIRELESS", nil, slipstream.Init}, // SLIPSTREAM WIRELESS USB Receiver 11008: {1, 0, "SLIPSTREAM WIRELESS", nil, slipstream.Init}, // SLIPSTREAM WIRELESS USB Receiver 11035: {1, 0, "SLIPSTREAM WIRELESS", nil, slipstreamV2.Init}, // SLIPSTREAM WIRELESS V2 USB Receiver 11074: {1, 0, "SLIPSTREAM WIRELESS", nil, slipstreamV2.Init}, // CORSAIR SABRE v3 PRO WIRELESS USB Receiver 7013: {1, 0, "SLIPSTREAM WIRELESS", nil, slipstream.Init}, // CORSAIR HARPOON RGB WIRELESS Dongle 11050: {1, 0, "SABRE V2 PRO DONGLE", nil, sabrev2prodongle.Init}, // Sabre v2 Pro Ultralight Wireless Dongle 11060: {1, 0, "SABRE V2 PRO DONGLE", nil, sabrev2prodongle.Init}, // SABRE v2 PRO WIRELESS MG receiver 11061: {1, 0, "SABRE V2 PRO DONGLE", nil, sabrev2prodongle.Init}, // SABRE v2 PRO WIRELESS CF receiver 7041: {1, 0, "DARK CORE RGB PRO Gaming Dongle", nil, slipstream.Init}, // DARK CORE RGB PRO Gaming Dongle 10754: {4, 0, "VIRTUOSO MAX WIRELESS", nil, virtuosomaxdongle.Init}, // VIRTUOSO MAX WIRELESS 10755: {4, 0, "VIRTUOSO MAX WIRELESS", nil, virtuosomaxdongle.Init}, // VIRTUOSO MAX WIRELESS XBOX 2711: {4, 0, "HS80 MAX WIRELESS", nil, hs80maxdongle.Init}, // HS80 MAX WIRELESS 10767: {4, 0, "HS80 MAX WIRELESS", nil, hs80maxdongle.Init}, // HS80 MAX WIRELESS 10764: {3, 0, "HS80 MAX WIRELESS", nil, hs80maxdongle.Init}, // HS80 MAX WIRELESS for XBOX Gaming Receiver 6993: {1, 0, "DARK CORE RGB SE", nil, darkcorergbsesongle.Init}, // DARK CORE RGB SE Wireless USB Receiver 2660: {3, 0, "HEADSET DONGLE", nil, headsetdongle.Init}, // Headset dongle 2667: {3, 0, "HEADSET DONGLE", nil, headsetdongle.Init}, // Headset dongle 2628: {3, 0, "HEADSET DONGLE", nil, headsetdongle.Init}, // Headset dongle 2626: {3, 0, "HEADSET DONGLE", nil, headsetdongle.Init}, // Headset dongle 2675: {3, 0, "HEADSET DONGLE", nil, headsetdongle.Init}, // Headset dongle 2641: {3, 0, "VOID ELITE WIRELESS", nil, voidelitedongle.Init}, // Headset dongle 2645: {3, 0, "VOID ELITE WIRELESS", nil, voidelitedongle.Init}, // Headset dongle (rev 0x0A55) 2622: {3, 65346, "HEADSET DONGLE", nil, headsetdongle.Init}, // Headset dongle 2624: {3, 65346, "HEADSET DONGLE", nil, headsetdongle.Init}, // Headset dongle 11015: {1, 0, "K65 PLUS WIRELESS", nil, k65plusWdongle.Init}, // K65 PLUS WIRELESS 2621: {3, 65346, "VIRTUOSO SE", virtuosoSEWU.Init, nil}, // CORSAIR VIRTUOSO SE USB Gaming Headset 2623: {3, 65346, "VIRTUOSO SE", virtuosoSEWU.Init, nil}, // CORSAIR VIRTUOSO SE USB Gaming Headset 10757: {3, 0, "VOID MAX WIRELESS V2", nil, voidV2dongle.Init}, // VOID MAX WIRELESS for XBOX Gaming Receiver 10760: {4, 0, "VOID WIRELESS V2", nil, voidV2dongle.Init}, // VOID WIRELESS V2 10770: {3, 0, "VOID MAX WIRELESS V2", nil, voidV2dongle.Init}, // VOID WIRELESS MAX V2 7168: {0, 0, "CORSAIR LINK TM USB DONGLE", psudongle.Init, nil}, // CORSAIR LINK TM USB DONGLE 17229: {4, 0, "SCUF ENVISION PRO", scufenvisionproWU.Init, nil}, // SCUF Envision Pro Controller 14853: {4, 0, "SCUF ENVISION PRO V2", scufenvisionproV2WU.Init, nil}, // SCUF Envision Pro Controller V2 17230: {4, 0, "SCUF PC Controller Dongle", nil, scufdongle.Init}, // SCUF Gaming SCUF PC Controller Dongle 14856: {4, 0, "SCUF PC Controller Dongle V2", nil, scufdongleV2.Init}, // SCUF Envision Pro Wireless USB Receiver V2 7437: {0, 0, "XENEON EDGE", xeneonedge.Init, nil}, // XENEON EDGE } // initializeDevice will initialize a device func initializeDevice(productId uint16, key, productPath string) { callback, ok := deviceRegisterMap[productId] if ok { if callback.DeviceRegister != nil { initWG.Add(1) go func(vid, pid uint16, serial, path string, cb deviceRegister) { defer initWG.Done() dev := cb(vid, pid, serial, path) addDevice(dev) }(vendorId, productId, key, productPath, callback.DeviceRegister) } if callback.DeviceRegisterEx != nil { initWG.Add(1) go func(vid, pid uint16, serial, path string, cb deviceRegisterEx) { defer initWG.Done() dev := cb(vid, pid, serial, path, addDevice) addDevice(dev) }(vendorId, productId, key, productPath, callback.DeviceRegisterEx) } } }