#include "htx.h" 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, 0x21, // request type 0x09, // request (SET_REPORT) 0x300, // wValue (FEATURE << 8 | REPORT(0)) 0x2, // wIndex = 0x2 : interface report, REPORT_MAX_SIZE, // wLength = 64 0 /* timeout*/); if(res <= 0) return res; // Get response report res = libusb_control_transfer(hand, 0xa1, // request type 0x01, // request (GET_REPORT) 0x300, // wValue (FEATURE << 8 | REPORT(0)) 0x2, // wIndex = 0x2 : interface report, REPORT_MAX_SIZE, // wLength = 64 0); return res; } void driver_init(void) {} uint32_t driver_getkey(void) { static int count = 0; count++; if(count == 1) return (DEVICE_VENDOR_ID << 16) | DEVICE_PRODUCT_ID_WIRED; else if(count == 2) return (DEVICE_VENDOR_ID << 16) | DEVICE_PRODUCT_ID_WIRELESS; return 0; } char* driver_get_name(void* handle) { libusb_device* dev = handle; struct libusb_device_descriptor desc; libusb_get_device_descriptor(dev, &desc); switch(desc.idProduct) { case 0x5708: case 0x5707: return "HTX 4K"; default: return "HTX ACE"; } } char* driver_get_image(void* handle) { return "drivers/assets/gwolves-htx.png"; }