Set endpoint based on Corsair Lighting Node device table

This commit is contained in:
Adam Honse committed 2020-03-05 22:04:30 -06:00
1 parent 1115213d5a
commit 64dad049f9
3 files changed
+16 -13

No files matched your search

@@ -46,9 +46,11 @@ THREAD keepalive_thread(void *param)
THREADRETURN
}
CorsairNodeProController::CorsairNodeProController(libusb_device_handle* dev_handle)
CorsairNodeProController::CorsairNodeProController(libusb_device_handle* dev_handle, unsigned int dev_endpoint)
{
dev = dev_handle;
endpoint = dev_endpoint;
channel_leds[0] = 60;
channel_leds[1] = 60;
@@ -308,7 +310,7 @@ void CorsairNodeProController::SendDirect
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendCommit()
@@ -330,7 +332,7 @@ void CorsairNodeProController::SendCommit()
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendBegin
@@ -355,7 +357,7 @@ void CorsairNodeProController::SendBegin
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendEffectConfig
@@ -432,7 +434,7 @@ void CorsairNodeProController::SendEffectConfig
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendTemperature()
@@ -462,7 +464,7 @@ void CorsairNodeProController::SendReset
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendPortState
@@ -489,7 +491,7 @@ void CorsairNodeProController::SendPortState
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, endpoint, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendBrightness()
@@ -84,7 +84,7 @@ enum
class CorsairNodeProController
{
public:
CorsairNodeProController(libusb_device_handle* dev_handle);
CorsairNodeProController(libusb_device_handle* dev_handle, unsigned int dev_endpoint);
~CorsairNodeProController();
unsigned int GetStripsOnChannel(unsigned int channel);
@@ -113,6 +113,7 @@ public:
private:
libusb_device_handle* dev;
unsigned int endpoint;
void SendDirect
(
@@ -23,12 +23,12 @@ typedef struct
static const corsair_node_device device_list[6] =
{
{ CORSAIR_VID, CORSAIR_LIGHTING_NODE_CORE_PID, 0, 1, "Corsair Lighting Node Core" },
{ CORSAIR_VID, CORSAIR_LIGHTING_NODE_PRO_PID, 0, 2, "Corsair Lighting Node Pro" },
{ CORSAIR_VID, CORSAIR_LIGHTING_NODE_CORE_PID, 1, 1, "Corsair Lighting Node Core" },
{ CORSAIR_VID, CORSAIR_LIGHTING_NODE_PRO_PID, 1, 2, "Corsair Lighting Node Pro" },
{ CORSAIR_VID, CORSAIR_COMMANDER_PRO_PID, 2, 2, "Corsair Commander Pro" },
{ CORSAIR_VID, CORSAIR_LS100_PID, 0, 1, "Corsair LS100 Lighting Kit" },
{ CORSAIR_VID, CORSAIR_LS100_PID, 1, 1, "Corsair LS100 Lighting Kit" },
{ CORSAIR_VID, CORSAIR_1000D_OBSIDIAN_PID, 2, 2, "Corsair 1000D Obsidian" },
{ CORSAIR_VID, CORSAIR_SPEC_OMEGA_RGB_PID, 0, 2, "Corsair SPEC OMEGA RGB" }
{ CORSAIR_VID, CORSAIR_SPEC_OMEGA_RGB_PID, 1, 2, "Corsair SPEC OMEGA RGB" }
};
@@ -55,7 +55,7 @@ void DetectCorsairNodeProControllers(std::vector<RGBController*> &rgb_controller
libusb_detach_kernel_driver(dev, 0);
libusb_claim_interface(dev, 0);
CorsairNodeProController* controller = new CorsairNodeProController(dev);
CorsairNodeProController* controller = new CorsairNodeProController(dev, device_list[device_idx].usb_endpoint);
RGBController_CorsairNodePro* rgb_controller = new RGBController_CorsairNodePro(controller);