pwr-Solaar / Solaar

Linux device manager for Logitech devices
https://pwr-solaar.github.io/Solaar
GNU General Public License v2.0
5.44k stars 404 forks source link

solaar settings inverted in kernel 5.0 #519

Closed adatum closed 4 years ago

adatum commented 5 years ago

Since kernel 5.0, some solaar settings have been inverted/reversed from their behavior on kernel 4.20. Is this an issue with solaar or a possible bug with new features in kernel 5.0?

1) For the Logitech M720, setting "Wheel Resolution" (high sensitivity mode) to ON results in normal scrolling behavior, same as in kernel 4.20 with this setting OFF.

Side note: using Wheel Resolution = OFF in kernel 5.0 results in extremely slow scrolling. Could this be a bug in the new high resolution scrolling feature in kernel 5.0, or an issue/conflict with solaar? If solaar is not running in kernel 5.0, the mouse sometimes spontaneously goes into that slow scrolling mode. Normal scrolling behavior can be restored either by powering the mouse off and on again, or by (keeping) running solaar.

2) By default the Logitech k830 keyboard has media keys on the top row, and their secondary function of the Fx keys (F1...F12) is accessed with the Fn key. Solaar has the option to "Swap Fx function", with ON resulting in Fx keys being accessed directly without the Fn key. Since kernel 5.0 the behavior is reversed, with OFF achieving the same result.

I'm using solaar 0.9.2 on Fedora 29 MATE.

rathann commented 4 years ago

Hello, (new) Fedora package maintainer here. I hope you have upgraded to at least Fedora 30 by now. Solaar was updated to 1.0.1 there. Can you still reproduce this?

adatum commented 4 years ago

Hi! Yes, the behavior is still as described above on Solaar 1.0.1 and Fedora 30.

FFY00 commented 4 years ago

For the Logitech M720, setting "Wheel Resolution" (high sensitivity mode) to ON results in normal scrolling behavior, same as in kernel 4.20 with this setting OFF.

This is expected. In kernel 5.0 the logitech-hidpp driver will actually enable that for you.

Side note: using Wheel Resolution = OFF in kernel 5.0 results in extremely slow scrolling. Could this be a bug in the new high resolution scrolling feature in kernel 5.0, or an issue/conflict with solaar? If solaar is not running in kernel 5.0, the mouse sometimes spontaneously goes into that slow scrolling mode. Normal scrolling behavior can be restored either by powering the mouse off and on again, or by (keeping) running solaar.

Yes, the "Wheel Resolution" setting in Solaar enables/disables high resolution wheel support in the hardware. In linux 5.0 several things changed to add support for high resolution wheel mode. I don't understand why you are getting that weird behavior, are you sure that happens when solaar is not running?

By default the Logitech k830 keyboard has media keys on the top row, and their secondary function of the Fx keys (F1...F12) is accessed with the Fn key. Solaar has the option to "Swap Fx function", with ON resulting in Fx keys being accessed directly without the Fn key. Since kernel 5.0 the behavior is reversed, with OFF achieving the same result.

That is weird, it should not happen.

adatum commented 4 years ago

This is expected. In kernel 5.0 the logitech-hidpp driver will actually enable that for you.

Settings in Solaar being inverted after a kernel update is expected?

I don't understand why you are getting that weird behavior, are you sure that happens when solaar is not running?

Yes. There seems to be a bug with the new logitech-hidpp feature in kernel 5.0. See: https://unix.stackexchange.com/questions/510153/mouse-scroll-wheel-speed-problem-with-linux-kernel-5-0 https://bugzilla.redhat.com/show_bug.cgi?id=1701322 Running Solaar is one workaround, but not a solution.

The issue here is that the effect of some Solaar settings have been inverted/reversed since kernel 5.0.

FFY00 commented 4 years ago

Settings in Solaar being inverted after a kernel update is expected?

No, the "Wheel Resolution" feature, because the kernel enables. It should show up as ON when you start solaar.

adatum commented 4 years ago

Wheel Resolution being ON results in normally expected scrolling behavior, same as before kernel 5.0 with it OFF. A change in kernel results in the same Solaar setting having an opposite, inverted effect.

OFF now produces an unusable, extremely slow scrolling.

fin-ger commented 4 years ago

I can confirm the behavior @adatum is describing. I am having the same issue with my M720 on a Gentoo Linux (Gnome 3.34, Xorg) machine. With kernel >=5.0 the Wheel Resolution setting is initially turned on in Solaar, however the scrolling behavior is 24 scroll events on the mouse wheel for one round. When disabling the Wheel Resolution option, I have 3 scroll events for one round. This makes scrolling extremely slow.

On a 4.19 kernel I get 24 scroll events for one round with Wheel Resolution = OFF and 180 scroll events for one round with Wheel Resolution = ON.

FFY00 commented 4 years ago

@whot are we expecting hires wheel events in libinput for devices claimed by the hid-logitech-hidpp driver? Or does it support receiving both?

whot commented 4 years ago

libinput doesn't have high-res wheel support yet, too many other pieces to get into place first/at the same time. https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/139 is the merge request upstream.

But the 5.0 kernel should always enable hires wheel scrolling where supported by the device, check with libinput record whether you get the REL_WHEEL_HI_RES events in addition to the normal wheel events.

pfps commented 4 years ago

Closing as not really a Solaar problem and no response from submitter.

fin-ger commented 4 years ago

What response do you need? I can test it as I experienced the same problem (currently under 4.19 kernel, so have to switch to a 5.x one)

pfps commented 4 years ago

There was no response from whot and the bug was reported against a very old version of Solaar.

I do not believe that this is a Solaar problem at all. All that Solaar does is change settings on the device. For this to be a Solaar problem the device would have to work differently just after Solaar starts up on a completely fresh setup. This means that the saved device information has to be first removed by removing ~/.config/solaar/config.json

FFY00 commented 4 years ago

I think this feature should be removed altogheter. As Peter has explained (probably in other issue) the kernel must know the device in high resolution mode so that it can send the right events. There's no point of having this here.

adatum commented 4 years ago

The issue is just as applicable today with solaar 1.0.1 as the day it was opened, unless a kernel change from 4. to 5. is expected to cause two solaar settings to reverse meaning.

1) "Wheel Resolution" ON means normal scrolling in 5. but OFF is normal in 4. 2) "Swap Fx function" ON is required in 5. for default keyboard behavior, while OFF is default in 4.

pfps commented 4 years ago

@FFY00 I was just looking at some of the settings. I found documentation for 2130, which in Solaar is lowres wheel, but in the documentation is ratchet wheel. Changing the setting just diverts to HID++ reporting, which doesn't seem to be a useful thing to do. If you agree, I'll comment out this setting.

