aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-07-28 03:09:45 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2016-07-28 03:09:45 +0200
commit72fb3369c7908b94f42026b0c551c225de6fe112 (patch)
treec4cd677e21245061334e0bb935404f582442eda0
parent578e3d8c40de8943b26d2777512f7d95da739708 (diff)
downloadsensei-raw-ctl-72fb3369c7908b94f42026b0c551c225de6fe112.tar.gz
sensei-raw-ctl-72fb3369c7908b94f42026b0c551c225de6fe112.tar.xz
sensei-raw-ctl-72fb3369c7908b94f42026b0c551c225de6fe112.zip
Fix LIBUSB_ERROR_PIPE
It should have been obvious, shouldn't it.
-rw-r--r--sensei-raw-ctl.c7
1 files changed, 6 insertions, 1 deletions
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 <p.janouch@gmail.com>
+ * Copyright (c) 2013 - 2016, Přemysl Janouch <p.janouch@gmail.com>
* All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -28,6 +28,7 @@
#include <string.h>
#include <stdbool.h>
#include <assert.h>
+#include <time.h>
#include <getopt.h>
#include <strings.h>
@@ -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);