mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-29 02:04:13 -04:00
Fix a bunch of compiler warnings
This commit is contained in:
@@ -26,6 +26,7 @@ AuraUSBController::~AuraUSBController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
unsigned int AuraUSBController::GetChannelCount()
|
||||
{
|
||||
return(device_info.size());
|
||||
@@ -104,7 +105,7 @@ void AuraUSBController::GetConfigTable()
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
LOG_INFO("[%s] Could not read config table, can not add device", device_name);
|
||||
delete this;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ bool TestForCorsairVengeanceProController(i2c_smbus_interface* bus, unsigned cha
|
||||
|
||||
LOG_DEBUG("[%s] Trying address %02X", CORSAIR_VENGEANCE_RGB_PRO_NAME, address);
|
||||
|
||||
if (res >= 0)
|
||||
if(res >= 0)
|
||||
{
|
||||
pass = true;
|
||||
|
||||
@@ -41,7 +41,7 @@ bool TestForCorsairVengeanceProController(i2c_smbus_interface* bus, unsigned cha
|
||||
|
||||
res = bus->i2c_smbus_read_byte_data(address, 0x44);
|
||||
|
||||
if (!((res == 0x03) || (res == 0x04)))
|
||||
if(!((res == 0x03) || (res == 0x04)))
|
||||
{
|
||||
pass = false;
|
||||
LOG_DEBUG("[%s] Failed: was expecting 0x03 or 0x04 got %02X", CORSAIR_VENGEANCE_RGB_PRO_NAME, res);
|
||||
@@ -53,7 +53,7 @@ bool TestForCorsairVengeanceProController(i2c_smbus_interface* bus, unsigned cha
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(10ms);
|
||||
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForCorsairVengeanceProController() */
|
||||
@@ -71,9 +71,6 @@ bool TestForCorsairVengeanceProController(i2c_smbus_interface* bus, unsigned cha
|
||||
|
||||
void DetectCorsairVengeanceProControllers(std::vector<i2c_smbus_interface*> &busses)
|
||||
{
|
||||
CorsairVengeanceProController* new_corsair_pro;
|
||||
RGBController_CorsairVengeancePro* new_controller;
|
||||
|
||||
for(unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
LOG_DEBUG("[%s] Testing bus %d", CORSAIR_VENGEANCE_RGB_PRO_NAME, bus);
|
||||
@@ -86,7 +83,7 @@ void DetectCorsairVengeanceProControllers(std::vector<i2c_smbus_interface*> &bus
|
||||
{
|
||||
CorsairVengeanceProController* new_controller = new CorsairVengeanceProController(busses[bus], addr);
|
||||
RGBController_CorsairVengeancePro* new_rgbcontroller = new RGBController_CorsairVengeancePro(new_controller);
|
||||
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(new_rgbcontroller);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,10 +86,6 @@ void CorsairWirelessController::SetLEDs(std::vector<RGBColor>colors)
|
||||
SendDirectFrame(false, &buf[362]);
|
||||
}
|
||||
|
||||
void CorsairWirelessController::SetLEDsKeyboardFull(std::vector<RGBColor> colors)
|
||||
{
|
||||
}
|
||||
|
||||
void CorsairWirelessController::SetName(std::string device_name)
|
||||
{
|
||||
name = device_name;
|
||||
|
||||
@@ -27,7 +27,6 @@ public:
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetLEDs(std::vector<RGBColor> colors);
|
||||
void SetLEDsKeyboardFull(std::vector<RGBColor> colors);
|
||||
void SetName(std::string device_name);
|
||||
|
||||
private:
|
||||
|
||||
@@ -121,7 +121,7 @@ bool TestForCrucialController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
buf[i] = CrucialRegisterRead(bus, address, CRUCIAL_REG_MICRON_CHECK_2 + i);
|
||||
}
|
||||
|
||||
|
||||
if(strcmp(buf, "Micron") == 0)
|
||||
{
|
||||
LOG_DEBUG("[%s] Device %02X is a Micron device, continuing", CRUCIAL_CONTROLLER_NAME, address);
|
||||
@@ -161,18 +161,17 @@ void CrucialRegisterWrite(i2c_smbus_interface* bus, unsigned char dev, unsigned
|
||||
|
||||
void DetectCrucialControllers(std::vector<i2c_smbus_interface*> &busses)
|
||||
{
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
for(unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
int address_list_idx = -1;
|
||||
|
||||
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
|
||||
{
|
||||
|
||||
for (unsigned int slot = 0; slot < 4; slot++)
|
||||
for(unsigned int slot = 0; slot < 4; slot++)
|
||||
{
|
||||
int res = busses[bus]->i2c_smbus_write_quick(0x27, I2C_SMBUS_WRITE);
|
||||
|
||||
if (res < 0)
|
||||
if(res < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -188,10 +187,9 @@ void DetectCrucialControllers(std::vector<i2c_smbus_interface*> &busses)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("[%s] Testing address %02X to see if there is a device there", CRUCIAL_CONTROLLER_NAME, crucial_addresses[address_list_idx]);
|
||||
break;
|
||||
}
|
||||
} while (res >= 0);
|
||||
} while(res >= 0);
|
||||
|
||||
if(address_list_idx < CRUCIAL_ADDRESS_COUNT)
|
||||
{
|
||||
@@ -207,9 +205,11 @@ void DetectCrucialControllers(std::vector<i2c_smbus_interface*> &busses)
|
||||
LOG_DEBUG("[%s] In bus: %02X:%02X looking for devices at [%s]", CRUCIAL_CONTROLLER_NAME, busses[bus]->pci_vendor, busses[bus]->pci_device, TESTING_ADDRESSES);
|
||||
|
||||
// Add Crucial controllers
|
||||
for (unsigned int address_list_idx = 0; address_list_idx < CRUCIAL_ADDRESS_COUNT; address_list_idx++)
|
||||
for(unsigned int address_list_idx = 0; address_list_idx < CRUCIAL_ADDRESS_COUNT; address_list_idx++)
|
||||
{
|
||||
if (TestForCrucialController(busses[bus], crucial_addresses[address_list_idx]))
|
||||
LOG_DEBUG("[%s] Testing address %02X to see if there is a device there", CRUCIAL_CONTROLLER_NAME, crucial_addresses[address_list_idx]);
|
||||
|
||||
if(TestForCrucialController(busses[bus], crucial_addresses[address_list_idx]))
|
||||
{
|
||||
CrucialController* controller = new CrucialController(busses[bus], crucial_addresses[address_list_idx]);
|
||||
RGBController_Crucial* rgb_controller = new RGBController_Crucial(controller);
|
||||
|
||||
@@ -196,7 +196,7 @@ const char * ENESMBusController::GetChannelName(unsigned int led)
|
||||
case (unsigned char)ENE_LED_CHANNEL_DRAM_2:
|
||||
return(ene_channels[5]);
|
||||
break;
|
||||
|
||||
|
||||
case (unsigned char)ENE_LED_CHANNEL_PCIE:
|
||||
return(ene_channels[6]);
|
||||
break;
|
||||
@@ -273,7 +273,7 @@ void ENESMBusController::SetAllColorsDirect(RGBColor* colors)
|
||||
|
||||
while(bytes_sent < (led_count * 3))
|
||||
{
|
||||
unsigned int bytes_to_send = (led_count * 3) - bytes_sent;
|
||||
int bytes_to_send = (led_count * 3) - bytes_sent;
|
||||
|
||||
if(bytes_to_send > interface->GetMaxBlock())
|
||||
{
|
||||
@@ -302,7 +302,7 @@ void ENESMBusController::SetAllColorsEffect(RGBColor* colors)
|
||||
|
||||
while(bytes_sent < (led_count * 3))
|
||||
{
|
||||
unsigned int bytes_to_send = (led_count * 3) - bytes_sent;
|
||||
int bytes_to_send = (led_count * 3) - bytes_sent;
|
||||
|
||||
if(bytes_to_send > interface->GetMaxBlock())
|
||||
{
|
||||
@@ -315,7 +315,7 @@ void ENESMBusController::SetAllColorsEffect(RGBColor* colors)
|
||||
}
|
||||
|
||||
ENERegisterWrite(ENE_REG_APPLY, ENE_APPLY_VAL);
|
||||
|
||||
|
||||
delete[] color_buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,11 @@ typedef unsigned char ene_dev_id;
|
||||
class ENESMBusInterface
|
||||
{
|
||||
public:
|
||||
virtual ~ENESMBusInterface() = default;
|
||||
|
||||
virtual std::string GetLocation() = 0;
|
||||
virtual int GetMaxBlock() = 0;
|
||||
virtual unsigned char ENERegisterRead(ene_dev_id dev, ene_register reg) = 0;
|
||||
virtual void ENERegisterWrite(ene_dev_id dev, ene_register reg, unsigned char val) = 0;
|
||||
virtual void ENERegisterWriteBlock(ene_dev_id dev, ene_register reg, unsigned char * data, unsigned char sz) = 0;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -75,6 +75,7 @@ static int nvme_passthru(int fd, unsigned long ioctl_cmd, uint8_t opcode,
|
||||
.cdw14 = cdw14,
|
||||
.cdw15 = cdw15,
|
||||
.timeout_ms = timeout_ms,
|
||||
.result = 0,
|
||||
};
|
||||
|
||||
return nvme_submit_passthru(fd, ioctl_cmd, &cmd, result);
|
||||
@@ -103,6 +104,11 @@ ENESMBusInterface_SpectrixS40G::ENESMBusInterface_SpectrixS40G(int fd, char* pat
|
||||
this->path = path;
|
||||
}
|
||||
|
||||
ENESMBusInterface_SpectrixS40G::~ENESMBusInterface_SpectrixS40G()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string ENESMBusInterface_SpectrixS40G::GetLocation()
|
||||
{
|
||||
return("NVMe: " + path);
|
||||
@@ -198,4 +204,4 @@ void ENESMBusInterface_SpectrixS40G::ENERegisterWriteBlock(ene_dev_id dev, ene_r
|
||||
cfg.cdw15, cfg.data_len, data, cfg.metadata_len,
|
||||
metadata, cfg.timeout_ms, &result);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ class ENESMBusInterface_SpectrixS40G : public ENESMBusInterface
|
||||
{
|
||||
public:
|
||||
ENESMBusInterface_SpectrixS40G(int fd, char* path);
|
||||
~ENESMBusInterface_SpectrixS40G();
|
||||
|
||||
std::string GetLocation();
|
||||
int GetMaxBlock();
|
||||
@@ -25,4 +26,4 @@ public:
|
||||
private:
|
||||
int nvme_fd;
|
||||
std::string path;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -20,6 +20,11 @@ ENESMBusInterface_SpectrixS40G::ENESMBusInterface_SpectrixS40G(HANDLE fd, wchar_
|
||||
this->path = path;
|
||||
}
|
||||
|
||||
ENESMBusInterface_SpectrixS40G::~ENESMBusInterface_SpectrixS40G()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string ENESMBusInterface_SpectrixS40G::GetLocation()
|
||||
{
|
||||
std::string str(path.begin(), path.end());
|
||||
@@ -92,7 +97,7 @@ unsigned char ENESMBusInterface_SpectrixS40G::ENERegisterRead(ene_dev_id dev, en
|
||||
\*-----------------------------------------------------------------------------*/
|
||||
DWORD bytesreturned = 0;
|
||||
while(bytesreturned != sizeof(buffer))
|
||||
{
|
||||
{
|
||||
bool result = DeviceIoControl(nvme_fd, IOCTL_STORAGE_PROTOCOL_COMMAND, buffer, sizeof(buffer), buffer, sizeof(buffer), &bytesreturned, (LPOVERLAPPED)0x0);
|
||||
}
|
||||
|
||||
@@ -248,4 +253,4 @@ void ENESMBusInterface_SpectrixS40G::ENERegisterWriteBlock(ene_dev_id dev, ene_r
|
||||
\*-----------------------------------------------------------------------------*/
|
||||
DeviceIoControl(nvme_fd, IOCTL_STORAGE_PROTOCOL_COMMAND, buffer, sizeof(buffer), buffer, sizeof(buffer), 0x0, (LPOVERLAPPED)0x0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ class ENESMBusInterface_SpectrixS40G : public ENESMBusInterface
|
||||
{
|
||||
public:
|
||||
ENESMBusInterface_SpectrixS40G(HANDLE fd, wchar_t* path);
|
||||
~ENESMBusInterface_SpectrixS40G();
|
||||
|
||||
std::string GetLocation();
|
||||
int GetMaxBlock();
|
||||
@@ -27,4 +28,4 @@ public:
|
||||
private:
|
||||
HANDLE nvme_fd;
|
||||
std::wstring path;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -13,6 +13,11 @@ ENESMBusInterface_i2c_smbus::ENESMBusInterface_i2c_smbus(i2c_smbus_interface* bu
|
||||
this->bus = bus;
|
||||
}
|
||||
|
||||
ENESMBusInterface_i2c_smbus::~ENESMBusInterface_i2c_smbus()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string ENESMBusInterface_i2c_smbus::GetLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
@@ -49,4 +54,4 @@ void ENESMBusInterface_i2c_smbus::ENERegisterWriteBlock(ene_dev_id dev, ene_regi
|
||||
|
||||
//Write ENE block data
|
||||
bus->i2c_smbus_write_block_data(dev, 0x03, sz, data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ class ENESMBusInterface_i2c_smbus : public ENESMBusInterface
|
||||
{
|
||||
public:
|
||||
ENESMBusInterface_i2c_smbus(i2c_smbus_interface* bus);
|
||||
~ENESMBusInterface_i2c_smbus();
|
||||
|
||||
std::string GetLocation();
|
||||
int GetMaxBlock();
|
||||
@@ -25,4 +26,4 @@ public:
|
||||
|
||||
private:
|
||||
i2c_smbus_interface * bus;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -25,13 +25,11 @@
|
||||
|
||||
void DetectEVGAKeyboardControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
static const char* controller_name = "EVGA Keyboard Controller";
|
||||
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
EVGAKeyboardController* controller = new EVGAKeyboardController(dev, info->path, info->product_id);
|
||||
EVGAKeyboardController* controller = new EVGAKeyboardController(dev, info->path, info->product_id);
|
||||
RGBController_EVGAKeyboard* rgb_controller = new RGBController_EVGAKeyboard(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
@@ -44,8 +42,8 @@ void DetectEVGAMouse(hid_device_info* info, const std::string &, int connection_
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if (dev)
|
||||
{
|
||||
EVGAMouseController* controller = new EVGAMouseController(dev, info->path, connection_type);
|
||||
RGBController_EVGAMouse *rgb_controller = new RGBController_EVGAMouse(controller);
|
||||
EVGAMouseController* controller = new EVGAMouseController(dev, info->path, connection_type);
|
||||
RGBController_EVGAMouse* rgb_controller = new RGBController_EVGAMouse(controller);
|
||||
/*-------------------------*\
|
||||
| Constructor sets the name |
|
||||
\*-------------------------*/
|
||||
|
||||
@@ -381,7 +381,7 @@ RGBController_EVGAKeyboard::RGBController_EVGAKeyboard(EVGAKeyboardController* c
|
||||
ThreeBy3.speed = EVGA_KEYBOARD_CONTROLLER_SPEED_NORMAL;
|
||||
modes.push_back(ThreeBy3);
|
||||
|
||||
uint8_t set_mode = controller->GetMode();
|
||||
//uint8_t set_mode = controller->GetMode();
|
||||
//active_mode = set_mode;
|
||||
SetupZones();
|
||||
}
|
||||
@@ -532,7 +532,7 @@ void RGBController_EVGAKeyboard::DeviceUpdateMode()
|
||||
|
||||
if(set_mode.color_mode == MODE_COLORS_RANDOM)
|
||||
{
|
||||
for(int i = 0; i < colours.size(); i++)
|
||||
for(unsigned int i = 0; i < colours.size(); i++)
|
||||
{
|
||||
colours[i] = GetRandomColor();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ HPOmen30LController::HPOmen30LController(hid_device* dev_handle, const char* pat
|
||||
location = path;
|
||||
|
||||
strcpy(device_name, "HP Omen 30L");
|
||||
|
||||
|
||||
hp_zone logo;
|
||||
logo.value = HP_OMEN_30L_LOGO_ZONE;
|
||||
logo.mode = HP_OMEN_30L_DIRECT;
|
||||
@@ -43,7 +43,7 @@ HPOmen30LController::HPOmen30LController(hid_device* dev_handle, const char* pat
|
||||
cpu.mode = HP_OMEN_30L_DIRECT;
|
||||
cpu.speed = HP_OMEN_30L_SPEED_MED;
|
||||
cpu.brightness = 0x64;
|
||||
hp_zones.push_back(cpu);
|
||||
hp_zones.push_back(cpu);
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ std::string HPOmen30LController::GetSerialString()
|
||||
return(ret_string);
|
||||
}
|
||||
|
||||
std::string HPOmen30LController::GetEffectChannelString(unsigned char channel)
|
||||
std::string HPOmen30LController::GetEffectChannelString(unsigned char /*channel*/)
|
||||
{
|
||||
std::string ret_string = "";
|
||||
return(ret_string);
|
||||
@@ -81,7 +81,7 @@ std::string HPOmen30LController::GetFirmwareVersionString()
|
||||
}
|
||||
|
||||
void HPOmen30LController::SetZoneMode(int zone,unsigned char mode, unsigned char speed,unsigned char brightness)
|
||||
{
|
||||
{
|
||||
hp_zones[zone].mode = mode;
|
||||
hp_zones[zone].speed = speed;
|
||||
hp_zones[zone].brightness = brightness;
|
||||
@@ -115,7 +115,7 @@ void HPOmen30LController::SendZoneUpdate(int zone, std::vector<RGBColor> colors)
|
||||
};
|
||||
|
||||
usb_buf[0x36] = hp_zones[zone].value;
|
||||
|
||||
|
||||
if(hp_zones[zone].mode != HP_OMEN_30L_DIRECT)
|
||||
{
|
||||
hid_write(dev, usb_buf, 58);
|
||||
@@ -136,7 +136,7 @@ void HPOmen30LController::SendZoneUpdate(int zone, std::vector<RGBColor> colors)
|
||||
usb_buf[0x31] = 0x0A;
|
||||
}
|
||||
|
||||
if(hp_zones[zone].mode == HP_OMEN_30L_DIRECT)
|
||||
if(hp_zones[zone].mode == HP_OMEN_30L_DIRECT)
|
||||
{
|
||||
usb_buf[0x08] = usb_buf[0x0C] = usb_buf[0x10] = usb_buf[0x14] = 0x64;
|
||||
usb_buf[0x09] = usb_buf[0x0D] = usb_buf[0x11] = usb_buf[0x15] = RGBGetRValue(colors[zone]);
|
||||
@@ -157,10 +157,10 @@ void HPOmen30LController::SendZoneUpdate(int zone, std::vector<RGBColor> colors)
|
||||
{
|
||||
usb_buf[0x04] = colors.size();
|
||||
|
||||
for(int i = 0; i < colors.size(); i++)
|
||||
for(unsigned int i = 0; i < colors.size(); i++)
|
||||
{
|
||||
usb_buf[0x05] = i + 1;
|
||||
|
||||
|
||||
usb_buf[0x08] = usb_buf[0x0B] = usb_buf[0x0E] = usb_buf[0x11] = RGBGetRValue(colors[i]);
|
||||
usb_buf[0x09] = usb_buf[0x0C] = usb_buf[0x0F] = usb_buf[0x12] = RGBGetGValue(colors[i]);
|
||||
usb_buf[0x0A] = usb_buf[0x0D] = usb_buf[0x10] = usb_buf[0x13] = RGBGetBValue(colors[i]);
|
||||
@@ -168,4 +168,4 @@ void HPOmen30LController::SendZoneUpdate(int zone, std::vector<RGBColor> colors)
|
||||
hid_write(dev, usb_buf, 58);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ void RGBController_HPOmen30L::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
|
||||
void RGBController_HPOmen30L::DeviceUpdateLEDs()
|
||||
{
|
||||
for(int i = 0; i < zones.size(); i++)
|
||||
for(unsigned int i = 0; i < zones.size(); i++)
|
||||
{
|
||||
if(modes[active_mode].value == HP_OMEN_30L_STATIC || modes[active_mode].value == HP_OMEN_30L_DIRECT)
|
||||
{
|
||||
@@ -205,7 +205,7 @@ void RGBController_HPOmen30L::SetCustomMode()
|
||||
|
||||
void RGBController_HPOmen30L::DeviceUpdateMode()
|
||||
{
|
||||
for(int i = 0; i < zones.size(); i++)
|
||||
for(unsigned int i = 0; i < zones.size(); i++)
|
||||
{
|
||||
controller->SetZoneMode(i, modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ void HyperXAlloyFPSController::SetLEDsDirect(std::vector<RGBColor> colors)
|
||||
unsigned char red_color_data[106];
|
||||
unsigned char grn_color_data[106];
|
||||
unsigned char blu_color_data[106];
|
||||
unsigned char ext_color_data[150];
|
||||
|
||||
for(std::size_t i = 0; i < 106; i++)
|
||||
{
|
||||
@@ -129,4 +128,4 @@ void HyperXAlloyFPSController::SendDirect
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 264);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,13 +31,11 @@ enum
|
||||
|
||||
void DetectLenovoLegionUSBControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
static const char* controller_name = "Lenovo Legion Laptop";
|
||||
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
LenovoUSBController* controller = new LenovoUSBController(dev, info->path, info->product_id);
|
||||
LenovoUSBController* controller = new LenovoUSBController(dev, info->path, info->product_id);
|
||||
RGBController_LenovoUSB* rgb_controller = new RGBController_LenovoUSB(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ void RGBController_LenovoUSB::SetupZones()
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i = 0; i < lenovo_zones.size(); i++)
|
||||
for(unsigned int i = 0; i < lenovo_zones.size(); i++)
|
||||
{
|
||||
zone new_zone;
|
||||
new_zone.name = lenovo_zones[i].name;
|
||||
@@ -264,7 +264,7 @@ void RGBController_LenovoUSB::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
|
||||
void RGBController_LenovoUSB::UpdateSingleLED(int led)
|
||||
{
|
||||
if(led != NA)
|
||||
if(led != (int)NA)
|
||||
{
|
||||
controller->setSingleLED(lenovo_leds[led].zone_num, lenovo_leds[led].led_num, colors[led]);
|
||||
}
|
||||
@@ -275,7 +275,7 @@ void RGBController_LenovoUSB::UpdateZoneLEDs(int zone)
|
||||
uint8_t device_zone = lenovo_leds[zones[zone].start_idx].zone_num;
|
||||
vector<pair<uint8_t, RGBColor>> color_map;
|
||||
|
||||
for(int i = 0; i < zones[zone].leds_count; i++)
|
||||
for(unsigned int i = 0; i < zones[zone].leds_count; i++)
|
||||
{
|
||||
int index = zones[zone].start_idx+i;
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ hid_device* logitech_device::getDevice(uint8_t usage_index)
|
||||
else
|
||||
{
|
||||
return find_usage->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t logitech_device::getFeatureIndex(uint16_t feature_page)
|
||||
|
||||
@@ -21,7 +21,7 @@ void DetectN5312AControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
N5312AController* controller = new N5312AController(dev, *info);
|
||||
RGBController_N5312A* rgb_controller = new RGBController_N5312A(controller);
|
||||
rgb_controller->name = rgb_controller->name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ void PatriotViperController::StopKeepaliveThread()
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int PatriotViperController::GetDelay(unsigned char mode, unsigned int step, unsigned int sub_step, bool loop_end)
|
||||
unsigned int PatriotViperController::GetDelay(unsigned char mode, unsigned int /*step*/, unsigned int sub_step, bool loop_end)
|
||||
{
|
||||
if(loop_end)
|
||||
{
|
||||
@@ -335,4 +335,4 @@ unsigned int PatriotViperController::GetDelay(unsigned char mode, unsigned int s
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,26 +25,21 @@ using namespace std::chrono_literals;
|
||||
|
||||
void DetectPatriotViperSteelControllers(std::vector<i2c_smbus_interface *> &busses)
|
||||
{
|
||||
PatriotViperSteelController *new_viper;
|
||||
RGBController_PatriotViperSteel *new_controller;
|
||||
|
||||
for(unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
|
||||
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
|
||||
{
|
||||
int res = busses[bus]->i2c_smbus_read_byte_data(0x20, 0x1D);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
if((busses[bus]->i2c_smbus_read_byte_data(0x20, 0x1D) == 0x0F)
|
||||
if((busses[bus]->i2c_smbus_read_byte_data(0x20, 0x1D) == 0x0F)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(0x20, 0x1E) == 0x0C)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(0x20, 0x39) == 0x0F)
|
||||
&&(busses[bus]->i2c_smbus_read_byte_data(0x20, 0x3A) == 0x0C))
|
||||
{
|
||||
new_viper = new PatriotViperSteelController(busses[bus], 0x77);
|
||||
new_controller = new RGBController_PatriotViperSteel(new_viper);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
PatriotViperSteelController* controller = new PatriotViperSteelController(busses[bus], 0x77);
|
||||
RGBController_PatriotViperSteel* rgb_controller = new RGBController_PatriotViperSteel(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,6 +479,6 @@ void RGBController_SinowealthKeyboard::DeviceUpdateMode()
|
||||
}
|
||||
else
|
||||
{
|
||||
sinowealth->SetMode(modes[active_mode].value, brightness, modes[active_mode].speed, modes[active_mode].color_mode, selected_color);
|
||||
sinowealth->SetMode(modes[active_mode].value, brightness, modes[active_mode].speed, modes[active_mode].color_mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#include "SinowealthKeyboardController.h"
|
||||
#include <cstring>
|
||||
|
||||
static unsigned char handshake_packet[] = { 0x06, 0x03, 0x01, 0x00, 0x08, 0x04 };
|
||||
|
||||
static unsigned char send_per_key_part_of_command_packet[] = { 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
@@ -198,7 +196,7 @@ void SinowealthKeyboardController::SetStaticColor(RGBColor* color_buf)
|
||||
hid_send_feature_report(dev_data, usb_buf, sizeof(usb_buf));
|
||||
}
|
||||
|
||||
void SinowealthKeyboardController::SetMode(unsigned char mode, unsigned char brightness, unsigned char speed, unsigned char color_mode, RGBColor* color_buf)
|
||||
void SinowealthKeyboardController::SetMode(unsigned char mode, unsigned char brightness, unsigned char speed, unsigned char color_mode)
|
||||
{
|
||||
const int buffer_size = 1032;
|
||||
|
||||
|
||||
@@ -71,8 +71,7 @@ public:
|
||||
|
||||
void SetLEDColor(RGBColor* color_buf);
|
||||
void SetStaticColor(RGBColor* color_buf);
|
||||
void SetMode(unsigned char mode, unsigned char brightness, unsigned char speed, RGBColor* color_buf);
|
||||
void SetMode(unsigned char mode, unsigned char brightness, unsigned char speed, unsigned char color_mode, RGBColor *color_buf);
|
||||
void SetMode(unsigned char mode, unsigned char brightness, unsigned char speed, unsigned char color_mode);
|
||||
void GetProfile();
|
||||
void ReadFirmwareInfo();
|
||||
void SetLEDsDirect(std::vector<RGBColor> colors);
|
||||
|
||||
@@ -63,7 +63,7 @@ void RGBController_SteelSeriesApexTZone::SetupZones()
|
||||
curr_zone.matrix_map = NULL;
|
||||
zones.push_back(curr_zone);
|
||||
|
||||
for (int i = 1; i <= curr_zone.leds_count; i++)
|
||||
for(unsigned int i = 1; i <= curr_zone.leds_count; i++)
|
||||
{
|
||||
led zone_led;
|
||||
zone_led.name = "LED " + std::to_string(i);
|
||||
|
||||
@@ -75,8 +75,6 @@ RGBController_SteelSeriesRival::RGBController_SteelSeriesRival(SteelSeriesRivalC
|
||||
Pulsate.speed = STEELSERIES_RIVAL_EFFECT_PULSATE_MID;
|
||||
modes.push_back(Pulsate);
|
||||
|
||||
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ steelseries_mouse SteelSeriesAerox3Controller::GetMouse()
|
||||
return aerox_3;
|
||||
}
|
||||
|
||||
void SteelSeriesAerox3Controller::SetLightEffectAll(uint8_t effect)
|
||||
void SteelSeriesAerox3Controller::SetLightEffectAll(uint8_t /*effect*/)
|
||||
{
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Not used by this device |
|
||||
|
||||
@@ -39,7 +39,7 @@ std::string SteelSeriesApexTZoneController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
return("");
|
||||
@@ -81,7 +81,8 @@ void SteelSeriesApexTZoneController::SetColor(std::vector<RGBColor> colors, unsi
|
||||
hid_write(dev, buf, STEELSERIES_TZ_WRITE_PACKET_SIZE);
|
||||
|
||||
buf[0x01] = 0x0B;
|
||||
for(int i = 0; i < colors.size(); i++)
|
||||
|
||||
for(unsigned int i = 0; i < colors.size(); i++)
|
||||
{
|
||||
uint8_t index = i * 3;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class SteelSeriesMouseController
|
||||
{
|
||||
public:
|
||||
SteelSeriesMouseController(hid_device* dev_handle, steelseries_type proto_type, const char* path);
|
||||
~SteelSeriesMouseController();
|
||||
virtual ~SteelSeriesMouseController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
char* GetDeviceName();
|
||||
|
||||
@@ -15,15 +15,15 @@
|
||||
static void send_usb_msg(hid_device* dev, char * data_pkt, unsigned int size)
|
||||
{
|
||||
char* usb_pkt = new char[size + 1];
|
||||
|
||||
|
||||
usb_pkt[0] = 0x00;
|
||||
for(unsigned int i = 1; i < size + 1; i++)
|
||||
{
|
||||
usb_pkt[i] = data_pkt[i-1];
|
||||
}
|
||||
|
||||
|
||||
hid_write(dev, (unsigned char *)usb_pkt, size + 1);
|
||||
|
||||
|
||||
delete usb_pkt;
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ void SteelSeriesSenseiController::SetLightEffect
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Light Effect packet |
|
||||
\*-----------------------------------------------------*/
|
||||
char dur1;
|
||||
char dur2;
|
||||
char dur1 = 0x27;
|
||||
char dur2 = 0x10; //10 sec cycle
|
||||
|
||||
switch(effect)
|
||||
{
|
||||
|
||||
@@ -120,24 +120,28 @@ void RGBController_XG270QG::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_XG270QG::ResizeZone(int zone, int new_size)
|
||||
void RGBController_XG270QG::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
// Not applicable
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_XG270QG::DeviceUpdateLEDs()
|
||||
{
|
||||
//
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not include any per-LED modes |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_XG270QG::UpdateZoneLEDs(int zone)
|
||||
void RGBController_XG270QG::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
//
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_XG270QG::UpdateSingleLED(int led)
|
||||
void RGBController_XG270QG::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
//
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_XG270QG::DeviceUpdateMode()
|
||||
|
||||
@@ -86,10 +86,10 @@ void VS_XG270QG_Controller::SendModeComplete
|
||||
data[0x0D] = 0x0A; // Might be speed related
|
||||
|
||||
// original data packets are 0x40=64 long
|
||||
SendCommand(0, data, 0x20);
|
||||
SendCommand(data, 0x20);
|
||||
}
|
||||
|
||||
void VS_XG270QG_Controller::SendCommand(uint16_t wIndex, uint8_t *data, size_t length)
|
||||
void VS_XG270QG_Controller::SendCommand(uint8_t *data, size_t length)
|
||||
{
|
||||
hid_send_feature_report(dev, data, length);
|
||||
}
|
||||
|
||||
@@ -54,5 +54,5 @@ private:
|
||||
uint8_t mode1, uint8_t r1, uint8_t g1, uint8_t b1,
|
||||
uint8_t mode2, uint8_t r2, uint8_t g2, uint8_t b2
|
||||
);
|
||||
void SendCommand(uint16_t wIndex, uint8_t *config, size_t length);
|
||||
void SendCommand(uint8_t *config, size_t length);
|
||||
};
|
||||
|
||||
@@ -77,7 +77,7 @@ void WootingTwoKeyboardController::SendDirect(RGBColor* colors, uint8_t color_co
|
||||
rgb_buffer[buffer_index+1] = color16 >> 8;
|
||||
}
|
||||
|
||||
uint8_t result = wooting_usb_send_buffer(RGB_PARTS::PART0, rgb_buffer);
|
||||
wooting_usb_send_buffer(RGB_PARTS::PART0, rgb_buffer);
|
||||
}
|
||||
|
||||
void WootingTwoKeyboardController::SendInitialize()
|
||||
|
||||
@@ -495,22 +495,22 @@ void RGBController_ZETBladeOptical::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
|
||||
void RGBController_ZETBladeOptical::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateSingleLED(-1);
|
||||
last_update_time = std::chrono::steady_clock::now();
|
||||
|
||||
if(active_mode == 0)
|
||||
{
|
||||
controller->SetLEDDirect(colors, modes[active_mode].brightness);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_ZETBladeOptical::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
UpdateSingleLED(-1);
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_ZETBladeOptical::UpdateSingleLED(int led)
|
||||
void RGBController_ZETBladeOptical::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
last_update_time = std::chrono::steady_clock::now();
|
||||
|
||||
if (active_mode == 0)
|
||||
{
|
||||
controller->SetLEDDirect(colors, modes[active_mode].brightness, led);
|
||||
}
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_ZETBladeOptical::SetCustomMode()
|
||||
|
||||
@@ -78,7 +78,7 @@ void ZETBladeOpticalController::PrepareHeader(unsigned char* packet, unsigned ch
|
||||
packet[0x08] = color; // Separator FF or Color, 0-7 (0-6 in static color mode) (Rainbow,) R, G, B, Y, M, C, W
|
||||
}
|
||||
|
||||
void ZETBladeOpticalController::SetLEDDirect(const std::vector<RGBColor>& colors, unsigned char brightness, int led)
|
||||
void ZETBladeOpticalController::SetLEDDirect(const std::vector<RGBColor>& colors, unsigned char brightness)
|
||||
{
|
||||
unsigned char buf[65];
|
||||
|
||||
@@ -103,17 +103,17 @@ void ZETBladeOpticalController::SetLEDDirect(const std::vector<RGBColor>& colors
|
||||
| Continue filling and sending packets while color data |
|
||||
| remains |
|
||||
\*-----------------------------------------------------*/
|
||||
while (color_idx < colors.size())
|
||||
while(color_idx < colors.size())
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| If at a skipped index, increment skipped count |
|
||||
| and index |
|
||||
\*-------------------------------------------------*/
|
||||
if (*skip_idx == color_idx + skipped)
|
||||
if(*skip_idx == color_idx + skipped)
|
||||
{
|
||||
skip_idx++;
|
||||
|
||||
if (skip_idx >= SKIP_INDICES + sizeof(SKIP_INDICES) / sizeof(unsigned int))
|
||||
if(skip_idx >= SKIP_INDICES + sizeof(SKIP_INDICES) / sizeof(unsigned int))
|
||||
{
|
||||
skip_idx = SKIP_INDICES;
|
||||
}
|
||||
@@ -145,13 +145,13 @@ void ZETBladeOpticalController::SetLEDDirect(const std::vector<RGBColor>& colors
|
||||
| If all colors have been filled into the buffer, |
|
||||
| send the packet |
|
||||
\*-------------------------------------------------*/
|
||||
if ((buf_idx + ZET_BLADE_OPTICAL_HEADER_LEN >= sizeof(buf)) || last_color)
|
||||
if((buf_idx + ZET_BLADE_OPTICAL_HEADER_LEN >= sizeof(buf)) || last_color)
|
||||
{
|
||||
/*---------------------------------------------*\
|
||||
| If we still have place for an |
|
||||
| ending sequence - squeeze it in! |
|
||||
\*---------------------------------------------*/
|
||||
if (last_color && (buf_idx + ZET_BLADE_OPTICAL_COLOR_LEN < sizeof(buf)))
|
||||
if(last_color && (buf_idx + ZET_BLADE_OPTICAL_COLOR_LEN < sizeof(buf)))
|
||||
{
|
||||
buf[buf_idx] = 0xFF;
|
||||
ending_flag = true;
|
||||
@@ -166,7 +166,7 @@ void ZETBladeOpticalController::SetLEDDirect(const std::vector<RGBColor>& colors
|
||||
| Wait for the poor slowpoke to process packet |
|
||||
\*---------------------------------------------*/
|
||||
std::this_thread::sleep_for(ZET_BLADE_OPTICAL_DELAY);
|
||||
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Zero out buffer, reset index, prepare header |
|
||||
\*---------------------------------------------*/
|
||||
@@ -184,7 +184,7 @@ void ZETBladeOpticalController::SetLEDDirect(const std::vector<RGBColor>& colors
|
||||
/*---------------------------------------------*\
|
||||
| If there's anything left to send - send it |
|
||||
\*---------------------------------------------*/
|
||||
if (!ending_flag)
|
||||
if(!ending_flag)
|
||||
{
|
||||
buf[buf_idx] = 0xFF;
|
||||
hid_write(dev, buf, sizeof(buf));
|
||||
@@ -208,7 +208,7 @@ unsigned char ZETBladeOpticalController::RGBToPalette(unsigned char red,
|
||||
\*------------------------*/
|
||||
unsigned char color_mask = ((blu > 127) << 2 & 4) | ((grn > 127) << 1 & 2) | ((red > 127) & 1);
|
||||
|
||||
switch (color_mask) // (Rainbow/Off,) R, G, B, Y, M, C, W
|
||||
switch(color_mask) // (Rainbow/Off,) R, G, B, Y, M, C, W
|
||||
{
|
||||
case 3:
|
||||
return 4;
|
||||
@@ -235,9 +235,11 @@ void ZETBladeOpticalController::SetEffect(unsigned char mode,
|
||||
effect_mode = mode;
|
||||
custom_mode = (effect_mode == ZET_BLADE_OPTICAL_MODE_CUSTOM);
|
||||
|
||||
if (custom_mode) return;
|
||||
if(custom_mode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
unsigned char color = RGBToPalette(red, grn, blu);
|
||||
unsigned char buf[65];
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetLEDDirect(const std::vector<RGBColor>& colors, unsigned char brightness, int led);
|
||||
void SetLEDDirect(const std::vector<RGBColor>& colors, unsigned char brightness);
|
||||
|
||||
void SetEffect(unsigned char mode, unsigned char speed, unsigned char brightness, bool random, unsigned char red1, unsigned char grn1, unsigned char blu1);
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user