mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-03-28 19:01:07 -04:00
Use hidapi wrapper for HyperX mousemat controller
This commit is contained in:
@@ -11,15 +11,16 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
HyperXMousematController::HyperXMousematController(hid_device* dev_handle, const char* path)
|
||||
HyperXMousematController::HyperXMousematController(hidapi_wrapper hid_wrapper, hid_device* dev_handle, const char* path)
|
||||
{
|
||||
wrapper = hid_wrapper;
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
}
|
||||
|
||||
HyperXMousematController::~HyperXMousematController()
|
||||
{
|
||||
hid_close(dev);
|
||||
wrapper.hid_close(dev);
|
||||
}
|
||||
|
||||
std::string HyperXMousematController::GetDeviceLocation()
|
||||
@@ -30,7 +31,7 @@ std::string HyperXMousematController::GetDeviceLocation()
|
||||
std::string HyperXMousematController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
int ret = wrapper.hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
@@ -71,7 +72,7 @@ void HyperXMousematController::SendDirect
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 65);
|
||||
wrapper.hid_send_feature_report(dev, buf, 65);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -94,7 +95,7 @@ void HyperXMousematController::SendDirect
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 65);
|
||||
wrapper.hid_send_feature_report(dev, buf, 65);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -114,5 +115,5 @@ void HyperXMousematController::SendDirect
|
||||
buf[(i * 4) + 4] = RGBGetBValue(color_data[16 + i]);
|
||||
}
|
||||
|
||||
hid_send_feature_report(dev, buf, 65);
|
||||
wrapper.hid_send_feature_report(dev, buf, 65);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user