|
|
|
@ -1,5 +1,7 @@ |
|
|
|
|
#include "g-wolves.h" |
|
|
|
|
|
|
|
|
|
#define DEVICE_WIRELESS(handle) (driver_get_capacity(handle) & DEVICE_CAPACITY_WIRELESS) |
|
|
|
|
|
|
|
|
|
static int send_command(libusb_device_handle* hand, uint8_t command, uint8_t size, void* report, bool wireless) |
|
|
|
|
{ |
|
|
|
|
report_header_t* head = report; |
|
|
|
@ -157,11 +159,7 @@ int driver_mouse_dpi_get(void* handle, struct MOUSE_DPI_LEVELS* output) |
|
|
|
|
|
|
|
|
|
// Send command
|
|
|
|
|
struct REPORT_DPI_SETTINGS report = {0}; |
|
|
|
|
|
|
|
|
|
bool wireless = false; |
|
|
|
|
if(driver_get_capacity(handle) & DEVICE_CAPACITY_WIRELESS) wireless = true; |
|
|
|
|
|
|
|
|
|
int res = send_command(hand, COMMAND_DPI_SETTINGS, REPORT_DPI_SETTINGS_SIZE, &report, wireless); |
|
|
|
|
int res = send_command(hand, COMMAND_DPI_SETTINGS, REPORT_DPI_SETTINGS_SIZE, &report, DEVICE_WIRELESS(handle)); |
|
|
|
|
if(res <= 0) return -1; |
|
|
|
|
|
|
|
|
|
// Format 'output' packet
|
|
|
|
@ -196,15 +194,35 @@ int driver_mouse_motion_sync_get(void* handle, bool* output) |
|
|
|
|
|
|
|
|
|
// Send command
|
|
|
|
|
struct REPORT_MOTION_SYNC report = {0}; |
|
|
|
|
int res = send_command(hand, COMMAND_MOTION_SYNC, REPORT_MOTION_SYNC_SIZE, &report, DEVICE_WIRELESS(handle)); |
|
|
|
|
if(res <= 0) return -1; |
|
|
|
|
|
|
|
|
|
bool wireless = false; |
|
|
|
|
if(driver_get_capacity(handle) & DEVICE_CAPACITY_WIRELESS) wireless = true; |
|
|
|
|
// Format output boolean
|
|
|
|
|
*output = report.motion_sync; |
|
|
|
|
|
|
|
|
|
// Close and return
|
|
|
|
|
libusb_attach_kernel_driver(hand, 0x2); |
|
|
|
|
libusb_close(hand); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int res = send_command(hand, COMMAND_MOTION_SYNC, REPORT_MOTION_SYNC_SIZE, &report, wireless); |
|
|
|
|
int driver_mouse_angle_snap_get(void* handle, bool* output) |
|
|
|
|
{ |
|
|
|
|
libusb_device* dev = handle; |
|
|
|
|
|
|
|
|
|
// Prepare usb device for transfer
|
|
|
|
|
libusb_device_handle* hand; |
|
|
|
|
int openres = libusb_open(dev, &hand); |
|
|
|
|
if(openres) return -1; |
|
|
|
|
libusb_detach_kernel_driver(hand, 0x2); |
|
|
|
|
|
|
|
|
|
// Send command
|
|
|
|
|
struct REPORT_ANGLE_SNAP report = {0}; |
|
|
|
|
int res = send_command(hand, COMMAND_ANGLE_SNAP, REPORT_ANGLE_SNAP_SIZE, &report, DEVICE_WIRELESS(handle)); |
|
|
|
|
if(res <= 0) return -1; |
|
|
|
|
|
|
|
|
|
// Format output boolean
|
|
|
|
|
*output = report.motion_sync; |
|
|
|
|
*output = report.angle_snap; |
|
|
|
|
|
|
|
|
|
// Close and return
|
|
|
|
|
libusb_attach_kernel_driver(hand, 0x2); |
|
|
|
|