Skip to content

Commit

Permalink
Add Hyper X Cloud 3 Wired
Browse files Browse the repository at this point in the history
Co-Authored-By: Adam Gärdelöv <adam@gardelov.com>
  • Loading branch information
Sapd and AdamGardelov committed May 17, 2024
1 parent 20aee22 commit e7e848e
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ talking. This differs from a simple loopback via PulseAudio as you won't have an
| Corsair Headset Device | x | x | x | x | | | | | | | | |
| HyperX Cloud Alpha Wireless | x | x | | | x | | x | | | | | |
| HyperX Cloud Flight Wireless | | x | | | | | | | | | | |
| HyperX Cloud 3 | x | | | | | | | | | | | |
| Logitech G430 | x | | | | | | | | | | | |
| Logitech G432/G433 | x | | | | | | | | | | | |
| Logitech G533 | x | x | | | x | | | | | | | |
Expand Down
2 changes: 2 additions & 0 deletions src/device_registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "devices/headsetcontrol_test.h"
#include "devices/hyperx_calphaw.h"
#include "devices/hyperx_cflight.h"
#include "devices/hyperx_cloud_3.h"
#include "devices/logitech_g430.h"
#include "devices/logitech_g432.h"
#include "devices/logitech_g533.h"
Expand Down Expand Up @@ -42,6 +43,7 @@ void init_devices()
// HyperX
add_device(calphaw_init);
add_device(cflight_init);
add_device(hyperx_cloud3_init);
// Logitech
add_device(g430_init);
add_device(g432_init);
Expand Down
2 changes: 2 additions & 0 deletions src/devices/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ set(SOURCE_FILES ${SOURCE_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/hyperx_cflight.h
${CMAKE_CURRENT_SOURCE_DIR}/hyperx_calphaw.c
${CMAKE_CURRENT_SOURCE_DIR}/hyperx_calphaw.h
${CMAKE_CURRENT_SOURCE_DIR}/hyperx_cloud_3.c
${CMAKE_CURRENT_SOURCE_DIR}/hyperx_cloud_3.h
${CMAKE_CURRENT_SOURCE_DIR}/corsair_void.c
${CMAKE_CURRENT_SOURCE_DIR}/corsair_void.h
${CMAKE_CURRENT_SOURCE_DIR}/logitech_g930.c
Expand Down
39 changes: 39 additions & 0 deletions src/devices/hyperx_cloud_3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "../device.h"
#include "../utility.h"

#include <hidapi.h>
#include <stdlib.h>
#include <string.h>

#define VENDOR_HYPERX_CLOUD 0x03f0
#define ID_CLOUD3_WIRE 0x089d

static struct device device_c3;

static const uint16_t PRODUCT_IDS[] = { ID_CLOUD3_WIRE };

static int hyperx_cloud3_send_sidetone(hid_device* device_handle, uint8_t num);

void hyperx_cloud3_init(struct device** device)
{
device_c3.idVendor = VENDOR_HYPERX_CLOUD;
device_c3.idProductsSupported = PRODUCT_IDS;
device_c3.numIdProducts = sizeof(PRODUCT_IDS) / sizeof(PRODUCT_IDS[0]);
strncpy(device_c3.device_name, "HyperX Cloud 3", sizeof(device_c3.device_name));

device_c3.capabilities = B(CAP_SIDETONE);
device_c3.send_sidetone = &hyperx_cloud3_send_sidetone;

*device = &device_c3;
}

static int hyperx_cloud3_send_sidetone(hid_device* device_handle, uint8_t num)
{
// Supports only on/off
int on = num > 0 ? 1 : 0;

#define MSG_SIZE 62
uint8_t data[MSG_SIZE] = { 0x20, 0x86, on };

return hid_send_feature_report(device_handle, data, MSG_SIZE);
}
1 change: 1 addition & 0 deletions src/devices/hyperx_cloud_3.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void hyperx_cloud3_init(struct device** device);

0 comments on commit e7e848e

Please sign in to comment.