andreldm / harpoond

Provides basic support to control Corsair Harpoon Mouse's LEDs.
18 stars 3 forks source link

Possible Bug - DPI Setting #1

Open nbulischeck opened 4 years ago

nbulischeck commented 4 years ago

This issue is looking at the following block:

    transfer(device, 12, device->command_prefix,
         0x06, 0x00, 0x06, 0x00, 0x00, 0x00,
         0x00,  /* Indicator LED's red */
         0x00,  /* Main LED's red */
         0xff,  /* Indicator LED's green */
         0x00,  /* Main LED's green */
         0xff,  /* Indicator LED's blue */
         0x00); /* Main LED's blue */

    transfer(device, 5, 0x01, 0x20, 0x00, 0x08, 0x70); /* Set DPI (708 hex = 1800) */

I'm using the corsair harpoon w/ the wireless dongle and I was able to alter the middle click indicator LED by changing the first transfer, but when attempting to drop the DPI to 500 or even 10 I don't seem to get any change.

I'm on Arch Linux, but libusb is cross-platform so I reckon that shouldn't matter.

I appreciate all the research you're doing on this to get some working cross-platform support for the Harpoon!

andreldm commented 4 years ago

You're right, during the last refactoring I forgot to send the command prefix when setting DPI. Please let me know if f8494dd solves the problem for you.

nbulischeck commented 4 years ago

It occasionally works! - though it seems very hit or miss as to whether it'll actually update the DPI or not.

andreldm commented 4 years ago

Do you mean the same value will work occasionally? or some values work while others don't?

nbulischeck commented 4 years ago

If I set the DPI to 6000 and change the light, the light definitely changes and the DPI might as well. If they both change, I'll kill the program, recompile, edit the light, set the DPI to 1800, and rerun it. Upon rerunning, the light will change as expected, but the DPI will stay at 6000.

andreldm commented 4 years ago

Hi Nick, sorry for the long time to reply. I've noticed that sometimes DPI settings are not properly applied, unfortunately I can't reliably reproduce the problem, while switching between 400 (0xC8 0x00) and 6000 (0x70 0x17) DPI it works fine.

mtoohey31 commented 3 years ago

Hello! Sorry to bring this up here, but I'm not really sure about where to contact you about this, are you able to provide a little more guidance about this line in particular?

    transfer(device, 6, device->command_prefix, 0x01, 0x20, 0x00, 0x08, 0x70); /* Set DPI (708 hex = 1800) */

I've got the service working and changing the lighting, but I don't quite understand how to use the 6 values in that line to change the DPI... I don't know C and I've never dealt with hardware drivers before so I don't really where to begin...

andreldm commented 3 years ago

@mtoohey31 no problem, I have added a clarification note in 73e2215e, hope that helps.

mtoohey31 commented 3 years ago

Yes, thank you very much, now I get it!

catm4n commented 1 year ago

not really a problem but can someone tell me how i would adjust 0x06, 0x00, 0x06, 0x00, 0x00, 0x00 to obtain a solid blue led and indicator?

mtoohey31 commented 1 year ago

Based on the comments, the 0x06, 0x00, 0x06, 0x00, 0x00, 0x00 line isn't supposed to be changed. You'll need to adjust the lines below that one. The following changes should do the trick:

--- a/harpoond.c
+++ b/harpoond.c
@@ -117,10 +117,10 @@ static void init_device(Device *device)
         0x06, 0x00, 0x06, 0x00, 0x00, 0x00, /* Do not change */
         0x00,  /* Indicator LED's red */
         0x00,  /* Main LED's red */
-        0xff,  /* Indicator LED's green */
+        0x00,  /* Indicator LED's green */
         0x00,  /* Main LED's green */
-        0x00,  /* Indicator LED's blue */
-        0x00); /* Main LED's blue */
+        0xff,  /* Indicator LED's blue */
+        0xff); /* Main LED's blue */

     transfer(device, 6, device->command_prefix,
         0x01, 0x20, 0x00, /* Do not change */
catm4n commented 1 year ago

Based on the comments, the 0x06, 0x00, 0x06, 0x00, 0x00, 0x00 line isn't supposed to be changed. You'll need to adjust the lines below that one. The following changes should do the trick:

--- a/harpoond.c
+++ b/harpoond.c
@@ -117,10 +117,10 @@ static void init_device(Device *device)
         0x06, 0x00, 0x06, 0x00, 0x00, 0x00, /* Do not change */
         0x00,  /* Indicator LED's red */
         0x00,  /* Main LED's red */
-        0xff,  /* Indicator LED's green */
+        0x00,  /* Indicator LED's green */
         0x00,  /* Main LED's green */
-        0x00,  /* Indicator LED's blue */
-        0x00); /* Main LED's blue */
+        0xff,  /* Indicator LED's blue */
+        0xff); /* Main LED's blue */

     transfer(device, 6, device->command_prefix,
         0x01, 0x20, 0x00, /* Do not change */

well I'm a dummy.. thank you so much.