Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ talking. This differs from a simple loopback via PulseAudio as you won't have an
- Sidetone (only tested on Linux)
- Logitech G533
- Sidetone, Battery (for Wireless)
- Logitech G535
- Sidetone (only tested on Linux)
- Logitech G633 / G635 / G733 / G933 / G935
- Sidetone, Battery (for Wireless), LED on/off
- Logitech G930
Expand Down
4 changes: 3 additions & 1 deletion src/device_registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "devices/logitech_g430.h"
#include "devices/logitech_g432.h"
#include "devices/logitech_g533.h"
#include "devices/logitech_g535.h"
#include "devices/logitech_g633_g933_935.h"
#include "devices/logitech_g930.h"
#include "devices/logitech_gpro.h"
Expand All @@ -19,7 +20,7 @@

#include <string.h>

#define NUMDEVICES 16
#define NUMDEVICES 17

// array of pointers to device
static struct device*(devicelist[NUMDEVICES]);
Expand All @@ -42,6 +43,7 @@ void init_devices()
elo71USB_init(&devicelist[13]);
arctis_7_plus_init(&devicelist[14]);
cflight_init(&devicelist[15]);
g535_init(&devicelist[16]);
}

int get_device(struct device* device_found, uint16_t idVendor, uint16_t idProduct)
Expand Down
2 changes: 2 additions & 0 deletions src/devices/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ set(SOURCE_FILES ${SOURCE_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/logitech_g432.h
${CMAKE_CURRENT_SOURCE_DIR}/logitech_g533.c
${CMAKE_CURRENT_SOURCE_DIR}/logitech_g533.h
${CMAKE_CURRENT_SOURCE_DIR}/logitech_g535.c
${CMAKE_CURRENT_SOURCE_DIR}/logitech_g535.h
${CMAKE_CURRENT_SOURCE_DIR}/steelseries_arctis_1.c
${CMAKE_CURRENT_SOURCE_DIR}/steelseries_arctis_1.h
${CMAKE_CURRENT_SOURCE_DIR}/steelseries_arctis_7.c
Expand Down
41 changes: 41 additions & 0 deletions src/devices/logitech_g535.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "../device.h"
#include "../utility.h"
#include "logitech.h"

#include <math.h>
#include <string.h>

#define MSG_SIZE 20

static struct device device_g535;

static const uint16_t PRODUCT_ID = 0x0ac4;

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

void g535_init(struct device** device)
{
device_g535.idVendor = VENDOR_LOGITECH;
device_g535.idProductsSupported = &PRODUCT_ID;
device_g535.numIdProducts = 1;

strncpy(device_g535.device_name, "Logitech G535", sizeof(device_g535.device_name));

device_g535.capabilities = B(CAP_SIDETONE);
device_g535.capability_details[CAP_SIDETONE] = (struct capability_detail) { .usagepage = 0xc, .usageid = 0x1, .interface = 3 };
device_g535.send_sidetone = &g535_send_sidetone;

*device = &device_g535;
}

static int g535_send_sidetone(hid_device* device_handle, uint8_t num)
{
num = map(num, 0, 128, 0, 100);

uint8_t set_sidetone_level[MSG_SIZE] = { 0x11, 0xff, 0x04, 0x1e, num };

for (int i = 16; i < MSG_SIZE; i++)
set_sidetone_level[i] = 0;

return hid_send_feature_report(device_handle, set_sidetone_level, MSG_SIZE);
}
3 changes: 3 additions & 0 deletions src/devices/logitech_g535.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

void g535_init(struct device** device);