driver: g-wolves full wireless support

master
vhaudiquet 12 months ago
parent c40834b3bf
commit 8c8727504a
  1. 17
      drivers/g-wolves/g-wolves.c

@ -2,23 +2,12 @@
static int send_command(libusb_device_handle* hand, uint8_t command, uint8_t size, void* report, bool wireless) static int 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 REPORT_WIRELESS w_report = {0};
int res = 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;
}
report_header_t* head = report; report_header_t* head = report;
head->report_size = size; head->report_size = size;
head->command = command; head->command = command;
if(wireless) if(wireless)
head->wireless = 0x1; head->wireless = 0x1;
// Send command // Send command
int res = libusb_control_transfer(hand, int res = libusb_control_transfer(hand,
0x21, // request type 0x21, // request type
@ -31,6 +20,10 @@ static int send_command(libusb_device_handle* hand, uint8_t command, uint8_t siz
if(res <= 0) return res; if(res <= 0) return res;
// Wait for mouse if necessary
if(wireless)
usleep(100000);
// Get response report // Get response report
res = libusb_control_transfer(hand, res = libusb_control_transfer(hand,
0xa1, // request type 0xa1, // request type

Loading…
Cancel
Save