driver: g-wolves htx added wireless
This commit is contained in:
parent
252206764b
commit
a758542b6e
@ -1,10 +1,23 @@
|
||||
#include "htx.h"
|
||||
|
||||
static int htx_send_command(libusb_device_handle* hand, uint8_t command, uint8_t size, void* report)
|
||||
static int htx_send_command(libusb_device_handle* hand, uint8_t command, uint8_t size, void* report, bool wireless)
|
||||
{
|
||||
if(wireless)
|
||||
{
|
||||
// If wireless, ask receiver for mouse command first
|
||||
struct HTX_REPORT_WIRELESS w_report = {0};
|
||||
int res = htx_send_command(hand, COMMAND_WIRELESS_MOUSE, REPORT_WIRELESS_MOUSE_SIZE, &w_report, false);
|
||||
if(res <= 0) return res;
|
||||
|
||||
if(!w_report.mouse_connected)
|
||||
return -1;
|
||||
}
|
||||
|
||||
htx_report_header_t* head = report;
|
||||
head->report_size = size;
|
||||
head->command = command;
|
||||
if(wireless)
|
||||
head->wireless = 0x1;
|
||||
|
||||
// Send command
|
||||
int res = libusb_control_transfer(hand,
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <libusb.h>
|
||||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define DEVICE_VENDOR_ID 0x33e4
|
||||
#define DEVICE_PRODUCT_ID_WIRED 0x5708
|
||||
@ -25,6 +26,7 @@
|
||||
#define REPORT_MOTION_SYNC_SIZE 0x1
|
||||
#define REPORT_UNKNOWN_6_SIZE 0x5
|
||||
#define REPORT_BATTERY_SIZE 0x2
|
||||
#define REPORT_WIRELESS_MOUSE_SIZE 0x1
|
||||
|
||||
#define COMMAND_UNKNOWN_0 0x82
|
||||
#define COMMAND_DPI_SETTINGS 0x83
|
||||
@ -36,6 +38,7 @@
|
||||
#define COMMAND_MOTION_SYNC 0x91
|
||||
#define COMMAND_UNKNOWN_6 0x98
|
||||
#define COMMAND_BATTERY 0x8F
|
||||
#define COMMAND_WIRELESS_MOUSE 0x90 // -> send the next report to mouse, checking if mouse is connected
|
||||
|
||||
typedef struct HTX_DPI_LEVEL
|
||||
{
|
||||
@ -57,7 +60,7 @@ typedef struct HTX_REPORT_HEADER
|
||||
|
||||
uint8_t report_size; // report size, after header
|
||||
uint8_t command; // COMMAND
|
||||
uint8_t zero; // report ? other ?
|
||||
uint8_t wireless; // 0 on wired, 1 on wireless
|
||||
} __attribute__((packed)) htx_report_header_t;
|
||||
|
||||
struct HTX_REPORT_DPI_SETTINGS
|
||||
@ -156,3 +159,11 @@ struct HTX_REPORT_BATTERY
|
||||
|
||||
uint8_t zeros[REPORT_MAX_SIZE - sizeof(htx_report_header_t) - 2];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct HTX_REPORT_WIRELESS
|
||||
{
|
||||
htx_report_header_t header;
|
||||
|
||||
uint8_t mouse_connected; // 0 if disconnected, else 1
|
||||
uint8_t zeros[REPORT_MAX_SIZE - sizeof(htx_report_header_t) - 1];
|
||||
} __attribute__((packed));
|
||||
|
Loading…
Reference in New Issue
Block a user