From 72fb3369c7908b94f42026b0c551c225de6fe112 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Thu, 28 Jul 2016 03:09:45 +0200
Subject: Fix LIBUSB_ERROR_PIPE
It should have been obvious, shouldn't it.
---
sensei-raw-ctl.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sensei-raw-ctl.c b/sensei-raw-ctl.c
index 47c8719..958d858 100644
--- a/sensei-raw-ctl.c
+++ b/sensei-raw-ctl.c
@@ -6,7 +6,7 @@
*
* The code might be a bit long but does very little; most of it is UI.
*
- * Copyright (c) 2013, Přemysl Janouch
+ * Copyright (c) 2013 - 2016, Přemysl Janouch
* All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
#include
#include
@@ -171,6 +172,10 @@ static int
sensei_send_command (libusb_device_handle *device,
unsigned char *data, uint16_t length)
{
+ // We can't just flood the mouse with requests, a 1ms pause is appropriate
+ struct timespec req = { .tv_sec = 0, .tv_nsec = 1000 * 1000 };
+ (void) nanosleep (&req, NULL);
+
int result = libusb_control_transfer (device, LIBUSB_ENDPOINT_OUT
| LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE,
USB_SET_REPORT, 0x0200, 0x0000, data, length, 0);
--
cgit v1.2.3-70-g09d2