mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-04 14:14:17 -04:00
Add USB: location prefix and USB device ID location string to Corsair Hydro Series controller
This commit is contained in:
@@ -7,10 +7,22 @@
|
||||
#include "CorsairHydroController.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
CorsairHydroController::CorsairHydroController(libusb_device_handle* dev_handle)
|
||||
{
|
||||
dev = dev_handle;
|
||||
dev = dev_handle;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Fill in location string with USB ID |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_device_descriptor descriptor;
|
||||
libusb_get_device_descriptor(libusb_get_device(dev_handle), &descriptor);
|
||||
|
||||
std::stringstream location_stream;
|
||||
location_stream << std::hex << std::setfill('0') << std::setw(4) << descriptor.idVendor << ":" << std::hex << std::setfill('0') << std::setw(4) << descriptor.idProduct;
|
||||
location = location_stream.str();
|
||||
|
||||
SendInit();
|
||||
|
||||
@@ -22,6 +34,11 @@ std::string CorsairHydroController::GetFirmwareString()
|
||||
return(firmware_version);
|
||||
}
|
||||
|
||||
std::string CorsairHydroController::GetLocation()
|
||||
{
|
||||
return("USB: " + location);
|
||||
}
|
||||
|
||||
void CorsairHydroController::SetBlink
|
||||
(
|
||||
std::vector<RGBColor> & colors,
|
||||
@@ -248,4 +265,4 @@ void CorsairHydroController::SendSpeed
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
|
||||
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ public:
|
||||
|
||||
std::string GetFirmwareString();
|
||||
|
||||
std::string GetLocation();
|
||||
|
||||
void SetBlink
|
||||
(
|
||||
std::vector<RGBColor> & colors,
|
||||
@@ -65,6 +67,7 @@ public:
|
||||
private:
|
||||
libusb_device_handle* dev;
|
||||
std::string firmware_version;
|
||||
std::string location;
|
||||
|
||||
void SendApplyBlink();
|
||||
void SendApplyPulse();
|
||||
|
||||
@@ -17,6 +17,7 @@ RGBController_CorsairHydro::RGBController_CorsairHydro(CorsairHydroController* c
|
||||
description = "Corsair Hydro Series Device";
|
||||
version = corsair->GetFirmwareString();
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
location = corsair->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
||||
Reference in New Issue
Block a user