FFY00 commented 4 years ago

@pfps sorry, could you elaborate a bit more? I am having a hard time following :)

pfps commented 4 years ago

I also have documentation for HIRES_WHEEL=0x2121, which is the feature for High Resolution Wheel Invert and Wheel Resolution. The documentation says that they both affect HID reporting, so at least they do something.

pfps commented 4 years ago

@FFY00 As far as I can tell all that the setting that appears as HID++ scrolling (feature 2130) is to have scrolling report as HID++ instead of HID. I just checked this on my M310, and, yes, when HID++ scrolling is on, then the scroll wheel doesn't have any effect. So this setting should be removed from Solaar, in my opinion.
However, this is not HIRES scrolling and the only reason I'm mentioning it in this issue is that you suggested that HIRES settings (feature 2121) should be removed.

pfps commented 4 years ago

@adatum It would be useful to see the output of solaar show for both your mouse and your keyboard and a description of their behaviour at that time. Also, the contents of ~/.config/solaar/config.json

From the Logitech documentation, Fn Inversion ON should mean that pressing a function key by itself should perform the key's special function. It that isn't the case then something is going wrong.

adatum commented 4 years ago

@pfps Sure.

solaar show > Unifying Receiver > Device path : /dev/hidraw2 > USB id : 046d:c52b > Serial : CAF39406 > Firmware : 24.10.B0036 > Bootloader : 01.08 > Other : AA.AC > Has 2 paired device(s) out of a maximum of 6. > Notifications: wireless, software present (0x000900) > Device activity counters: 1=29, 2=162 > > 1: M720 Triathlon Multi-Device Mouse > Codename : M720 Triathlon > Kind : mouse > Wireless PID : 405E > Protocol : HID++ 4.5 > Polling rate : 8 ms (125Hz) > Serial number: C00C3906 > Bootloader: BOT 34.00.B0004 > Firmware: MPM 04.02.B0009 > Other: > The power switch is located on the base. > Supports 35 HID++ 2.0 features: > 0: ROOT {0000} > 1: FEATURE SET {0001} > 2: DEVICE FW VERSION {0003} > 3: DEVICE NAME {0005} > 4: WIRELESS DEVICE STATUS {1D4B} > 5: RESET {0020} > 6: CRYPTO ID {0021} > 7: DEVICE FRIENDLY NAME {0007} > 8: BATTERY STATUS {1000} > 9: CHANGE HOST {1814} > 10: HOSTS INFO {1815} > 11: REPROG CONTROLS V4 {1B04} > 12: PERSISTENT REMAPPABLE ACTION {1C00} > 13: POINTER SPEED {2205} > Pointer Speed: 1.0 > 14: VERTICAL SCROLLING {2100} > Roller type: 3G > Ratchet per turn: 24 > Scroll lines: 0 > 15: DFUCONTROL UNSIGNED {00C1} > 16: DFUCONTROL SIGNED {00C2} > 17: DEVICE RESET {1802} internal, hidden > 18: unknown:1803 {1803} internal, hidden > 19: CONFIG DEVICE PROPS {1806} internal, hidden > 20: OOBSTATE {1805} internal, hidden > 21: unknown:1813 {1813} internal, hidden > 22: unknown:1830 {1830} internal, hidden > 23: unknown:1861 {1861} internal, hidden > 24: unknown:1890 {1890} internal, hidden > 25: unknown:1891 {1891} internal, hidden > 26: unknown:18A1 {18A1} internal, hidden > 27: unknown:1DF3 {1DF3} internal, hidden > 28: unknown:1E00 {1E00} hidden > 29: unknown:1EB0 {1EB0} internal, hidden > 30: unknown:18B1 {18B1} internal, hidden > 31: unknown:1850 {1850} internal, hidden > 32: unknown:1F03 {1F03} internal, hidden > 33: unknown:18C0 {18C0} internal, hidden > 34: HIRES WHEEL {2121} > Multiplier: 8 > Has invert > Normal wheel motion > Has ratchet switch > Free wheel mode > High resolution mode > HID notification > Has 9 reprogrammable keys: > 0: LEFT CLICK , default: LeftClick => LEFT CLICK > mse, reprogrammable, pos:0, group:1, gmask:1 > 1: RIGHT CLICK , default: RightClick => RIGHT CLICK > mse, reprogrammable, pos:0, group:1, gmask:1 > 2: MIDDLE BUTTON , default: MiddleMouseButton => MIDDLE BUTTON > mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3 > 3: BACK AS BUTTON 4 , default: BackEx => BACK AS BUTTON 4 > mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3 > 4: FORWARD AS BUTTON 5 , default: BrowserForwardEx => FORWARD AS BUTTON 5 > mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3 > 5: LEFT SCROLL AS AC PAN , default: HorzScrollLeftSet => LEFT SCROLL AS AC PAN > mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3 > 6: RIGHT SCROLL AS AC PAN , default: HorzScrollRightSet => RIGHT SCROLL AS AC PAN > mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3 > 7: unknown:00D0 , default: unknown:00AD => unknown:00D0 > mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3 > 8: unknown:00D7 , default: unknown:00B4 => unknown:00D7 > divertable, virtual, pos:0, group:3, gmask:0 > Battery: 50%, discharging. > > 2: Illuminated Living-Room Keyboard K830 > Codename : K830 > Kind : keyboard > Wireless PID : 4032 > Protocol : HID++ 4.1 > Polling rate : 8 ms (125Hz) > Serial number: 03E1AF3A > Firmware: RQK 56.00.B0020 > The power switch is located on the edge of top right corner. > Supports 27 HID++ 2.0 features: > 0: ROOT {0000} > 1: FEATURE SET {0001} > 2: DEVICE FW VERSION {0003} > 3: DEVICE NAME {0005} > 4: WIRELESS DEVICE STATUS {1D4B} > 5: RESET {0020} > 6: BATTERY STATUS {1000} > 7: BACKLIGHT {1981} > 8: REPROG CONTROLS V4 {1B04} > 9: SWAP BUTTON CANCEL {2005} > 10: NEW FN INVERSION {40A2} > 11: ENCRYPTION {4100} > 12: KEYBOARD DISABLE {4521} > 13: TOUCHPAD RAW XY {6100} hidden > 14: GESTURE 2 {6501} > 15: DFUCONTROL UNSIGNED {00C1} > 16: unknown:1811 {1811} internal, hidden > 17: unknown:1830 {1830} internal, hidden > 18: unknown:1890 {1890} internal, hidden > 19: unknown:18A0 {18A0} internal, hidden > 20: unknown:1DF3 {1DF3} internal, hidden > 21: unknown:1E00 {1E00} hidden > 22: unknown:1EB0 {1EB0} internal, hidden > 23: unknown:1861 {1861} internal, hidden > 24: unknown:1A20 {1A20} internal, hidden > 25: unknown:18B0 {18B0} internal, hidden > 26: unknown:1F07 {1F07} internal, hidden > Has 20 reprogrammable keys: > 0: unknown:00B8 , default: LeftClick => unknown:00B8 > mse, divertable, pos:0, group:0, gmask:0 > 1: WIN7 MINIMIZE AS WIN ARROW, default: unknown:0094 => WIN7 MINIMIZE AS WIN ARROW > is FN, FN sensitive, reprogrammable, divertable, pos:2, group:0, gmask:0 > 2: WIN7 MAXIMIZE AS WIN ARROW, default: unknown:0095 => WIN7 MAXIMIZE AS WIN ARROW > is FN, FN sensitive, reprogrammable, divertable, pos:3, group:0, gmask:0 > 3: CLOSE , default: Close Application => CLOSE > is FN, FN sensitive, reprogrammable, divertable, pos:4, group:0, gmask:0 > 4: WIN7 SHOW PRESENTATION MODE, default: unknown:0093 => WIN7 SHOW PRESENTATION MODE > is FN, FN sensitive, reprogrammable, divertable, pos:5, group:0, gmask:0 > 5: SHOW DESKTOP , default: ShowDesktop => SHOW DESKTOP > is FN, FN sensitive, reprogrammable, divertable, pos:6, group:0, gmask:0 > 6: SEARCH , default: SearchForFiles => SEARCH > is FN, FN sensitive, reprogrammable, divertable, pos:7, group:0, gmask:0 > 7: MY HOME , default: HomePage => MY HOME > is FN, FN sensitive, reprogrammable, divertable, pos:8, group:0, gmask:0 > 8: MEDIA PLAYER , default: Music => MEDIA PLAYER > is FN, FN sensitive, reprogrammable, divertable, pos:9, group:0, gmask:0 > 9: Previous , default: Previous => Previous > is FN, FN sensitive, divertable, pos:10, group:0, gmask:0 > 10: Play/Pause , default: Play/Pause => Play/Pause > is FN, FN sensitive, divertable, pos:11, group:0, gmask:0 > 11: Next , default: Next => Next > is FN, FN sensitive, divertable, pos:12, group:0, gmask:0 > 12: Application Switcher , default: Application Switcher => Application Switcher > is FN, reprogrammable, divertable, pos:13, group:0, gmask:0 > 13: SLEEP , default: Sleep => SLEEP > is FN, reprogrammable, divertable, pos:14, group:0, gmask:0 > 14: Mute , default: Mute => Mute > nonstandard, divertable, pos:0, group:0, gmask:0 > 15: Volume Down , default: Volume Down => Volume Down > nonstandard, divertable, pos:0, group:0, gmask:0 > 16: Volume Up , default: Volume Up => Volume Up > nonstandard, divertable, pos:0, group:0, gmask:0 > 17: unknown:00B7 , default: ShowUI => unknown:00B7 > divertable, pos:0, group:0, gmask:0 > 18: LEFT CLICK , default: LeftClick => LEFT CLICK > mse, pos:0, group:0, gmask:0 > 19: RIGHT CLICK , default: RightClick => RIGHT CLICK > mse, pos:0, group:0, gmask:0 > Battery: 90%, discharging.
~/.config/solaar/config.json > { > "4032:03E1AF3A": { > "_name": "Illuminated Living-Room Keyboard K830", > "fn-swap": true > }, > "4032:CAF39406": { > "_name": "Illuminated Living-Room Keyboard K830", > "fn-swap": true > }, > "405E:C00C3906": { > "_name": "M720 Triathlon Multi-Device Mouse", > "hires-smooth-invert": false, > "hires-smooth-resolution": true, > "pointer_speed": 256 > }, > "405E:CAF39406": { > "_name": "M720 Triathlon Multi-Device Mouse", > "hires-smooth-invert": false, > "hires-smooth-resolution": true, > "pointer_speed": 256 > }, > "_version": "1.0.1"

In short, in kernel 5.* currently:

Notes from the first post:

For the Logitech M720, setting "Wheel Resolution" (high sensitivity mode) to ON results in normal scrolling behavior, same as in kernel 4.20 with this setting OFF.

By default the Logitech k830 keyboard has media keys on the top row, and their secondary function of the Fx keys (F1...F12) is accessed with the Fn key. Solaar has the option to "Swap Fx function", with ON resulting in Fx keys being accessed directly without the Fn key. Since kernel 5.0 the behavior is reversed, with OFF achieving the same result.

pfps commented 4 years ago

There are three fn-swap features. This is the one I don't have documentation for.

It appears that the K830 defaults to the media functions for the Fn keys. From the documentation of the other complicated fn-swap feature what this means is not that swap on should go to the non-default status, but that the default is swap on, i.e., turning swap on will leave the Fn keys as media keys unless the Fn button is depressedl. One thing to note is that the default behaviour will reassert itself whenever the keyboard resets or turns on.

For wheel resolution, all that Solaar does is flip the bit on the mouse for between high resolution and low resolution. What the Linux input driver makes of this is beyond Solaar's control. It may be that the Linux input driver was changed so that switching between hi-res and low-res is no longer a good idea in most cases.

What I am seeing from the provided output is that Solaar is showing the correct value for hi-res mode, so it appears that Solaar is working correctly.

adatum commented 4 years ago

From the documentation of the other complicated fn-swap feature what this means is not that swap on should go to the non-default status, but that the default is swap on, i.e., turning swap on will leave the Fn keys as media keys unless the Fn button is depressedl. One thing to note is that the default behaviour will reassert itself whenever the keyboard resets or turns on.

This description is in contradiction to the actual usage experience. Swap OFF is the default, and this keyboard's default behavior is the media functions for the FN keys. Also, turning the keyboard on/off does not reset the behavior, i.e. the Swap setting persists (thankfully).

I don't know where the issue lies for the wheel resolution, but I can reaffirm that the behavior has inverted after kernel 5.0.

pfps commented 4 years ago

OK, so maybe Solaar doesn't handle this fn-swap feature correctly. I'll ask for documentation.

pfps commented 4 years ago

I have documentation and added a direct implementation of the feature to Solaar in a new pull request. Please download and try out this version so I can see what is going on.

First, if you haven't already, clone Solaar from this repository. Then cd to the repository directory and download and checkout this new pull request via

git fetch origin pull/831/head:pull_831
git checkout pull_831

Then terminate any running instances of Solaar and run the cloned Solaar via

bin/solaar show

and paste the output in a new comment. The output should, provided there are no bugs in the untested code, provide a direct view of the relevant bits in the fn-inversion feature for your device.

pfps commented 4 years ago

One thing to note is that Solaar pushes settings to devices whenever they are seen. With your config file, Solaar should be setting the device to fn-swap true, so with Solaar running the fn keys should be producing the media functions.

adatum commented 4 years ago

Thanks for the clear instructions.

There is an error:

  Device path  : /dev/hidraw2
  USB id       : 046d:c52b
  Serial       : CAF39406
    Firmware   : 24.10.B0036
    Bootloader : 01.08
    Other      : AA.AC
  Has 2 paired device(s) out of a maximum of 6.
  Notifications: wireless, software present (0x000900)
  Device activity counters: 1=22, 2=118

  1: M720 Triathlon Multi-Device Mouse
     Codename     : M720 Triathlon
     Kind         : mouse
     Wireless PID : 405E
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: C00C3906
        Bootloader: BOT 34.00.B0004
          Firmware: MPM 04.02.B0009
             Other: 
     The power switch is located on the base.
     Supports 35 HID++ 2.0 features:
         0: ROOT                   {0000}   
solaar: error: Traceback (most recent call last):
  File "[path]/Solaar/lib/solaar/cli/__init__.py", line 162, in run
    m.run(c, args, _find_receiver, _find_device)
  File "[path]/Solaar/lib/solaar/cli/show.py", line 224, in run
    _print_device(dev)
  File "[path]/Solaar/lib/solaar/cli/show.py", line 172, in _print_device
    elif feature == _hidpp20.NEW_FN_INVERSION:
AttributeError: module 'logitech_receiver.hidpp20' has no attribute 'NEW_FN_INVERSION'

Also note that the media functions are retained (i.e. Swap ON in this case persists) when the keyboard is turned off/on even when Solaar is not running.

pfps commented 4 years ago

Grr. Stupid me. I've fixed this error, please try again.

adatum commented 4 years ago

Got further this time, but still with an error:

Unifying Receiver
  Device path  : /dev/hidraw2
  USB id       : 046d:c52b
  Serial       : CAF39406
    Firmware   : 24.10.B0036
    Bootloader : 01.08
    Other      : AA.AC
  Has 2 paired device(s) out of a maximum of 6.
  Notifications: wireless, software present (0x000900)
  Device activity counters: 1=70, 2=53

  1: M720 Triathlon Multi-Device Mouse
     Codename     : M720 Triathlon
     Kind         : mouse
     Wireless PID : 405E
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: C00C3906
        Bootloader: BOT 34.00.B0004
          Firmware: MPM 04.02.B0009
             Other: 
     The power switch is located on the base.
     Supports 35 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
         3: DEVICE NAME            {0005}   
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: CRYPTO ID              {0021}   
         7: DEVICE FRIENDLY NAME   {0007}   
         8: BATTERY STATUS         {1000}   
         9: CHANGE HOST            {1814}   
        10: HOSTS INFO             {1815}   
        11: REPROG CONTROLS V4     {1B04}   
            Actions: {'80': 80, '81': 81, '82': 82, '83': 83, '86': 86, '91': 91, '93': 93, '208': 208}
        12: PERSISTENT REMAPPABLE ACTION {1C00}   
        13: POINTER SPEED          {2205}   
            Pointer Speed: 1.0
            Sensitivity (Pointer Speed): 256
        14: VERTICAL SCROLLING     {2100}   
            Roller type: 3G
            Ratchet per turn: 24
            Scroll lines: 0
        15: DFUCONTROL UNSIGNED    {00C1}   
        16: DFUCONTROL SIGNED      {00C2}   
        17: DEVICE RESET           {1802}   internal, hidden
        18: unknown:1803           {1803}   internal, hidden
        19: CONFIG DEVICE PROPS    {1806}   internal, hidden
        20: OOBSTATE               {1805}   internal, hidden
        21: unknown:1813           {1813}   internal, hidden
        22: unknown:1830           {1830}   internal, hidden
        23: unknown:1861           {1861}   internal, hidden
        24: unknown:1890           {1890}   internal, hidden
        25: unknown:1891           {1891}   internal, hidden
        26: unknown:18A1           {18A1}   internal, hidden
        27: unknown:1DF3           {1DF3}   internal, hidden
        28: unknown:1E00           {1E00}   hidden
        29: unknown:1EB0           {1EB0}   internal, hidden
        30: unknown:18B1           {18B1}   internal, hidden
        31: unknown:1850           {1850}   internal, hidden
        32: unknown:1F03           {1F03}   internal, hidden
        33: unknown:18C0           {18C0}   internal, hidden
        34: HIRES WHEEL            {2121}   
            Multiplier: 8
            Has invert
              Normal wheel motion
            Has ratchet switch
              Free wheel mode
            High resolution mode
            HID notification
            High Resolution Wheel Invert: False
            Wheel Resolution: True
     Has 9 reprogrammable keys:
         0: Left Button               , default: Left Click                  => Left Button               
             mse, reprogrammable, pos:0, group:1, gmask:1
         1: Right Button              , default: Right Click                 => Right Button              
             mse, reprogrammable, pos:0, group:1, gmask:1
         2: Middle Button             , default: Mouse Middle Button         => Middle Button             
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         3: Back Button               , default: Mouse Back Button           => Back Button               
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         4: Forward Button            , default: Mouse Forward Button        => Forward Button            
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         5: Left Tilt                 , default: Mouse Scroll Left Button    => Left Tilt                 
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         6: Right Tilt                , default: Mouse Scroll Right Button   => Right Tilt                
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         7: Multiplatform gesture button, default: Multiplatform Gesture Button => Multiplatform gesture button
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         8: Virtual Gesture Button    , default: Virtual Gesture Button      => Virtual Gesture Button    
             divertable, virtual, pos:0, group:3, gmask:0
     Battery: 50%, discharging, next level 20%.

  2: Illuminated Living-Room Keyboard K830
     Codename     : K830
     Kind         : keyboard
     Wireless PID : 4032
     Protocol     : HID++ 4.1
     Polling rate : 8 ms (125Hz)
     Serial number: 03E1AF3A
          Firmware: RQK 56.00.B0020
     The power switch is located on the edge of top right corner.
     Supports 27 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
         3: DEVICE NAME            {0005}   
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: BATTERY STATUS         {1000}   
         7: BACKLIGHT              {1981}   
         8: REPROG CONTROLS V4     {1B04}   
         9: SWAP BUTTON CANCEL     {2005}   
        10: NEW FN INVERSION       {40A2}   
solaar: error: Traceback (most recent call last):
  File "[path]/Solaar/lib/solaar/cli/__init__.py", line 162, in run
    m.run(c, args, _find_receiver, _find_device)
  File "[path]/Solaar/lib/solaar/cli/show.py", line 224, in run
    _print_device(dev)
  File "[path]/Solaar/lib/solaar/cli/show.py", line 173, in _print_device
    inverted, default_inverted = _hidpp20.get_new_fn_inversion(dev)
  File "[path]/Solaar/lib/logitech_receiver/hidpp20.py", line 661, in get_new_fn_inversion
    inverted = (state & 0x01) != 0
TypeError: unsupported operand type(s) for &: 'bytes' and 'int'
pfps commented 4 years ago

Grr. Grr. Python. Grr.
Please try again.

adatum commented 4 years ago

Result is the same as before.

Btw, how can I get git to locally update the changes you've made to the pull request?

pfps commented 4 years ago

If you mean how can you update to the latest version of the pull request, all that is needed should be to fetch and checkout when in the Solaar directory.

pfps commented 4 years ago

It's entirely possible that I didn't update the PR correctly. The end of lib/logitech-receiver/hidpp20.py should be

def get_new_fn_inversion(device):
    state = feature_request(device, FEATURE.NEW_FN_INVERSION, 0x00)
    if state:
        flags, = _unpack('!B', state[:1])
        inverted = (state & 0x01) != 0 
        default_inverted = (state & 0x02) != 0
        return inverted, default_inverted
adatum commented 4 years ago

If you mean how can you update to the latest version of the pull request

Yes. Fetching as done originally did not work. From the master branch:

$ git fetch origin pull/831/head:pull_831
From https://github.com/pwr-Solaar/Solaar
 ! [rejected]        refs/pull/831/head -> pull_831  (non-fast-forward)

If in the pull_831 branch:

fatal: Refusing to fetch into current branch refs/heads/pull_831 of non-bare repository

I ended up deleting the repo and re-cloning.

The end of lib/logitech-receiver/hidpp20.py looks the same here:

def get_new_fn_inversion(device):
    state = feature_request(device, FEATURE.NEW_FN_INVERSION, 0x00)
    if state:
        flags, = _unpack('!B', state[:1])
        inverted = (state & 0x01) != 0
        default_inverted = (state & 0x02) != 0
        return inverted, default_inverted
pfps commented 4 years ago

Argh. Such a stupid mistake on my part. Please try yet again.

I did a regular push so it might be OK to just

git checkout pull_831
git pull origin pull/831/head:pull_831

but if that doesn't work, just reclone, fetch, and checkout.

adatum commented 4 years ago

I had to delete and re-clone, but finally it worked:

Unifying Receiver
  Device path  : /dev/hidraw2
  USB id       : 046d:c52b
  Serial       : CAF39406
    Firmware   : 24.10.B0036
    Bootloader : 01.08
    Other      : AA.AC
  Has 2 paired device(s) out of a maximum of 6.
  Notifications: wireless, software present (0x000900)
  Device activity counters: 1=214, 2=194

  1: M720 Triathlon Multi-Device Mouse
     Codename     : M720 Triathlon
     Kind         : mouse
     Wireless PID : 405E
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: C00C3906
        Bootloader: BOT 34.00.B0004
          Firmware: MPM 04.02.B0009
             Other: 
     The power switch is located on the base.
     Supports 35 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
         3: DEVICE NAME            {0005}   
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: CRYPTO ID              {0021}   
         7: DEVICE FRIENDLY NAME   {0007}   
         8: BATTERY STATUS         {1000}   
         9: CHANGE HOST            {1814}   
        10: HOSTS INFO             {1815}   
        11: REPROG CONTROLS V4     {1B04}   
            Actions: {'80': 80, '81': 81, '82': 82, '83': 83, '86': 86, '91': 91, '93': 93, '208': 208}
        12: PERSISTENT REMAPPABLE ACTION {1C00}   
        13: POINTER SPEED          {2205}   
            Pointer Speed: 1.0
        14: VERTICAL SCROLLING     {2100}   
            Roller type: 3G
            Ratchet per turn: 24
            Scroll lines: 0
        15: DFUCONTROL UNSIGNED    {00C1}   
        16: DFUCONTROL SIGNED      {00C2}   
        17: DEVICE RESET           {1802}   internal, hidden
        18: unknown:1803           {1803}   internal, hidden
        19: CONFIG DEVICE PROPS    {1806}   internal, hidden
        20: OOBSTATE               {1805}   internal, hidden
        21: unknown:1813           {1813}   internal, hidden
        22: unknown:1830           {1830}   internal, hidden
        23: unknown:1861           {1861}   internal, hidden
        24: unknown:1890           {1890}   internal, hidden
        25: unknown:1891           {1891}   internal, hidden
        26: unknown:18A1           {18A1}   internal, hidden
        27: unknown:1DF3           {1DF3}   internal, hidden
        28: unknown:1E00           {1E00}   hidden
        29: unknown:1EB0           {1EB0}   internal, hidden
        30: unknown:18B1           {18B1}   internal, hidden
        31: unknown:1850           {1850}   internal, hidden
        32: unknown:1F03           {1F03}   internal, hidden
        33: unknown:18C0           {18C0}   internal, hidden
        34: HIRES WHEEL            {2121}   
            Multiplier: 8
            Has invert
              Normal wheel motion
            Has ratchet switch
              Free wheel mode
            High resolution mode
            HID notification
            High Resolution Wheel Invert: False
            Wheel Resolution: True
     Has 9 reprogrammable keys:
         0: Left Button               , default: Left Click                  => Left Button               
             mse, reprogrammable, pos:0, group:1, gmask:1
         1: Right Button              , default: Right Click                 => Right Button              
             mse, reprogrammable, pos:0, group:1, gmask:1
         2: Middle Button             , default: Mouse Middle Button         => Middle Button             
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         3: Back Button               , default: Mouse Back Button           => Back Button               
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         4: Forward Button            , default: Mouse Forward Button        => Forward Button            
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         5: Left Tilt                 , default: Mouse Scroll Left Button    => Left Tilt                 
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         6: Right Tilt                , default: Mouse Scroll Right Button   => Right Tilt                
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         7: Multiplatform gesture button, default: Multiplatform Gesture Button => Multiplatform gesture button
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         8: Virtual Gesture Button    , default: Virtual Gesture Button      => Virtual Gesture Button    
             divertable, virtual, pos:0, group:3, gmask:0
     Battery: 50%, discharging, next level 20%.

  2: Illuminated Living-Room Keyboard K830
     Codename     : K830
     Kind         : keyboard
     Wireless PID : 4032
     Protocol     : HID++ 4.1
     Polling rate : 8 ms (125Hz)
     Serial number: 03E1AF3A
          Firmware: RQK 56.00.B0020
     The power switch is located on the edge of top right corner.
     Supports 27 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
         3: DEVICE NAME            {0005}   
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: BATTERY STATUS         {1000}   
         7: BACKLIGHT              {1981}   
         8: REPROG CONTROLS V4     {1B04}   
         9: SWAP BUTTON CANCEL     {2005}   
        10: NEW FN INVERSION       {40A2}   
            Swap Fx function: True
        11: ENCRYPTION             {4100}   
        12: KEYBOARD DISABLE KEYS  {4521}   
            Disable keys: {'1': False, '4': False, '8': False, '16': False}
        13: TOUCHPAD RAW XY        {6100}   hidden
        14: GESTURE 2              {6501}   
        15: DFUCONTROL UNSIGNED    {00C1}   
        16: unknown:1811           {1811}   internal, hidden
        17: unknown:1830           {1830}   internal, hidden
        18: unknown:1890           {1890}   internal, hidden
        19: unknown:18A0           {18A0}   internal, hidden
        20: unknown:1DF3           {1DF3}   internal, hidden
        21: unknown:1E00           {1E00}   hidden
        22: unknown:1EB0           {1EB0}   internal, hidden
        23: unknown:1861           {1861}   internal, hidden
        24: unknown:1A20           {1A20}   internal, hidden
        25: unknown:18B0           {18B0}   internal, hidden
        26: unknown:1F07           {1F07}   internal, hidden
     Has 20 reprogrammable keys:
         0: Second Left Click         , default: Left Click                  => Second Left Click         
             mse, divertable, pos:0, group:0, gmask:0
         1: Minimize Window           , default: Minimize Window             => Minimize Window           
             is FN, FN sensitive, reprogrammable, divertable, pos:2, group:0, gmask:0
         2: Maximize Window           , default: Maximize Window             => Maximize Window           
             is FN, FN sensitive, reprogrammable, divertable, pos:3, group:0, gmask:0
         3: CLOSE                     , default: Close Application           => CLOSE                     
             is FN, FN sensitive, reprogrammable, divertable, pos:4, group:0, gmask:0
         4: Switch Screen             , default: Switch Presentation/Switch Screen => Switch Screen             
             is FN, FN sensitive, reprogrammable, divertable, pos:5, group:0, gmask:0
         5: Show Desktop              , default: Show Desktop                => Show Desktop              
             is FN, FN sensitive, reprogrammable, divertable, pos:6, group:0, gmask:0
         6: Search                    , default: Search Files                => Search                    
             is FN, FN sensitive, reprogrammable, divertable, pos:7, group:0, gmask:0
         7: MY HOME                   , default: HomePage                    => MY HOME                   
             is FN, FN sensitive, reprogrammable, divertable, pos:8, group:0, gmask:0
         8: MEDIA PLAYER              , default: Music                       => MEDIA PLAYER              
             is FN, FN sensitive, reprogrammable, divertable, pos:9, group:0, gmask:0
         9: Previous                  , default: Previous                    => Previous                  
             is FN, FN sensitive, divertable, pos:10, group:0, gmask:0
        10: Play/Pause                , default: Play/Pause                  => Play/Pause                
             is FN, FN sensitive, divertable, pos:11, group:0, gmask:0
        11: Next                      , default: Next                        => Next                      
             is FN, FN sensitive, divertable, pos:12, group:0, gmask:0
        12: Application Switcher      , default: Application Switcher        => Application Switcher      
             is FN, reprogrammable, divertable, pos:13, group:0, gmask:0
        13: SLEEP                     , default: Sleep                       => SLEEP                     
             is FN, reprogrammable, divertable, pos:14, group:0, gmask:0
        14: Mute                      , default: Mute                        => Mute                      
             nonstandard, divertable, pos:0, group:0, gmask:0
        15: Volume Down               , default: Volume Down                 => Volume Down               
             nonstandard, divertable, pos:0, group:0, gmask:0
        16: Volume Up                 , default: Volume Up                   => Volume Up                 
             nonstandard, divertable, pos:0, group:0, gmask:0
        17: Fn Left Click             , default: ShowUI                      => Fn Left Click             
             divertable, pos:0, group:0, gmask:0
        18: Left Button               , default: Left Click                  => Left Button               
             mse, pos:0, group:0, gmask:0
        19: Right Button              , default: Right Click                 => Right Button              
             mse, pos:0, group:0, gmask:0
     Battery: 50%, discharging, next level 20%.
pfps commented 4 years ago

OK, thanks. That's showing what I expected. I added a bit more, so please try again (clone, cd, fetch, bin/solaar show). This time also add output from bin/solaar -dd show

adatum commented 4 years ago

The output is over 800 lines so I used fpaste: https://paste.centos.org/view/9409a50b It will vanish in 24 hours, so let me know if you'd like me to post it here more permanently in a spoiler if you need it for future records.

In a somewhat related note, does Solaar see the M720's thumb button as reprogrammable? https://unix.stackexchange.com/questions/472363/how-to-remap-mouse-button-not-identified-by-xev I could make a new issue for that if it would sidetrack the efforts here.

pfps commented 4 years ago

Thanks for the outputs. Here is my current understanding of the situation.

The relevant lines of the output are:

23:01:33,681    DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 02 0A0D 000000]
23:01:33,697    DEBUG [MainThread] logitech_receiver.base: (3) => r[11 02 0A0D 01010000000000000000000000000000]

