diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2014-02-08 01:51:01 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2014-02-08 02:07:09 +0100 |
commit | d034b7bb2a396207b2656b55a89e905a97557801 (patch) | |
tree | bbe6035a298f8b718f642083c38dd6cd60553ee9 | |
parent | 293a36e220b111334e191d4aeca0d4ae13294b94 (diff) | |
download | sensei-raw-ctl-d034b7bb2a396207b2656b55a89e905a97557801.tar.gz sensei-raw-ctl-d034b7bb2a396207b2656b55a89e905a97557801.tar.xz sensei-raw-ctl-d034b7bb2a396207b2656b55a89e905a97557801.zip |
Enhance reliability
After a reboot to Windows, which had applied a different configuration, I wasn't
successful in reapplying the old settings from within Linux in a reliable way so
that they would be loaded by the device on the next reconnect. Writing the
configuration twice in a row seemed to help. This also seems to work. There
might be some timing or what not behind the issue, I don't know.
The GUI tool is a bit prone to quitting on LIBUSB_ERROR_PIPE on my system at
the moment. Not very user-friendly. But I'm tired of inspecting it already,
unplugging and re-plugging in the mouse all the time like an idiot...
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | sensei-raw-ctl.c | 16 |
2 files changed, 13 insertions, 5 deletions
@@ -28,7 +28,7 @@ $ cmake .. -DCMAKE_INSTALL_PREFIX=/usr # make install Note that there's no "make uninstall" and the GUI needs to be installed in the -right location to work correctly. +right location in order to work correctly. If you don't want the GUI frontend, append -DBUILD_GUI=NO to the cmake command. The GUI also isn't going to be built if you don't have the GTK+ 3 development diff --git a/sensei-raw-ctl.c b/sensei-raw-ctl.c index 3c2dbb6..47b0c4f 100644 --- a/sensei-raw-ctl.c +++ b/sensei-raw-ctl.c @@ -189,8 +189,12 @@ static int sensei_set_intensity (libusb_device_handle *device, enum sensei_intensity intensity) { - unsigned char cmd[32] = { 0x05, 0x01, intensity }; - return sensei_send_command (device, cmd, sizeof cmd); + unsigned char cmd_1[32] = { 0x05, 0x01, intensity }; + unsigned char cmd_2[32] = { 0x05, 0x02, intensity }; + unsigned result = sensei_send_command (device, cmd_1, sizeof cmd_1); + if (result < 0) + return result; + return sensei_send_command (device, cmd_2, sizeof cmd_2); } /** Set pulsation speed. */ @@ -198,8 +202,12 @@ static int sensei_set_pulsation (libusb_device_handle *device, enum sensei_pulsation pulsation) { - unsigned char cmd[32] = { 0x07, 0x01, pulsation }; - return sensei_send_command (device, cmd, sizeof cmd); + unsigned char cmd_1[32] = { 0x07, 0x01, pulsation }; + unsigned char cmd_2[32] = { 0x07, 0x02, pulsation }; + unsigned result = sensei_send_command (device, cmd_1, sizeof cmd_1); + if (result < 0) + return result; + return sensei_send_command (device, cmd_2, sizeof cmd_2); } /** Set sensitivity in CPI. */ |