Motion sync loaded in UI, support in g-wolves

This commit is contained in:
2023-09-30 23:50:33 +02:00
parent a12e682eda
commit 22cb968b64
3 changed files with 41 additions and 1 deletions

View File

@@ -183,3 +183,31 @@ int driver_mouse_dpi_get(void* handle, struct MOUSE_DPI_LEVELS* output)
libusb_close(hand);
return 0;
}
int driver_mouse_motion_sync_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_MOTION_SYNC report = {0};
bool wireless = false;
if(driver_get_capacity(handle) & DEVICE_CAPACITY_WIRELESS) wireless = true;
int res = send_command(hand, COMMAND_MOTION_SYNC, REPORT_MOTION_SYNC_SIZE, &report, wireless);
if(res <= 0) return -1;
// Format output boolean
*output = report.motion_sync;
// Close and return
libusb_attach_kernel_driver(hand, 0x2);
libusb_close(hand);
return 0;
}