Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support color feature for many devices #2245

Merged
merged 6 commits into from
Feb 9, 2024
Merged

support color feature for many devices #2245

merged 6 commits into from
Feb 9, 2024

Conversation

pfps
Copy link
Collaborator

@pfps pfps commented Feb 7, 2024

This PR adds settings for feature x8070 COLOR LED EFFECTS.

CURRENT VERSION:

Use the Solaar GUI to change effects.

INITIAL VERSION:
To set a color effect, edit ~/.config/solaar/config.yaml, after first running this version of Solaar to have the possible color zones determined. There will a line in the file with key led_zone_n for each color zone. Unfortunately some mice do not report the current effect for the zones so the value is likely to be simple. The information on effects is stored in a slightly different way than for profiles on devices - Solaar uses LEDEffectSetting in profiles and LEDEffectIndexed in config.yaml.

@Svenum
Copy link
Contributor

Svenum commented Feb 8, 2024

Man you are on fire. I will try it later this Day

@pfps pfps changed the title support color feature for many devices (no GUI) support color feature for many devices Feb 8, 2024
@Svenum
Copy link
Contributor

Svenum commented Feb 9, 2024

I tryed the PR and I only see the setting "LED Control". But no Option to change the effekt or rgb value or so. Is this right?

@pfps
Copy link
Collaborator Author

pfps commented Feb 9, 2024

