1 /* 2 * This file is part of OpenCorsairLink. 3 * Copyright (C) 2017-2019 Sean Nelson <audiohacked@gmail.com> 4 5 * OpenCorsairLink is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 2 of the License, or 8 * any later version. 9 10 * OpenCorsairLink is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 15 * You should have received a copy of the GNU General Public License 16 * along with OpenCorsairLink. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef _PROTOCOL_COOLIT_H 20 #define _PROTOCOL_COOLIT_H 21 22 #define CoolitCoolingNode 0x38 23 #define CoolitH100 0x3a 24 #define CoolitH100i 0x3c 25 #define CoolitH100iGT 0x40 26 #define CoolitH110i 0x42 27 #define CoolitH110iGT 0x41 28 #define CoolitH80 0x37 29 #define CoolitH80i 0x3b 30 #define CoolitLightingNode 0x39 31 #define CoolitWhiptail 0x3d 32 33 enum COOLIT_Commands 34 { 35 DeviceID = 0x00, 36 FirmwareID = 0x01, 37 ProductName = 0x02, 38 Status = 0x03, 39 LED_SelectCurrent = 0x04, 40 LED_Count = 0x05, 41 LED_Mode = 0x06, 42 LED_CurrentColor = 0x07, 43 LED_TemperatureColor = 0x08, 44 LED_TemperatureMode = 0x09, 45 LED_TemperatureModeColors = 0x0A, 46 LED_CycleColors = 0x0B, 47 TEMP_SelectActiveSensor = 0x0C, 48 TEMP_CountSensors = 0x0D, 49 TEMP_Read = 0x0E, 50 TEMP_Limit = 0x0F, 51 FAN_Select = 0x10, 52 FAN_Count = 0x11, 53 FAN_Mode = 0x12, 54 FAN_FixedPWM = 0x13, 55 FAN_FixedRPM = 0x14, 56 FAN_ReportExtTemp = 0x15, 57 FAN_ReadRPM = 0x16, 58 FAN_MaxRecordedRPM = 0x17, 59 FAN_UnderSpeedThreshold = 0x18, 60 FAN_RPMTable = 0x19, 61 FAN_TempTable = 0x1A 62 }; 63 64 enum COOLIT_Op_Codes 65 { 66 WriteOneByte = 0x06, 67 ReadOneByte = 0x07, 68 WriteTwoBytes = 0x08, 69 ReadTwoBytes = 0x09, 70 WriteThreeBytes = 0x0A, 71 ReadThreeBytes = 0x0B, 72 }; 73 74 enum COOLIT_Led_Modes 75 { 76 StaticColor = 0x00, 77 TwoColorCycle = 0x40, 78 FourColorCycle = 0x80, 79 TemperatureColor = 0xC0 80 }; 81 82 enum COOLIT_Fan_Modes 83 { 84 COOLIT_FixedPWM = 0x02, 85 COOLIT_FixedRPM = 0x04, 86 COOLIT_Default = 0x06, 87 COOLIT_Quiet = 0x08, 88 COOLIT_Balanced = 0x0A, 89 COOLIT_Performance = 0x0C, 90 COOLIT_Custom = 0x0E 91 }; 92 93 static uint8_t CommandId = 0x81; 94 95 #define COOLIT_FAN_TABLE_QUIET( x ) \ 96 x[0].temperature = 0x14; \ 97 x[1].temperature = 0x20; \ 98 x[2].temperature = 0x28; \ 99 x[3].temperature = 0x32; \ 100 x[4].temperature = 0x37; \ 101 x[5].temperature = 0x3c; \ 102 x[0].speed = 0x19; \ 103 x[1].speed = 0x27; \ 104 x[2].speed = 0x32; \ 105 x[3].speed = 0x4b; \ 106 x[4].speed = 0x5a; \ 107 x[5].speed = 0x64; 108 109 #define COOLIT_FAN_TABLE_EXTREME( x ) \ 110 x[0].temperature = 0x14; \ 111 x[1].temperature = 0x19; \ 112 x[2].temperature = 0x1e; \ 113 x[3].temperature = 0x24; \ 114 x[4].temperature = 0x30; \ 115 x[5].temperature = 0x3c; \ 116 x[0].speed = 0x32; \ 117 x[1].speed = 0x32; \ 118 x[2].speed = 0x4b; \ 119 x[3].speed = 0x55; \ 120 x[4].speed = 0x5d; \ 121 x[5].speed = 0x64; 122 123 int 124 corsairlink_coolit_device_id( 125 struct corsair_device_info* dev, struct libusb_device_handle* handle, uint8_t* device_id ); 126 127 int 128 corsairlink_coolit_name( 129 struct corsair_device_info* dev, 130 struct libusb_device_handle* handle, 131 char* name, 132 uint8_t name_size ); 133 134 int 135 corsairlink_coolit_vendor( 136 struct corsair_device_info* dev, 137 struct libusb_device_handle* handle, 138 char* name, 139 uint8_t name_size ); 140 141 int 142 corsairlink_coolit_product( 143 struct corsair_device_info* dev, 144 struct libusb_device_handle* handle, 145 char* name, 146 uint8_t name_size ); 147 148 int 149 corsairlink_coolit_firmware_id( 150 struct corsair_device_info* dev, 151 struct libusb_device_handle* handle, 152 char* firmware, 153 uint8_t firmware_size ); 154 155 int 156 corsairlink_coolit_change_led( 157 struct corsair_device_info* dev, 158 struct libusb_device_handle* handle, 159 struct led_control* ctrl ); 160 161 /* Temperature */ 162 int 163 corsairlink_coolit_temperature( 164 struct corsair_device_info* dev, 165 struct libusb_device_handle* handle, 166 uint8_t selector, 167 double* temperature ); 168 169 int 170 corsairlink_coolit_tempsensorscount( 171 struct corsair_device_info* dev, 172 struct libusb_device_handle* handle, 173 uint8_t* temperature_sensors_count ); 174 175 /* Fan */ 176 int 177 corsairlink_coolit_fan_count( 178 struct corsair_device_info* dev, 179 struct libusb_device_handle* handle, 180 struct fan_control* ctrl ); 181 182 int 183 corsairlink_coolit_fan_mode_read( 184 struct corsair_device_info* dev, 185 struct libusb_device_handle* handle, 186 struct fan_control* ctrl ); 187 188 int 189 corsairlink_coolit_fan_mode_read_rpm( 190 struct corsair_device_info* dev, 191 struct libusb_device_handle* handle, 192 struct fan_control* ctrl ); 193 194 int 195 corsairlink_coolit_fan_mode_read_pwm( 196 struct corsair_device_info* dev, 197 struct libusb_device_handle* handle, 198 struct fan_control* ctrl ); 199 200 int 201 corsairlink_coolit_fan_mode_default( 202 struct corsair_device_info* dev, 203 struct libusb_device_handle* handle, 204 struct fan_control* ctrl ); 205 206 int 207 corsairlink_coolit_fan_mode_performance( 208 struct corsair_device_info* dev, 209 struct libusb_device_handle* handle, 210 struct fan_control* ctrl ); 211 212 int 213 corsairlink_coolit_fan_mode_balanced( 214 struct corsair_device_info* dev, 215 struct libusb_device_handle* handle, 216 struct fan_control* ctrl ); 217 218 int 219 corsairlink_coolit_fan_mode_quiet( 220 struct corsair_device_info* dev, 221 struct libusb_device_handle* handle, 222 struct fan_control* ctrl ); 223 224 int 225 corsairlink_coolit_fan_mode_rpm( 226 struct corsair_device_info* dev, 227 struct libusb_device_handle* handle, 228 struct fan_control* ctrl ); 229 230 int 231 corsairlink_coolit_fan_mode_pwm( 232 struct corsair_device_info* dev, 233 struct libusb_device_handle* handle, 234 struct fan_control* ctrl ); 235 236 int 237 corsairlink_coolit_fan_mode_custom( 238 struct corsair_device_info* dev, 239 struct libusb_device_handle* handle, 240 struct fan_control* ctrl ); 241 242 int 243 corsairlink_coolit_fan_curve( 244 struct corsair_device_info* dev, 245 struct libusb_device_handle* handle, 246 struct fan_control* ctrl ); 247 248 int 249 corsairlink_coolit_fan_speed( 250 struct corsair_device_info* dev, 251 struct libusb_device_handle* handle, 252 struct fan_control* ctrl ); 253 254 int 255 corsairlink_coolit_fan_print_mode( 256 uint8_t mode, uint16_t data, char* modestr, uint8_t modestr_size ); 257 258 /* Pump */ 259 int 260 corsairlink_coolit_pump_mode( 261 struct corsair_device_info* dev, 262 struct libusb_device_handle* handle, 263 struct pump_control* ctrl ); 264 265 int 266 corsairlink_coolit_pump_mode_read( 267 struct corsair_device_info* dev, 268 struct libusb_device_handle* handle, 269 struct pump_control* ctrl ); 270 271 int 272 corsairlink_coolit_pump_mode_default( 273 struct corsair_device_info* dev, 274 struct libusb_device_handle* handle, 275 struct pump_control* ctrl ); 276 277 int 278 corsairlink_coolit_pump_mode_quiet( 279 struct corsair_device_info* dev, 280 struct libusb_device_handle* handle, 281 struct pump_control* ctrl ); 282 283 int 284 corsairlink_coolit_pump_mode_balanced( 285 struct corsair_device_info* dev, 286 struct libusb_device_handle* handle, 287 struct pump_control* ctrl ); 288 289 int 290 corsairlink_coolit_pump_mode_performance( 291 struct corsair_device_info* dev, 292 struct libusb_device_handle* handle, 293 struct pump_control* ctrl ); 294 295 int 296 corsairlink_coolit_pump_mode_custom( 297 struct corsair_device_info* dev, 298 struct libusb_device_handle* handle, 299 struct pump_control* ctrl ); 300 301 int 302 corsairlink_coolit_pump_curve( 303 struct corsair_device_info* dev, 304 struct libusb_device_handle* handle, 305 struct pump_control* ctrl ); 306 307 int 308 corsairlink_coolit_pump_speed( 309 struct corsair_device_info* dev, 310 struct libusb_device_handle* handle, 311 struct pump_control* ctrl ); 312 313 #endif 314