The first line is asking for the current state of Fn Inversion. The first 01 on the second line is reporting that Fn inversion is on (function keys act as media keys, etc., unless the Fn key is depressed). The second 01 is reporting that Fn inversion is on by default so when your device is first turned on (without Solaar running) the function keys should be media keys.

Solaar has the following saved settings for the device

{
"4032:03E1AF3A": {
"_name": "Illuminated Living-Room Keyboard K830",
"fn-swap": true
},

So when the Solaar GUI starts up, and when the device connects while the Solaar GUI is running, Solaar should be turning on Fn inversion (called fn-swap in Solaar) so that the function keys are media keys. To change them to be regular function keys unless the Fn key is depressed change the setting for Swap Fx function for the device in the Solaar GUI. This should also change the config.json file to contain

{
"4032:03E1AF3A": {
"_name": "Illuminated Living-Room Keyboard K830",
"fn-swap": false
},

Then the device will start up with Fn inversion on, but the Solaar GUI will turn Fn inversion off.

If this is not your experience then the way to debug what Solaar is doing is to run Solaar as bin/solaar -dd. This will produce lots of output. The relevant output lines will be ones that contain something like [10 02 0A1. where the . can be any hex digit. There should be two of these lines, one very shortly afterwards with a w just before the left bracket (Solaar trying to change the Fn inversion) and one with a r (the device reporting success). If this is not the case report back the first relevant line and the next 20 or so lines.

pfps commented 4 years ago

It looks as if the thumb button is the Multiplatform gesture button. The version of Solaar in this repository should be able to remap this button to the action of any of the buttons on the mouse that are in groups 1 or 2. (See the solaar show output above for information on the reprogrammable buttons for this mouse.) In the Solaar gui, change the first box under Actions to Multiplatform gesture button and then the second to the action that you want. WARNING: Be careful changing the action of the Left Button.

pfps commented 4 years ago

I think I figured out how to get a new version of a pull request. You need to create a new branch for it.
So to get the newest version of the Fn inversion code go to your Solaar clone and

git fetch origin pull/831/head:pull_831x
git checkout pull_831x

Please try that and then run bin/solaar show and report back the output. I have some new code that should show the state of your device's Fn inversion a bit better. (This is only to ensure that this code works - it shouldn't change my understanding of what is happening.)

adatum commented 4 years ago

Here is the latest from bin/solaar show:

Unifying Receiver
  Device path  : /dev/hidraw2
  USB id       : 046d:c52b
  Serial       : CAF39406
    Firmware   : 24.10.B0036
    Bootloader : 01.08
    Other      : AA.AC
  Has 2 paired device(s) out of a maximum of 6.
  Notifications: wireless, software present (0x000900)
  Device activity counters: 1=18, 2=9

  1: M720 Triathlon Multi-Device Mouse
     Codename     : M720 Triathlon
     Kind         : mouse
     Wireless PID : 405E
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: C00C3906
        Bootloader: BOT 34.00.B0004
          Firmware: MPM 04.02.B0009
             Other: 
     The power switch is located on the base.
     Supports 35 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
         3: DEVICE NAME            {0005}   
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: CRYPTO ID              {0021}   
         7: DEVICE FRIENDLY NAME   {0007}   
         8: BATTERY STATUS         {1000}   
         9: CHANGE HOST            {1814}   
        10: HOSTS INFO             {1815}   
        11: REPROG CONTROLS V4     {1B04}   
            Actions: {'80': 80, '81': 81, '82': 82, '83': 83, '86': 86, '91': 91, '93': 93, '208': 208}
        12: PERSISTENT REMAPPABLE ACTION {1C00}   
        13: POINTER SPEED          {2205}   
            Pointer Speed: 1.0
            Sensitivity (Pointer Speed): 256
        14: VERTICAL SCROLLING     {2100}   
            Roller type: 3G
            Ratchet per turn: 24
            Scroll lines: 0
        15: DFUCONTROL UNSIGNED    {00C1}   
        16: DFUCONTROL SIGNED      {00C2}   
        17: DEVICE RESET           {1802}   internal, hidden
        18: unknown:1803           {1803}   internal, hidden
        19: CONFIG DEVICE PROPS    {1806}   internal, hidden
        20: OOBSTATE               {1805}   internal, hidden
        21: unknown:1813           {1813}   internal, hidden
        22: unknown:1830           {1830}   internal, hidden
        23: unknown:1861           {1861}   internal, hidden
        24: unknown:1890           {1890}   internal, hidden
        25: unknown:1891           {1891}   internal, hidden
        26: unknown:18A1           {18A1}   internal, hidden
        27: unknown:1DF3           {1DF3}   internal, hidden
        28: unknown:1E00           {1E00}   hidden
        29: unknown:1EB0           {1EB0}   internal, hidden
        30: unknown:18B1           {18B1}   internal, hidden
        31: unknown:1850           {1850}   internal, hidden
        32: unknown:1F03           {1F03}   internal, hidden
        33: unknown:18C0           {18C0}   internal, hidden
        34: HIRES WHEEL            {2121}   
            Multiplier: 8
            Has invert
              Normal wheel motion
            Has ratchet switch
              Free wheel mode
            High resolution mode
            HID notification
            High Resolution Wheel Invert: False
            Wheel Resolution: True
     Has 9 reprogrammable keys:
         0: Left Button               , default: Left Click                  => Left Button               
             mse, reprogrammable, pos:0, group:1, gmask:1
         1: Right Button              , default: Right Click                 => Right Button              
             mse, reprogrammable, pos:0, group:1, gmask:1
         2: Middle Button             , default: Mouse Middle Button         => Middle Button             
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         3: Back Button               , default: Mouse Back Button           => Back Button               
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         4: Forward Button            , default: Mouse Forward Button        => Forward Button            
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         5: Left Tilt                 , default: Mouse Scroll Left Button    => Left Tilt                 
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         6: Right Tilt                , default: Mouse Scroll Right Button   => Right Tilt                
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         7: Multiplatform gesture button, default: Multiplatform Gesture Button => Multiplatform gesture button
             mse, reprogrammable, divertable, persistently divertable, pos:0, group:2, gmask:3
         8: Virtual Gesture Button    , default: Virtual Gesture Button      => Virtual Gesture Button    
             divertable, virtual, pos:0, group:3, gmask:0
     Battery: 50%, discharging, next level 20%.

  2: Illuminated Living-Room Keyboard K830
     Codename     : K830
     Kind         : keyboard
     Wireless PID : 4032
     Protocol     : HID++ 4.1
     Polling rate : 8 ms (125Hz)
     Serial number: 03E1AF3A
          Firmware: RQK 56.00.B0020
     The power switch is located on the edge of top right corner.
     Supports 27 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
         3: DEVICE NAME            {0005}   
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: BATTERY STATUS         {1000}   
         7: BACKLIGHT              {1981}   
         8: REPROG CONTROLS V4     {1B04}   
         9: SWAP BUTTON CANCEL     {2005}   
        10: NEW FN INVERSION       {40A2}   
            Fn-swap: enabled
            Fn-swap default: enabled
            Swap Fx function: True
        11: ENCRYPTION             {4100}   
        12: KEYBOARD DISABLE KEYS  {4521}   
            Disable keys: {'1': False, '4': False, '8': False, '16': False}
        13: TOUCHPAD RAW XY        {6100}   hidden
        14: GESTURE 2              {6501}   
        15: DFUCONTROL UNSIGNED    {00C1}   
        16: unknown:1811           {1811}   internal, hidden
        17: unknown:1830           {1830}   internal, hidden
        18: unknown:1890           {1890}   internal, hidden
        19: unknown:18A0           {18A0}   internal, hidden
        20: unknown:1DF3           {1DF3}   internal, hidden
        21: unknown:1E00           {1E00}   hidden
        22: unknown:1EB0           {1EB0}   internal, hidden
        23: unknown:1861           {1861}   internal, hidden
        24: unknown:1A20           {1A20}   internal, hidden
        25: unknown:18B0           {18B0}   internal, hidden
        26: unknown:1F07           {1F07}   internal, hidden
     Has 20 reprogrammable keys:
         0: Second Left Click         , default: Left Click                  => Second Left Click         
             mse, divertable, pos:0, group:0, gmask:0
         1: Minimize Window           , default: Minimize Window             => Minimize Window           
             is FN, FN sensitive, reprogrammable, divertable, pos:2, group:0, gmask:0
         2: Maximize Window           , default: Maximize Window             => Maximize Window           
             is FN, FN sensitive, reprogrammable, divertable, pos:3, group:0, gmask:0
         3: CLOSE                     , default: Close Application           => CLOSE                     
             is FN, FN sensitive, reprogrammable, divertable, pos:4, group:0, gmask:0
         4: Switch Screen             , default: Switch Presentation/Switch Screen => Switch Screen             
             is FN, FN sensitive, reprogrammable, divertable, pos:5, group:0, gmask:0
         5: Show Desktop              , default: Show Desktop                => Show Desktop              
             is FN, FN sensitive, reprogrammable, divertable, pos:6, group:0, gmask:0
         6: Search                    , default: Search Files                => Search                    
             is FN, FN sensitive, reprogrammable, divertable, pos:7, group:0, gmask:0
         7: MY HOME                   , default: HomePage                    => MY HOME                   
             is FN, FN sensitive, reprogrammable, divertable, pos:8, group:0, gmask:0
         8: MEDIA PLAYER              , default: Music                       => MEDIA PLAYER              
             is FN, FN sensitive, reprogrammable, divertable, pos:9, group:0, gmask:0
         9: Previous                  , default: Previous                    => Previous                  
             is FN, FN sensitive, divertable, pos:10, group:0, gmask:0
        10: Play/Pause                , default: Play/Pause                  => Play/Pause                
             is FN, FN sensitive, divertable, pos:11, group:0, gmask:0
        11: Next                      , default: Next                        => Next                      
             is FN, FN sensitive, divertable, pos:12, group:0, gmask:0
        12: Application Switcher      , default: Application Switcher        => Application Switcher      
             is FN, reprogrammable, divertable, pos:13, group:0, gmask:0
        13: SLEEP                     , default: Sleep                       => SLEEP                     
             is FN, reprogrammable, divertable, pos:14, group:0, gmask:0
        14: Mute                      , default: Mute                        => Mute                      
             nonstandard, divertable, pos:0, group:0, gmask:0
        15: Volume Down               , default: Volume Down                 => Volume Down               
             nonstandard, divertable, pos:0, group:0, gmask:0
        16: Volume Up                 , default: Volume Up                   => Volume Up                 
             nonstandard, divertable, pos:0, group:0, gmask:0
        17: Fn Left Click             , default: ShowUI                      => Fn Left Click             
             divertable, pos:0, group:0, gmask:0
        18: Left Button               , default: Left Click                  => Left Button               
             mse, pos:0, group:0, gmask:0
        19: Right Button              , default: Right Click                 => Right Button              
             mse, pos:0, group:0, gmask:0
     Battery: 50%, discharging, next level 20%.

I am not clear on what New FN Inversion is trying to achieve.

I think we need to be clear on precisely what is meant by inversion/swap. i.e. is this relative to the keyboard's default behavior or is it relative to a fixed understanding of what the top row of keys should mean (F1-F12)?

What makes sense to me, and which corresponded to the behavior with kernel 4.x, Solaar, and the k830 keyboard, is that "Swap Fx function" OFF meant the keyboard's default behavior was maintained.

The Logitech k830 keyboard is unusual in that the media functions are the default, while F1-F12 are secondary functions accessed through the FN key. This was true in kernel 4.x, but it got inverted in kernel 5.x, where Swap ON is required for the SAME behavior of maintaining the default functionality.

A picture may help: k830

Therefore swapping/inverting (Swap ON) the behavior logically (to me) results in accessing F1-F12 without the FN key. Currently, and only since kernel 5.x, this is no longer the case and this logic has been inverted. Now Swap OFF accesses F1-F12 without the FN key.

Similarly, since kernel 5.x, the logic and behavior of the Wheel Resolution setting has become the opposite of what it was in kernel 4.x.

So, what do you understand by Swap ON/OFF?

================= Yes, you're right, the latest version of Solaar sees the thumb button as the Multiplatform gesture button and can change its assigned behavior!

Making the thumb button's action a middle-click, importantly without removing the same action from the wheel click, makes most sense to me right now. Though the remapping is lost if Solaar is not running and the mouse is turned OFF/ON.

Can the settings be made to persist? Can other actions, such as user-specified keyboard shortcuts, be set?

pfps commented 4 years ago

The logitech documentation is quite clear. Fn inversion is on precisely when the function keys do the media (or other) actions unless (instead of when) the Fn key is depressed. The default flag has the same meaning, except that it is the behaviour when the device starts.. So Fn inversion does not mean "invert the default".

Solaar is going to follow this meaning. If Swap Fx function is on, the function keys do the media (or other) actions unless the Fn key is depressed.

As far as I can tell the Swap Fx function for the feature NEW FN INVERSION was implemented in the Solaar GUI in 2015 and the code for it has not changed since then.

My take on this is that Solaar is acting as designed and as described in the Logitech documentation, so it is not going to change. The K830 might be a bit unusual because it defaults to Fn inversion, but that is no reason for Solaar to change how Swap Fx function works for this keyboard.

pfps commented 4 years ago

Key (and button) remappings under REPROG CONTROLS V4 {1B04} do not persist when the device is turned off. If Solaar is running it will reimpose the mappings it has.

The feature PERSISTENT REMAPPABLE ACTION {1C00} might allow persistent key (or button) remapppings. If you want that investigated you will need to open a new issue. Action might take a while as documentation for the feature has to be obtained from Logitech.

pfps commented 4 years ago

Closing because Solaar is working as expected.

adatum commented 4 years ago

Fn inversion is on precisely when the function keys do the media (or other) actions unless (instead of when) the Fn key is depressed. The default flag has the same meaning, except that it is the behaviour when the device starts.. So Fn inversion does not mean "invert the default".

Solaar is going to follow this meaning. If Swap Fx function is on, the function keys do the media (or other) actions unless the Fn key is depressed.

If this is the case, it means Solaar's behavior was incorrect until kernel 5.0, at which point the behavior changed without changes to Solaar. Still sounds like something is fishy.

adatum commented 4 years ago

Note also that the tooltip for the "Swap Fx function" in the Solaar GUI supports the notion that it means "invert the default":

When set, the F1..F12 keys will activate their special function, and you must hold the FN key to activate their standard function.

When unset, the F1..F12 keys will activate their standard function, and you must hold the FN key to activate their special function.