dualsensectl icon indicating copy to clipboard operation
dualsensectl copied to clipboard

[BUG] Command `lightbar on` overrides command `lightbar [0-255]` -> Remains ONLY BLUE

Open MartinVonReichenberg opened this issue 3 years ago • 4 comments

As mentioned, dualsensectl lightbar on overrides dualsensectl lightbar 255 255 255 255 -> WHITE colour this makes changing colors and brightness on the controller impossible . . . The only way to change colors is to use dualsensectl lightbar off and then dualsensectl lightbar [0-255] ................... dualsensectl lightbar 0 0 0 0 turns off the lightbar too, but in another sense.

  • My DualSense version: 0307

MartinVonReichenberg avatar Nov 20 '22 15:11 MartinVonReichenberg

Does this help?

diff --git a/main.c b/main.c
index dfe9f3a..a163320 100644
--- a/main.c
+++ b/main.c
@@ -489,6 +489,9 @@ static int command_lightbar3(struct dualsense *ds, uint8_t red, uint8_t green, u
     rp.common->lightbar_green = brightness * green / max_brightness;
     rp.common->lightbar_blue = brightness * blue / max_brightness;
 
+    rp.common->valid_flag2 = DS_OUTPUT_VALID_FLAG2_LIGHTBAR_SETUP_CONTROL_ENABLE;
+    rp.common->lightbar_setup = DS_OUTPUT_LIGHTBAR_SETUP_LIGHT_ON;
+
     dualsense_send_output_report(ds, &rp);
 
     return 0;

nowrep avatar Dec 27 '22 17:12 nowrep

I do not entirely understand ...

Did you remove lines 480-488:

{
    struct dualsense_output_report rp;
    uint8_t rbuf[DS_OUTPUT_REPORT_BT_SIZE];
    dualsense_init_output_report(ds, &rp, rbuf);

    uint8_t max_brightness = 255;

    rp.common->valid_flag1 = DS_OUTPUT_VALID_FLAG1_LIGHTBAR_CONTROL_ENABLE;
    rp.common->lightbar_red = brightness * red / max_brightness;

Then moved from 479 to 488:

static int command_lightbar3(struct dualsense *ds, uint8_t red, uint8_t green, u

And added 492-493:

rp.common->valid_flag2 = DS_OUTPUT_VALID_FLAG2_LIGHTBAR_SETUP_CONTROL_ENABLE;
rp.common->lightbar_setup = DS_OUTPUT_LIGHTBAR_SETUP_LIGHT_ON;

Because I added 492-493:

rp.common->valid_flag2 = DS_OUTPUT_VALID_FLAG2_LIGHTBAR_SETUP_CONTROL_ENABLE;
rp.common->lightbar_setup = DS_OUTPUT_LIGHTBAR_SETUP_LIGHT_ON;

After 479-490:

static int command_lightbar3(struct dualsense *ds, uint8_t red, uint8_t green, uint8_t blue, uint8_t brightness)
{
    struct dualsense_output_report rp;
    uint8_t rbuf[DS_OUTPUT_REPORT_BT_SIZE];
    dualsense_init_output_report(ds, &rp, rbuf);

    uint8_t max_brightness = 255;

    rp.common->valid_flag1 = DS_OUTPUT_VALID_FLAG1_LIGHTBAR_CONTROL_ENABLE;
    rp.common->lightbar_red = brightness * red / max_brightness;
    rp.common->lightbar_green = brightness * green / max_brightness;
    rp.common->lightbar_blue = brightness * blue / max_brightness;
  • And it does not work, the lightbar remains either turned off or on and in blue color only . . .

Please send the fully changed file main.c as .txt in the attachment so I can see it more clearly . . .

main.c.txt

MartinVonReichenberg avatar Jan 02 '23 11:01 MartinVonReichenberg

That patch doesn't work.

It needs to query the current state (=color) to avoid overwriting previously set values.

nowrep avatar Jul 31 '23 12:07 nowrep

Have the same issue

hardware: 617, firmware: 1050024 build_date: Dec 16 2022, build_time: 17:00:32 fw_type: 2, sw_series 4

sTiKyt avatar Feb 28 '24 05:02 sTiKyt