MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / SetMode

Method SetMode

Controllers/EVGAUSBController/EVGAMouseController.cpp:116–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116void EVGAMouseController::SetMode(uint8_t mode, uint8_t index)
117{
118 unsigned char buffer[EVGA_PERIPHERAL_PACKET_SIZE] =
119 {
120 0x00, /* report id - must be 0x00 according to hid_send_feature_report */
121 0x00, 0x00, 0x00, 0x1D, /* header bits - always the same */
122 0x02, 0x81, 0x01 /* 0x81 sets the mode, which is specified below. */
123 };
124
125 buffer[EVGA_PERIPHERAL_LED_INDEX_BYTE] = index;
126 buffer[EVGA_PERIPHERAL_MODE_BYTE] = mode;
127 int err = hid_send_feature_report(dev, buffer, EVGA_PERIPHERAL_PACKET_SIZE);
128 if(err == -1)
129 {
130 const wchar_t* err_str = hid_error(dev);
131 LOG_DEBUG("[%s] Error writing buffer %s", device_name.c_str(), err_str);
132 }
133 led_states[index].mode = mode;
134 err = hid_get_feature_report(dev, buffer, EVGA_PERIPHERAL_PACKET_SIZE);
135 if(err == -1)
136 {
137 const wchar_t* err_str = hid_error(dev);
138 LOG_DEBUG("[%s] Error reading buffer %s", device_name.c_str(), err_str);
139 }
140}
141
142void EVGAMouseController::SetLed(uint8_t index, uint8_t brightness, uint8_t speed, RGBColor color)
143{

Callers 2

DeviceUpdateModeMethod · 0.45
DeviceUpdateModeMethod · 0.45

Calls 3

hid_send_feature_reportFunction · 0.85
hid_errorFunction · 0.85
hid_get_feature_reportFunction · 0.85

Tested by

no test coverage detected