forked from hyperkineticnerd/OpenCorsairLink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RM750i protocol Add Power Supply support
- Loading branch information
1 parent
6210563
commit 4ad9080
Showing
11 changed files
with
403 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* This file is part of OpenCorsairLink. | ||
* Copyright (C) 2017 Sean Nelson <[email protected]> | ||
* OpenCorsairLink is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 2 of the License, or | ||
* any later version. | ||
* OpenCorsairLink is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with OpenCorsairLink. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <libusb.h> | ||
#include "../lowlevel/rmi.h" | ||
|
||
#define TIMEOUT_DEFAULT 1000 | ||
#define INTERRUPT_IN_ENDPOINT 0x81 | ||
#define INTERRUPT_OUT_ENDPOINT 0x01 | ||
|
||
int corsairlink_rmi_init(struct libusb_device_handle *dev_handle, | ||
uint8_t endpoint) | ||
{ | ||
return 0; | ||
} | ||
|
||
int corsairlink_rmi_deinit(struct libusb_device_handle *dev_handle, | ||
uint8_t endpoint) | ||
{ | ||
return 0; | ||
} | ||
|
||
int corsairlink_rmi_write(struct libusb_device_handle *dev_handle, | ||
uint8_t endpoint, | ||
uint8_t *data, | ||
int length) | ||
{ | ||
int bytes_transferred; | ||
int r; | ||
|
||
r = libusb_interrupt_transfer(dev_handle, | ||
endpoint, | ||
data, length, | ||
&bytes_transfered, TIMEOUT_DEFAULT); | ||
|
||
return r; | ||
} | ||
|
||
int corsairlink_rmi_read(struct libusb_device_handle *dev_handle, | ||
uint8_t endpoint, | ||
uint8_t *data, | ||
int length) | ||
{ | ||
int bytes_transferred; | ||
int r; | ||
|
||
r = libusb_interrupt_transfer(dev_handle, | ||
endpoint, | ||
data, length, | ||
&bytes_transferred, TIMEOUT_DEFAULT); | ||
|
||
return r; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* This file is part of OpenCorsairLink. | ||
* Copyright (C) 2017 Sean Nelson <[email protected]> | ||
* OpenCorsairLink is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 2 of the License, or | ||
* any later version. | ||
* OpenCorsairLink is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with OpenCorsairLink. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef _LOWLEVEL_RMI_H | ||
#define _LOWLEVEL_RMI_H | ||
|
||
int corsairlink_rmi_init(struct libusb_device_handle *dev_handle, | ||
uint8_t endpoint); | ||
|
||
int corsairlink_rmi_deinit(struct libusb_device_handle *dev_handle, | ||
uint8_t endpoint); | ||
|
||
int corsairlink_rmi_write(struct libusb_device_handle *dev_handle, | ||
uint8_t endpoint, | ||
uint8_t *data, | ||
int length); | ||
|
||
int corsairlink_rmi_read(struct libusb_device_handle *dev_handle, | ||
uint8_t endpoint, | ||
uint8_t *data, | ||
int length); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* This file is part of OpenCorsairLink. | ||
* Copyright (C) 2017 Sean Nelson <[email protected]> | ||
* OpenCorsairLink is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 2 of the License, or | ||
* any later version. | ||
* OpenCorsairLink is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with OpenCorsairLink. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <errno.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
#include <string.h> | ||
#include <libusb.h> | ||
|
||
#include "../../lowlevel/hid.h" | ||
#include "../../device.h" | ||
#include "core.h" | ||
|
||
int corsairlink_hid_device_id(struct corsair_device_info *dev) | ||
{ | ||
int r; | ||
uint8_t response[64]; | ||
uint8_t commands[32] ; | ||
memset(response, 0, sizeof(response)); | ||
memset(commands, 0, sizeof(commands)); | ||
|
||
uint8_t i = 1; | ||
|
||
i = 1; | ||
// Read Device ID: 0x3b = H80i. 0x3c = H100i. 0x41 = H110i. 0x42 = H110i Extreme | ||
commands[i++] = CommandId++; // Command ID | ||
commands[i++] = ReadOneByte; // Command Opcode | ||
commands[i++] = DeviceID; // Command data... | ||
commands[i++] = 0x00; | ||
|
||
commands[0] = i; // Length | ||
|
||
r = dev->driver->write(dev->handle, dev->write_endpoint, commands, i); | ||
r = dev->driver->read(dev->handle, dev->read_endpoint, response, 64); | ||
|
||
return response[2]; | ||
} | ||
|
||
int corsairlink_hid_firmware_id(struct corsair_device_info *dev) | ||
{ | ||
int r; | ||
uint8_t response[64]; | ||
uint8_t commands[32] ; | ||
memset(response, 0, sizeof(response)); | ||
memset(commands, 0, sizeof(commands)); | ||
|
||
uint8_t i = 1; | ||
|
||
i = 1; | ||
commands[i++] = CommandId++; // Command ID | ||
commands[i++] = ReadTwoBytes; // Command Opcode | ||
commands[i++] = FirmwareID; // Command data... | ||
commands[i++] = 0x00; | ||
|
||
commands[0] = i; // Length | ||
|
||
r = dev->driver->write(dev->handle, dev->write_endpoint, commands, i); | ||
r = dev->driver->read(dev->handle, dev->read_endpoint, response, 64); | ||
|
||
int firmware = response[3]<<8; | ||
firmware += response[2]; | ||
return firmware; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* This file is part of OpenCorsairLink. | ||
* Copyright (C) 2017 Sean Nelson <[email protected]> | ||
* OpenCorsairLink is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 2 of the License, or | ||
* any later version. | ||
* OpenCorsairLink is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with OpenCorsairLink. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef _PROTOCOL_RMI_H | ||
#define _PROTOCOL_RMI_H | ||
|
||
#include "../../common.h" | ||
|
||
int corsairlink_rmi_device_id(struct corsair_device_info *dev); | ||
int corsairlink_rmi_firmware_id(struct corsair_device_info *dev); | ||
int corsairlink_rmi_channel_id(struct corsair_device_info *dev); | ||
int corsairlink_rmi_product_id(struct corsair_device_info *dev); | ||
|
||
int corsairlink_rmi_output_select(struct corsair_device_info *dev, uint8_t select); | ||
int corsairlink_rmi_output_voltage(struct corsair_device_info *dev, float volts); | ||
int corsairlink_rmi_output_amps(struct corsair_device_info *dev, float amps); | ||
int corsairlink_rmi_output_watts(struct corsair_device_info *dev, float watts); | ||
|
||
int corsairlink_rmi_total_watts(struct corsair_device_info *dev, float watts); | ||
int corsairlink_rmi_supply_volts(struct corsair_device_info *dev, float volts); | ||
|
||
int corsairlink_rmi_temp1(struct corsair_device_info *dev, float temp); | ||
int corsairlink_rmi_temp2(struct corsair_device_info *dev, float temp); | ||
|
||
// int corsairlink_rmi_fan_mode(); | ||
// int corsairlink_rmi_fan_pwm(); | ||
// int corsairlink_rmi_fan_pwm_percent(); | ||
// int corsairlink_rmi_fan_status(); | ||
|
||
#endif |
Empty file.
Oops, something went wrong.