No. You should see several controls for the LED Zones. Please try bin/solaar -ddd look for any errors. If so, post the output. If not, post ~/.config/solaar/config.yaml`.

@pfps
Copy link
Collaborator Author

pfps commented Feb 9, 2024

Maybe the problem is webcolors. Solaar is temporarily picking colors from this Python module so you may have to pip install webcolors.

@Svenum
Copy link
Contributor

Svenum commented Feb 9, 2024

I got this errro:

2024-02-09 13:59:42,347,347    ERROR [ReceiverListener:hidraw7] logitech_receiver.settings_templates: check_feature led_zone_ [COLOR LED EFFECTS] error to_bytes() missing 
required argument 'byteorder' (pos 2)
Traceback (most recent call last):
  File "/nix/store/sywc9lrlfd0xrksjxwll7dz4yjilm4s6-solaar-flake-1.1.10/lib/python3.10/site-packages/logitech_receiver/settings_templates.py", line 1542, in check_feature
    detected = sclass.build(device)
  File "/nix/store/sywc9lrlfd0xrksjxwll7dz4yjilm4s6-solaar-flake-1.1.10/lib/python3.10/site-packages/logitech_receiver/settings_templates.py", line 1463, in build
    prefix = zone.index.to_bytes(1)
TypeError: to_bytes() missing required argument 'byteorder' (pos 2)

webcolors is already installed.

@pfps
Copy link
Collaborator Author

pfps commented Feb 9, 2024

That's weird. to_bytes is supposed to only require one argument, but maybe that is a change in Python 3.11. Yes, I see that this was changed in Python 3.11. The current version of the PR should work now.

@pfps
Copy link
Collaborator Author

pfps commented Feb 9, 2024

Here is what I see for my 502

Screenshot from 2024-02-09 08-16-28

@Svenum
Copy link
Contributor

Svenum commented Feb 9, 2024

Now its working. I dont see any led settings for my Keyboard. This is not implemented yet right?

@pfps
Copy link
Collaborator Author

pfps commented Feb 9, 2024

No. If you post solaar show <keyboard> where is part of the name of your keyboard I can try to get documentation for its color features.

@Svenum
Copy link
Contributor

Svenum commented Feb 9, 2024

I have already done here: #1498 (comment)

@pfps
Copy link
Collaborator Author

pfps commented Feb 9, 2024

Can you also post solaar show for your mouse unless it is the G502 Gaming Mouse. There are several G502 mice and I would like to get descriptors for more of them.

@pfps
Copy link
Collaborator Author

pfps commented Feb 9, 2024

OK, thanks.

@Svenum
Copy link
Contributor

Svenum commented Feb 9, 2024

Sure, I have the G502 Lightspeed:

solaar version 1.1.10

  1: G502 Gaming Mouse
     Device path  : /dev/hidraw8
     WPID         : 407F
     Codename     : G502
     Kind         : mouse
     Protocol     : HID++ 4.2
     Report Rate : 1ms
     Serial number: DDDAADBC
     Model ID:      407FC08D0000
     Unit ID:       DDDAADBC
        Bootloader: BOT 92.00.B0008
          Firmware: MPM 17.00.B0008
             Other: 
     The power switch is located on the base.
     Supports 30 HID++ 2.0 features:
         0: ROOT                   {0000} V0     
         1: FEATURE SET            {0001} V0     
         2: DEVICE FW VERSION      {0003} V2     
            Firmware: Bootloader BOT 92.00.B0008 AAEF21F1FA5F
            Firmware: Firmware MPM 17.00.B0008 407F21F1FA5F
            Firmware: Other   
            Unit ID: DDDAADBC  Model ID: 407FC08D0000  Transport IDs: {'wpid': '407F', 'usbid': 'C08D'}
         3: DEVICE NAME            {0005} V0     
            Name: G502 LIGHTSPEED Wireless Gaming Mouse
            Kind: mouse
         4: WIRELESS DEVICE STATUS {1D4B} V0     
         5: CONFIG CHANGE          {0020} V0     
         6: BATTERY VOLTAGE        {1001} V2     
            Battery: 40% 3787mV , discharging.
         7: COLOR LED EFFECTS      {8070} V4     
            LED Control (saved): Solaar
            LED Control        : Solaar
            LEDs Primary (saved): !LEDEffectSetting {ID: 0x1, color: 0x8000, intensity: 0x0, period: 0x64, ramp: 0x0, speed: 0x0}
            LEDs Primary        : None
            LEDs Logo (saved): !LEDEffectSetting {ID: 0x1, color: 0x8000, intensity: 0x0, period: 0x64, ramp: 0x0, speed: 0x0}
            LEDs Logo        : None
         8: LED CONTROL            {1300} V0     
         9: ONBOARD PROFILES       {8100} V0     
            Device Mode: On-Board
            Onboard Profiles (saved): Profile 1
            Onboard Profiles        : Profile 1
        10: MOUSE BUTTON SPY       {8110} V0     
        11: REPORT RATE            {8060} V0     
            Report Rate: 1ms
            Report Rate (saved): 1ms
            Report Rate        : 1ms
        12: ADJUSTABLE DPI         {2201} V1     
            Sensitivity (DPI) (saved): 900
            Sensitivity (DPI)        : 900
        13: DEVICE RESET           {1802} V0    internal, hidden 
        14: unknown:1803           {1803} V0    internal, hidden 
        15: OOBSTATE               {1805} V0    internal, hidden 
        16: CONFIG DEVICE PROPS    {1806} V4    internal, hidden 
        17: unknown:1811           {1811} V0    internal, hidden 
        18: unknown:1830           {1830} V0    internal, hidden 
        19: unknown:1890           {1890} V4    internal, hidden 
        20: unknown:1891           {1891} V4    internal, hidden 
        21: unknown:18A1           {18A1} V0    internal, hidden 
        22: unknown:1801           {1801} V0    internal, hidden 
        23: unknown:18B1           {18B1} V0    internal, hidden 
        24: unknown:1DF3           {1DF3} V0    internal, hidden 
        25: unknown:1E00           {1E00} V0    hidden 
        26: unknown:1EB0           {1EB0} V0    internal, hidden 
        27: unknown:1863           {1863} V0    internal, hidden 
        28: unknown:1E22           {1E22} V0    internal, hidden 
        29: HIRES WHEEL            {2121} V0     
            Multiplier: 8
            Has invert: Normal wheel motion
            Has ratchet switch: Normal wheel mode
            High resolution mode
            HID notification
            Scroll Wheel Direction (saved): False
            Scroll Wheel Direction        : False
            Scroll Wheel Resolution (saved): True
            Scroll Wheel Resolution        : True
            Scroll Wheel Diversion (saved): False
            Scroll Wheel Diversion        : False
     Battery: 40% 3787mV , discharging.

@pfps
Copy link
Collaborator Author

pfps commented Feb 9, 2024

Thanks, that's what I have. Solaar has a custom name for this mouse.

@Svenum
Copy link
Contributor

Svenum commented Feb 9, 2024

I could find this one too (M590):

solaar version 1.1.10

  1: Multi Device Silent Mouse M585/M590
     Device path  : /dev/hidraw10
     WPID         : 406B
     Codename     : M585/M590
     Kind         : mouse
     Protocol     : HID++ 4.5
     Report Rate : 8msms
     Serial number: 7C18F163
     Model ID:      B01B406B0000
     Unit ID:       E6163ACB
        Bootloader: BOT 48.01.B0002
          Firmware: MPM 05.10.B0011
             Other: 
     The power switch is located on the base.
     Supports 35 HID++ 2.0 features:
         0: ROOT                   {0000} V0     
         1: FEATURE SET            {0001} V0     
         2: DEVICE FW VERSION      {0003} V2     
            Firmware: Bootloader BOT 48.01.B0002 0000AE5E7277
            Firmware: Firmware MPM 05.10.B0011 406BAE5E7277
            Firmware: Other   
            Unit ID: E6163ACB  Model ID: B01B406B0000  Transport IDs: {'btleid': 'B01B', 'wpid': '406B'}
         3: DEVICE NAME            {0005} V0     
            Name: M585/M590 Multi-Device Mouse
            Kind: mouse
         4: WIRELESS DEVICE STATUS {1D4B} V0     
         5: CONFIG CHANGE          {0020} V0     
         6: CRYPTO ID              {0021} V1     
         7: DEVICE FRIENDLY NAME   {0007} V0     
            Friendly Name: M585/M590
         8: BATTERY STATUS         {1000} V0     
            Battery: 90%, discharging, next level 50%.
         9: CHANGE HOST            {1814} V1     
            Change Host        : 2:Ni
        10: HOSTS INFO             {1815} V1     
            Host 0 (paired): 
            Host 1 (paired): Ni
        11: REPROG CONTROLS V4     {1B04} V3     
            Key/Button Actions (saved): {Left Button:Left Click, Right Button:Right Click, Middle Button:Mouse Middle Button, Back Button:Mouse Back Button, Forward Button:Mouse Forward Button, Left Tilt:Mouse Scroll Left Button , Right Tilt:Mouse Scroll Right Button}
            Key/Button Actions        : {Left Button:Left Click, Right Button:Right Click, Middle Button:Mouse Middle Button, Back Button:Mouse Back Button, Forward Button:Mouse Forward Button, Left Tilt:Mouse Scroll Left Button , Right Tilt:Mouse Scroll Right Button}
            Key/Button Diversion (saved): {Middle Button:Regular, Back Button:Regular, Forward Button:Regular, Left Tilt:Regular, Right Tilt:Regular}
            Key/Button Diversion        : {Middle Button:Regular, Back Button:Regular, Forward Button:Regular, Left Tilt:Regular, Right Tilt:Regular}
        12: PERSISTENT REMAPPABLE ACTION {1C00} V0     
            Persistent Key/Button Mapping        : {Left Button:Mouse Button Left, Right Button:Mouse Button Right, Middle Button:Mouse Button Middle, Back Button:Mouse Button Back, Forward Button:Mouse Button Forward, Left Tilt:Horizontal Scroll Left, Right Tilt:Horizontal Scroll Right}
        13: POINTER SPEED          {2205} V0     
            Pointer Speed: 1.0
            Sensitivity (Pointer Speed) (saved): 256
            Sensitivity (Pointer Speed)        : 256
        14: VERTICAL SCROLLING     {2100} V0     
            Roller type: standard
            Ratchet per turn: 18
            Scroll lines: 0
        15: DFUCONTROL SIGNED      {00C2} V0     
        16: DEVICE RESET           {1802} V0    internal, hidden 
        17: unknown:1803           {1803} V0    internal, hidden 
        18: CONFIG DEVICE PROPS    {1806} V0    internal, hidden 
        19: OOBSTATE               {1805} V0    internal, hidden 
        20: unknown:1813           {1813} V0    internal, hidden 
        21: unknown:1830           {1830} V0    internal, hidden 
        22: unknown:1861           {1861} V0    internal, hidden 
        23: unknown:1890           {1890} V2    internal, hidden 
        24: unknown:1891           {1891} V2    internal, hidden 
        25: unknown:18A1           {18A1} V0    internal, hidden 
        26: unknown:1DF3           {1DF3} V0    internal, hidden 
        27: unknown:1E00           {1E00} V0    hidden 
        28: unknown:1EB0           {1EB0} V0    internal, hidden 
        29: unknown:18B1           {18B1} V0    internal, hidden 
        30: unknown:1850           {1850} V0    internal, hidden 
        31: unknown:1E22           {1E22} V0     
        32: unknown:1F03           {1F03} V0    internal, hidden 
        33: unknown:18C0           {18C0} V0    internal, hidden 
        34: LOWRES WHEEL           {2130} V0     
            Wheel Reports: HID
            Scroll Wheel Diversion (saved): False
            Scroll Wheel Diversion        : False
     Has 8 reprogrammable keys:
         0: Left Button               , default: Left Click                  => Left Click                
             mse, reprogrammable, pos:0, group:1, group mask:g1
             reporting: default
         1: Right Button              , default: Right Click                 => Right Click               
             mse, reprogrammable, pos:0, group:1, group mask:g1
             reporting: default
         2: Middle Button             , default: Mouse Middle Button         => Mouse Middle Button       
             mse, reprogrammable, divertable, persistently divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         3: Back Button               , default: Mouse Back Button           => Mouse Back Button         
             mse, reprogrammable, divertable, persistently divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         4: Forward Button            , default: Mouse Forward Button        => Mouse Forward Button      
             mse, reprogrammable, divertable, persistently divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         5: Left Tilt                 , default: Mouse Scroll Left Button    => Mouse Scroll Left Button  
             mse, reprogrammable, divertable, persistently divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         6: Right Tilt                , default: Mouse Scroll Right Button   => Mouse Scroll Right Button 
             mse, reprogrammable, divertable, persistently divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: default
         7: Virtual Gesture Button    , default: Virtual Gesture Button      => Virtual Gesture Button    
             divertable, virtual, raw XY, force raw XY, pos:0, group:3, group mask:empty
             reporting: default
     Has 7 persistent remappable keys:
         0: Left Button                => Mouse Button: Mouse Button Left
         1: Right Button               => Mouse Button: Mouse Button Right
         2: Middle Button              => Mouse Button: Mouse Button Middle
         3: Back Button                => Mouse Button: Mouse Button Back
         4: Forward Button             => Mouse Button: Mouse Button Forward
         5: Left Tilt                  => Horizontal Scroll: Horizontal Scroll Left
         6: Right Tilt                 => Horizontal Scroll: Horizontal Scroll Right
     Battery: 90%, discharging, next level 50%.

@pfps
Copy link
Collaborator Author

pfps commented Feb 9, 2024

Thanks.

@pfps pfps merged commit 2351704 into pwr-Solaar:master Feb 9, 2024
1 check passed
@pfps pfps deleted the color branch February 9, 2024 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants