pwr-Solaar / Solaar

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

CLI version no longer interacts with udev properly #1541

Closed S3NTYN3L closed 2 years ago

S3NTYN3L commented 2 years ago

Information

``` Solaar version 1.1.2 Unifying Receiver Device path : /dev/hidraw0 USB id : 046d:C52B Serial : A4DE9A0E Firmware : 24.11.B0036 Bootloader : 02.09 Other : AA.AC Has 1 paired device(s) out of a maximum of 6. Notifications: wireless, software present (0x000900) Device activity counters: 1=155 1: Wireless Touch Keyboard K400 Plus Device path : /dev/hidraw1 WPID : 404D Codename : K400 Plus Kind : keyboard Protocol : HID++ 4.1 Polling rate : 8 ms (125Hz) Serial number: 70CE825C Model ID: 404D00000000 Unit ID: 563AF230 Bootloader: BOT 22.02.B0002 Firmware: RQK 63.02.B0016 Other: The power switch is located on the top edge. Supports 24 HID++ 2.0 features: 0: ROOT {0000} 1: FEATURE SET {0001} 2: DEVICE FW VERSION {0003} Firmware: Bootloader BOT 22.02.B0002 404D6217AD40 Firmware: Firmware RQK 63.02.B0016 404D6217AD40 Firmware: Other Unit ID: 563AF230 Model ID: 404D00000000 Transport IDs: {'wpid': '404D'} 3: DEVICE NAME {0005} Name: Wireless Touch Keyboard K400 Plus Kind: keyboard 4: WIRELESS DEVICE STATUS {1D4B} 5: RESET {0020} 6: BATTERY STATUS {1000} Battery: 50%, discharging, next level 20%. 7: REPROG CONTROLS V4 {1B04} Key/Button Diversion (saved): {Volume Up:Regular, Show Desktop:Regular, Maximize Window:Regular, Switch Screen:Regular, Fn Left Click:Regular, Second Left Click:Regular, Volume Down:Regular, Mute:Regular, My Home:Regular, Play/Pause:Regular, Media Player:Regular, Next:Regular, Previous:Regular, Search:Regular, Sleep:Regular, Contextual Menu:Regular, Application Switcher:Regular, Back:Regular} Key/Button Diversion : {Volume Up:Regular, Show Desktop:Regular, Maximize Window:Regular, Switch Screen:Regular, Fn Left Click:Regular, Second Left Click:Regular, Volume Down:Regular, Mute:Regular, My Home:Regular, Play/Pause:Regular, Media Player:Regular, Next:Regular, Previous:Regular, Search:Regular, Sleep:Regular, Contextual Menu:Regular, Application Switcher:Regular, Back:Regular} 8: SWAP BUTTON CANCEL {2005} 9: NEW FN INVERSION {40A2} Fn-swap: enabled Fn-swap default: enabled Swap Fx function (saved): False Swap Fx function : True 10: ENCRYPTION {4100} 11: KEYBOARD DISABLE KEYS {4521} Disable keys (saved): {Caps Lock:False, Win:False, Scroll Lock:False, Insert:False} Disable keys : {Caps Lock:False, Scroll Lock:False, Insert:False, Win:False} 12: TOUCHPAD RAW XY {6100} 13: GESTURE 2 {6501} Gestures (saved): {'1': True, '10': True, '2': True, '30': True, '34': False, '42': True, '43': True, '45': False, '64': False, '65': False, '67': False, '84': True} Gestures : {'1': True, '2': True, '30': True, '10': True, '45': False, '42': True, '43': True, '64': False, '65': False, '67': False, '84': True, '34': False} Gestures Diversion (saved): {'1': False, '10': False, '100': False, '2': False, '44': False, '64': False, '65': False, '67': False, '84': False, '85': False} Gestures Diversion : {'1': False, '2': False, '10': False, '44': False, '64': False, '65': False, '67': False, '84': False, '85': False, '100': False} Gesture params (saved): {'4': {'scale': 256}} Gesture params : {'4': {'scale': 256}} 14: DFUCONTROL UNSIGNED {00C1} 15: unknown:1811 {1811} internal, hidden 16: unknown:1830 {1830} internal, hidden 17: unknown:1890 {1890} internal, hidden 18: unknown:1DF3 {1DF3} internal, hidden 19: unknown:1E00 {1E00} hidden 20: unknown:1EB0 {1EB0} internal, hidden 21: unknown:1861 {1861} internal, hidden 22: unknown:18B0 {18B0} internal, hidden 23: unknown:1F11 {1F11} internal, hidden Has 20 reprogrammable keys: 0: Second Left Click , default: Left Click => Left Click mse, divertable, pos:0, group:0, group mask:empty reporting: default 1: Back , default: Mouse Back Button => Mouse Back Button is FN, FN sensitive, reprogrammable, divertable, pos:1, group:0, group mask:empty reporting: default 2: My Home , default: HomePage => HomePage is FN, FN sensitive, reprogrammable, divertable, pos:2, group:0, group mask:empty reporting: default 3: Application Switcher , default: Application Switcher => Application Switcher is FN, FN sensitive, reprogrammable, divertable, pos:3, group:0, group mask:empty reporting: default 4: Contextual Menu , default: Right Click => Right Click is FN, FN sensitive, reprogrammable, divertable, pos:4, group:0, group mask:empty reporting: default 5: Search , default: Search Files => Search Files is FN, FN sensitive, reprogrammable, divertable, pos:5, group:0, group mask:empty reporting: default 6: Show Desktop , default: Show Desktop => Show Desktop is FN, FN sensitive, reprogrammable, divertable, pos:6, group:0, group mask:empty reporting: default 7: Maximize Window , default: Maximize Window => Maximize Window is FN, FN sensitive, reprogrammable, divertable, pos:7, group:0, group mask:empty reporting: default 8: Switch Screen , default: Switch Presentation/Switch Screen => Switch Presentation/Switch Screen is FN, FN sensitive, reprogrammable, divertable, pos:8, group:0, group mask:empty reporting: default 9: Media Player , default: Music => Music is FN, FN sensitive, reprogrammable, divertable, pos:9, group:0, group mask:empty reporting: default 10: Previous , default: Previous => Previous is FN, FN sensitive, divertable, pos:10, group:0, group mask:empty reporting: default 11: Play/Pause , default: Play/Pause => Play/Pause is FN, FN sensitive, divertable, pos:11, group:0, group mask:empty reporting: default 12: Next , default: Next => Next is FN, FN sensitive, divertable, pos:12, group:0, group mask:empty reporting: default 13: Fn Left Click , default: ShowUI => ShowUI divertable, pos:0, group:0, group mask:empty reporting: default 14: Left Button , default: Left Click => Left Click mse, pos:0, group:0, group mask:empty reporting: default 15: Right Button , default: Right Click => Right Click mse, pos:0, group:0, group mask:empty reporting: default 16: Mute , default: Mute => Mute nonstandard, divertable, pos:0, group:0, group mask:empty reporting: default 17: Volume Up , default: Volume Up => Volume Up nonstandard, divertable, pos:0, group:0, group mask:empty reporting: default 18: Volume Down , default: Volume Down => Volume Down nonstandard, divertable, pos:0, group:0, group mask:empty reporting: default 19: Sleep , default: Sleep => Sleep reprogrammable, divertable, pos:0, group:0, group mask:empty reporting: default Has 17 gesture(s), 1 param(s) and 5 spec(s): Track1Finger Enabled(None): None Diverted:(None) None TapGestures Enabled(None): None Diverted:(None) None Tap1Finger Enabled( 0): True Diverted:( 0) False Tap2Finger Enabled( 1): True Diverted:( 1) False TapDrag1Finger Enabled( 2): True Diverted:(None) None DoubleTap1Finger Enabled( 3): True Diverted:( 2) False Scroll2FingerStateless Enabled(None): None Diverted:( 3) False NaturalScrolling Enabled( 4): False Diverted:(None) None Scroll2FingerHoriz Enabled( 5): True Diverted:(None) None Scroll2FingerVert Enabled( 6): True Diverted:(None) None LeftEdgeSwipe1Finger2 Enabled( 7): False Diverted:( 4) False RightEdgeSwipe1Finger2 Enabled( 8): False Diverted:( 5) False TopEdgeSwipe1Finger2 Enabled( 9): False Diverted:( 6) False Zoom2FingerStateless Enabled( 10): True Diverted:( 7) False FnClickGestureSuppression Enabled( 11): False Diverted:(None) None TwoFingersPresent Enabled(None): None Diverted:( 8) False DeviceSpecificRawData Enabled(None): None Diverted:( 9) False ScaleFactor Value ( 0): 256 [Default: 256] period unit Spec ( 3): 2048 DVI field width Spec ( 1): 8 field widths Spec ( 2): 8 multiplier Spec ( 5): None resolution Spec ( 4): 4 Battery: 50%, discharging, next level 20%. ```

Describe the bug While Issue #1535 seems to have been fixed with PR #1536 my udev rule no longer reapplies settings upon keyboard power cycle.

To Reproduce Steps to reproduce the behavior:

1. Create a script at `/usr/local/bin/forcesolaarconfig.sh` with the contents ``` #!/bin/bash solaar config 1 fn-swap 0 echo "Solaar configuration applied at: $(date)" >> /tmp/solaar.log ``` Be sure to make it executable with `chmod 0755 forcesolaarconfig.sh` 2. Create a udev rule at `/etc/udev/rules.d/99-forcesolaarconfig.rules` with the contents ``` ACTION=="change", SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_SERIAL_NUMBER}=="404d*", RUN+="/usr/local/bin/forcesolaarconfig.sh" ``` Where `ENV{POWER_SUPPLY_SERIAL_NUMBER}=="404d*"` can be found by running `udevadm monitor -u -p -s power_supply` and power cycling the keyboard or using the first bit from `MODEL ID` in `solaar show` output. 3. Reload udev rules with `udevadm control --reload-rules` 4. Now run `solaar config 1 fn-swap 0` and press an F key, say F3, to trigger its functionality. Eg; F3 = find 5. Power cycle the keyboard. 6. Notice that pressing F3 no longer triggers the find dialog but (as in my case) the system's application window switcher. 7. Navigating to `/tmp` confirms udev was indeed triggered as `solaar.log` was created containing a timestamp but Solaar settings were not reapplied.

Additional context I know I was running version 1.0.6 last summer and the above was working as intended. IIRC, Solaar had a few minor updates between then and a week or so ago and the above was still working just fine. I think I might have been on 1.1.1 from January up until about a week ago, but I'm not really sure so I can't confirm if above works there or not. Apt didn't have it listed when I was playing around with downgrading and whatnot yesterday. At any rate, something in the code changed and I'm eager to get it sorted. Thanks in advance.

pfps commented 2 years ago

There might be a problem with timing here. Solaar might be sending a device command while the device is still starting up and the command is ignored. You could try to add a short (1 second?) pause in the script. You could also run the Solaar config command with debugging turned on -ddd and send its output to a file.

You could also look at the responses the device is sending. Find out which hidraw node your receiver is using by running the Solaar GUI and opening the info pane for the receiver. THe hidraw node is show as the Path value. From the Solaar directory run ./tools/hidconsole in a terminal window. Make sure that the Solaar GUI is not running. Then run your script. The last two lines of output from hidconsole should be the device responding to two commands from Solaar - the last line should be the device saying that it has changed the value for fn-swap and the second-last line should be the device saying what its value for fn-swap was at the time. So something like

11 01 090X 0W00...
11 01 091Y 0V00..

Then turn the device off and on. There should again be two lines like the above.

Also, make sure that the Solaar that is being run from the udev rule has PR #1536 applied. (Yes, you've done this, but please make sure.)

pfps commented 2 years ago

Aah, I think I know what is going on. Solaar config now tries to coordinate with the Solaar GUI, if running, so that they do not become confused as to what settings should be retained. However, this might not be possible inside a udev rule.

So please arrange to have debugging output captured from your script and post that here.

S3NTYN3L commented 2 years ago

So please arrange to have debugging output captured from your script and post that here.

How exactly? I just purged the PPA install from my system (was updated yesterday a few hours after PR #1536 was merged by the maintainer). I cloned the lasted repo from git just now. Am I to leave the udev rule in etc or should I move it into the rules.d directory in the repo? I'm a bit confused on how to do this without a "proper" install.

EDIT: FWIW, we're on hidraw1

pfps commented 2 years ago

You should be able to run Solaar from where you cloned it by changing your script to use a file path (/bin/solaar). You should also be able to redirect the output from the Solaar command to a file. So the script should look something like:

#!/bin/bash
<Solaar dir>/bin/solaar -ddd config 1 fn-swap 0 &> /tmp/solaar-config.txt
echo "Solaar configuration applied at: $(date)" >> /tmp/solaar.log

I expect that there will be an error message in /tmp/solaar-config.txt complaining about not being able to do some GTK action.

S3NTYN3L commented 2 years ago

OK, I power cycled the keyboard so settings got reset to default/unwanted. I then ran the script and here's the output;

``` 08:56:16,140 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 08:56:16,140 INFO [MainThread] logitech_receiver.base: New lock 3 08:56:16,140 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 08:56:16,143 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 08:56:16,143 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 08:56:16,145 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 08:56:16,147 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 08:56:16,149 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 08:56:16,149 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 08:56:16,149 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => 08:56:16,223 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 08:56:16,225 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 08:56:16,226 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 08:56:16,226 DEBUG [MainThread] logitech_receiver.base: (8) pinging device 1 08:56:16,226 INFO [MainThread] logitech_receiver.base: New lock 8 08:56:16,226 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 0018 0000FA00000000000000000000000000] 08:56:17,547 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 0018 0401FA00000000000000000000000000] 08:56:17,547 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000B 00010000000000000000000000000000] 08:56:17,567 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000B 01000100000000000000000000000000] 08:56:17,567 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 010F 00000000000000000000000000000000] 08:56:17,587 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 010F 17000000000000000000000000000000] 08:56:17,587 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000C 40A00000000000000000000000000000] 08:56:17,607 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000C 00000000000000000000000000000000] 08:56:17,607 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000E 40A20000000000000000000000000000] 08:56:17,629 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000E 09000000000000000000000000000000] 08:56:17,629 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected 08:56:17,674 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 300000] 08:56:17,677 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 3070CE825C1E40000009000000000000] 08:56:17,673 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings write False to 08:56:17,677 DEBUG [MainThread] solaar.configuration: load => {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} 08:56:17,678 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000E 00030000000000000000000000000000] 08:56:17,729 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000E 02000100000000000000000000000000] 08:56:17,729 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 020F 00000000000000000000000000000000] 08:56:17,749 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 020F 03563AF2300004404D00000000000000] 08:56:17,749 INFO [MainThread] logitech_receiver.device: : unitId 563AF230 does not match serial 70CE825C 08:56:17,750 INFO [MainThread] solaar.configuration: saved {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} to /root/.config/solaar/config.json 08:56:17,750 DEBUG [MainThread] logitech_receiver.settings: BooleanValidator: prepare_write(False, None) => b'\x00' 08:56:17,750 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings prepare write(False) => b'\x00' 08:56:17,750 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 091C 00000000000000000000000000000000] 08:56:17,769 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 091C 00010000000000000000000000000000] Setting fn-swap of Wireless Touch Keyboard K400 Plus to False ```

Oddly enough, it did change the settings. It's just NOT doing it from either the git or stable PPA installs for some reason. Were they not updated? I could have sworn the commit tags matched. (from the git PPA 1.1.2+git1662-693db1d~ubuntu20.04.1)

EDIT: OK, GUI said hidraw1 but above CLI output says hidraw0...

pfps commented 2 years ago

The stable PPA hasn't been updated with the fix to Solaar config. The git PPA may lag a bit.

There are two issues in play here. Solaar config fails for fn-swap in Solaar 1.1.2. This is fixed in PR #1535. Solaar 1.1.2 config will also fail if it cannot set up a GTK application. This has not yet been fixed. It is not clear whether running Solaar config under udev causes this latter issue. Is the output above from a udev rule invocation of Solaar config?

There can be two hidraw nodes for a device, one for the receiver and one for the device itself. The former has all communication going through the receiver, even communication intended for attached devices. The latter has only the communication for the device itself. The Solaar GUI uses mostly the device-specific node to communicate with devices.

S3NTYN3L commented 2 years ago

Is the output above from a udev rule invocation of Solaar config?

I'm not quite sure. Is the following the wrong way to do this?

I have the script sitting in /usr/local/bin. It looks like this;

#!/bin/bash
sleep 1
/home/redqueen/Downloads/Solaar/bin/solaar -ddd config 1 fn-swap 0 &> /tmp/solaar-config.txt
echo "Solaar configuration applied at: $(date)" >> /tmp/solaar.log

The installed git PPA version was purged from the system. I cloned this github repo to /home/redqueen/Downloads/Solaar. I power cycled the keyboard so the settings reset to unwanted defaults. I open a terminal as root, navigate to script dir and root@REDQUEEN:/usr/local/bin# ./forcesolaarconfig.sh

pfps commented 2 years ago

Yes that runs the script correctly. But does this new script work correctly when triggered from your udev rule?

S3NTYN3L commented 2 years ago

I'm not sure how to run it without actually installing Solaar. If you mean, does it run when simply power cycling the keyboard, no.

pfps commented 2 years ago

The udev rule runs your script /usr/local/bin/forcesolaarconfig.sh which should now run Solaar out of the Solaar directory. So you should be able to just power cycle the keyboard. Or will udev rules not run executables that are in user directories?

S3NTYN3L commented 2 years ago

I don't know. That's why I was asking a few comments back about the rules.d directory in the cloned repo.

pfps commented 2 years ago

Perhaps just try turning the device off and on and see whether you get something new in /tmp/solaar.log. If not, try removing the sleep from the script.

S3NTYN3L commented 2 years ago

Silly, silly me. I must need more coffee. Yes, there's new ouput;

``` 09:51:28,214 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 09:51:28,214 INFO [MainThread] logitech_receiver.base: New lock 3 09:51:28,214 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 09:51:28,216 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 09:51:28,216 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 09:51:28,218 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 09:51:28,220 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 09:51:28,222 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 09:51:28,222 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 09:51:28,222 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused 09:51:28,292 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 09:51:28,296 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 09:51:28,297 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 09:51:28,297 DEBUG [MainThread] logitech_receiver.base: (5) pinging device 1 09:51:28,297 INFO [MainThread] logitech_receiver.base: New lock 5 09:51:28,297 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 001B 0000EA00000000000000000000000000] 09:51:28,314 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 001B 0401EA00000000000000000000000000] 09:51:28,314 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000A 00010000000000000000000000000000] 09:51:28,330 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000A 01000100000000000000000000000000] 09:51:28,330 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 0108 00000000000000000000000000000000] 09:51:28,346 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 0108 17000000000000000000000000000000] 09:51:28,346 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000B 40A00000000000000000000000000000] 09:51:28,362 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000B 00000000000000000000000000000000] 09:51:28,362 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000D 40A20000000000000000000000000000] 09:51:28,378 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000D 09000000000000000000000000000000] 09:51:28,378 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected Unable to init server: Could not connect: Connection refused (solaar:42110): Gtk-WARNING **: 09:51:28.380: cannot open display: ```
pfps commented 2 years ago

Yes it appears that the problem is that GTK applications cannot be set up when running from a udev rule. Not too surprising, I guess. PR #1542 should fix this problem. Just set up the PR and try turning your keyboard off and on. The output in /tmp should no longer have the error and the setting should be set appropriately.

To clone and use Solar from its GitHub repository

git clone https://github.com/pwr-Solaar/Solaar.git
cd Solaar

Run Solaar as bin/solaar from this directory.

To run PR #1542, first clone Solaar if you have not already done so and cd to the clone directory. The first time you download the pull request, fetch it into a new branch and checkout that branch, as in:

git fetch origin pull/1542/head:pull_1542
git checkout pull_1542

To download a new version of the pull request, fetch it and then set your pull branch to the new fetch, as in:

git checkout pull_1542
git fetch origin pull/1542/head
git reset --hard FETCH_HEAD
pfps commented 2 years ago

Well, an exception will still likely show up but it should be handled and the setting should be set correctly.

S3NTYN3L commented 2 years ago

Latest ouput;

``` 10:15:51,123 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 10:15:51,123 INFO [MainThread] logitech_receiver.base: New lock 3 10:15:51,124 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 10:15:51,126 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 10:15:51,126 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 10:15:51,128 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 10:15:51,130 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 10:15:51,132 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 10:15:51,132 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 10:15:51,132 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused 10:15:51,204 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 10:15:51,206 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 10:15:51,207 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 10:15:51,207 DEBUG [MainThread] logitech_receiver.base: (5) pinging device 1 10:15:51,208 INFO [MainThread] logitech_receiver.base: New lock 5 10:15:51,208 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 0018 0000C200000000000000000000000000] 10:15:51,222 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 0018 0401C200000000000000000000000000] 10:15:51,222 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000B 00010000000000000000000000000000] 10:15:51,238 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000B 01000100000000000000000000000000] 10:15:51,238 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 010F 00000000000000000000000000000000] 10:15:51,254 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 010F 17000000000000000000000000000000] 10:15:51,254 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 0008 40A00000000000000000000000000000] 10:15:51,270 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 0008 00000000000000000000000000000000] 10:15:51,270 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000C 40A20000000000000000000000000000] 10:15:51,286 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000C 09000000000000000000000000000000] 10:15:51,286 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected Unable to init server: Could not connect: Connection refused (solaar:42356): Gtk-WARNING **: 10:15:51.288: cannot open display: ```

EDIT; Sorry, I neglected to mention that settings were not updated.

pfps commented 2 years ago

The problem is that a function currently used does a hard stop instead of throwing an exception if problems are encountered.

pfps commented 2 years ago

The current version of PR #1542 should (!) work. Please download and try it out.

S3NTYN3L commented 2 years ago

When running script manually;

``` 11:34:36,596 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 11:34:36,596 INFO [MainThread] logitech_receiver.base: New lock 3 11:34:36,596 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 11:34:36,599 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 11:34:36,599 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 11:34:36,601 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 11:34:36,603 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 11:34:36,605 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 11:34:36,605 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 11:34:36,605 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => 11:34:36,681 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 11:34:36,683 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 11:34:36,685 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 11:34:36,685 DEBUG [MainThread] logitech_receiver.base: (8) pinging device 1 11:34:36,685 INFO [MainThread] logitech_receiver.base: New lock 8 11:34:36,686 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 001A 0000FB00000000000000000000000000] 11:34:37,993 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 001A 0401FB00000000000000000000000000] 11:34:37,994 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000C 00010000000000000000000000000000] 11:34:38,013 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000C 01000100000000000000000000000000] 11:34:38,013 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 0108 00000000000000000000000000000000] 11:34:38,033 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 0108 17000000000000000000000000000000] 11:34:38,033 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000B 40A00000000000000000000000000000] 11:34:38,053 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000B 00000000000000000000000000000000] 11:34:38,053 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000D 40A20000000000000000000000000000] 11:34:38,073 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000D 09000000000000000000000000000000] 11:34:38,073 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected 11:34:38,120 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 300000] 11:34:38,121 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 3070CE825C1E40000009000000000000] 11:34:38,119 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings write False to 11:34:38,122 DEBUG [MainThread] solaar.configuration: load => {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} 11:34:38,122 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000F 00030000000000000000000000000000] 11:34:38,173 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000F 02000100000000000000000000000000] 11:34:38,173 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 020A 00000000000000000000000000000000] 11:34:38,193 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 020A 03563AF2300004404D00000000000000] 11:34:38,193 INFO [MainThread] logitech_receiver.device: : unitId 563AF230 does not match serial 70CE825C 11:34:38,194 INFO [MainThread] solaar.configuration: saved {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} to /root/.config/solaar/config.json 11:34:38,194 DEBUG [MainThread] logitech_receiver.settings: BooleanValidator: prepare_write(False, None) => b'\x00' 11:34:38,194 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings prepare write(False) => b'\x00' 11:34:38,194 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 0919 00000000000000000000000000000000] 11:34:38,213 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 0919 00010000000000000000000000000000] Setting fn-swap of Wireless Touch Keyboard K400 Plus to False ```

When running from udev via power cycle;

``` 11:37:07,971 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 11:37:07,972 INFO [MainThread] logitech_receiver.base: New lock 3 11:37:07,972 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 11:37:07,975 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 11:37:07,976 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 11:37:07,977 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 11:37:07,979 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 11:37:07,981 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 11:37:07,981 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 11:37:07,981 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused 11:37:08,053 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 11:37:08,055 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 11:37:08,057 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 11:37:08,057 DEBUG [MainThread] logitech_receiver.base: (5) pinging device 1 11:37:08,057 INFO [MainThread] logitech_receiver.base: New lock 5 11:37:08,057 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 001F 0000EE00000000000000000000000000] 11:37:08,069 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 001F 0401EE00000000000000000000000000] 11:37:08,069 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000C 00010000000000000000000000000000] 11:37:08,085 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000C 01000100000000000000000000000000] 11:37:08,086 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 010E 00000000000000000000000000000000] 11:37:08,101 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 010E 17000000000000000000000000000000] 11:37:08,102 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 0009 40A00000000000000000000000000000] 11:37:08,117 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 0009 00000000000000000000000000000000] 11:37:08,118 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000C 40A20000000000000000000000000000] 11:37:08,133 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000C 09000000000000000000000000000000] 11:37:08,134 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused (solaar:43519): Gtk-WARNING **: 11:37:08.136: cannot open display: ```
pfps commented 2 years ago

Weird. I'm not seeing the unable to init server messages. (But I'm not running under udev, just without a display.)

Download the current version of the PR using

git checkout pull_1542
git fetch origin pull/1542/head
git reset --hard FETCH_HEAD

and try again.

S3NTYN3L commented 2 years ago

HEAD is now at 416aa7f Manually;

``` 11:52:33,557 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 11:52:33,558 INFO [MainThread] logitech_receiver.base: New lock 3 11:52:33,558 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 11:52:33,561 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 11:52:33,561 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 11:52:33,563 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 11:52:33,565 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 11:52:33,567 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 11:52:33,567 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 11:52:33,567 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => 11:52:33,645 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 11:52:33,647 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 11:52:33,649 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 11:52:33,649 DEBUG [MainThread] logitech_receiver.base: (8) pinging device 1 11:52:33,649 INFO [MainThread] logitech_receiver.base: New lock 8 11:52:33,649 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 001E 0000CF00000000000000000000000000] 11:52:33,679 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 001E 0401CF00000000000000000000000000] 11:52:33,680 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000C 00010000000000000000000000000000] 11:52:33,699 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000C 01000100000000000000000000000000] 11:52:33,699 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 010D 00000000000000000000000000000000] 11:52:33,719 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 010D 17000000000000000000000000000000] 11:52:33,719 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 0008 40A00000000000000000000000000000] 11:52:33,739 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 0008 00000000000000000000000000000000] 11:52:33,739 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000B 40A20000000000000000000000000000] 11:52:33,761 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000B 09000000000000000000000000000000] 11:52:33,761 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected 11:52:33,808 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 300000] 11:52:33,811 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 3070CE825C1E40000009000000000000] 11:52:33,808 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings write False to 11:52:33,812 DEBUG [MainThread] solaar.configuration: load => {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} 11:52:33,812 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000F 00030000000000000000000000000000] 11:52:33,861 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000F 02000100000000000000000000000000] 11:52:33,861 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 0209 00000000000000000000000000000000] 11:52:33,881 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 0209 03563AF2300004404D00000000000000] 11:52:33,881 INFO [MainThread] logitech_receiver.device: : unitId 563AF230 does not match serial 70CE825C 11:52:33,882 INFO [MainThread] solaar.configuration: saved {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} to /root/.config/solaar/config.json 11:52:33,882 DEBUG [MainThread] logitech_receiver.settings: BooleanValidator: prepare_write(False, None) => b'\x00' 11:52:33,882 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings prepare write(False) => b'\x00' 11:52:33,882 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 091A 00000000000000000000000000000000] 11:52:33,901 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 091A 00010000000000000000000000000000] checking connection to Solaar GUI connection to Solaar GUI False Setting fn-swap of Wireless Touch Keyboard K400 Plus to False ```

Power cycle;

``` 11:53:32,927 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 11:53:32,928 INFO [MainThread] logitech_receiver.base: New lock 3 11:53:32,928 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 11:53:32,930 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 11:53:32,930 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 11:53:32,932 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 11:53:32,934 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 11:53:32,936 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 11:53:32,936 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 11:53:32,936 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused 11:53:33,007 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 11:53:33,010 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 11:53:33,011 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 11:53:33,011 DEBUG [MainThread] logitech_receiver.base: (5) pinging device 1 11:53:33,011 INFO [MainThread] logitech_receiver.base: New lock 5 11:53:33,011 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 001A 0000F000000000000000000000000000] 11:53:33,026 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 001A 0401F000000000000000000000000000] 11:53:33,026 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000D 00010000000000000000000000000000] 11:53:33,042 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000D 01000100000000000000000000000000] 11:53:33,042 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 010C 00000000000000000000000000000000] 11:53:33,058 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 010C 17000000000000000000000000000000] 11:53:33,058 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 0009 40A00000000000000000000000000000] 11:53:33,076 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 0009 00000000000000000000000000000000] 11:53:33,076 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000C 40A20000000000000000000000000000] 11:53:33,092 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000C 09000000000000000000000000000000] 11:53:33,092 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused (solaar:43814): Gtk-WARNING **: 11:53:33.094: cannot open display: ```
pfps commented 2 years ago

Bizaare. I'll have to chase down the problem with some more print statements. :-(

Download the PR and try again.

S3NTYN3L commented 2 years ago

HEAD is now at 97a2f68 Manually;

``` 12:12:40,894 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 12:12:40,894 INFO [MainThread] logitech_receiver.base: New lock 3 12:12:40,894 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 12:12:40,897 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 12:12:40,897 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 12:12:40,899 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 12:12:40,901 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 12:12:40,903 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 12:12:40,903 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 12:12:40,903 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => 12:12:40,991 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 12:12:40,993 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 12:12:40,994 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 12:12:40,994 DEBUG [MainThread] logitech_receiver.base: (11) pinging device 1 12:12:40,994 INFO [MainThread] logitech_receiver.base: New lock 11 12:12:40,994 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 001F 0000BA00000000000000000000000000] 12:12:42,301 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 001F 0401BA00000000000000000000000000] 12:12:42,301 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 000C 00010000000000000000000000000000] 12:12:42,321 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 000C 01000100000000000000000000000000] 12:12:42,321 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 010C 00000000000000000000000000000000] 12:12:42,341 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 010C 17000000000000000000000000000000] 12:12:42,341 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 0008 40A00000000000000000000000000000] 12:12:42,361 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 0008 00000000000000000000000000000000] 12:12:42,361 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 000F 40A20000000000000000000000000000] 12:12:42,381 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 000F 09000000000000000000000000000000] 12:12:42,381 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected 12:12:42,416 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 300000] 12:12:42,419 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 3070CE825C1E40000009000000000000] 12:12:42,416 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings write False to 12:12:42,419 DEBUG [MainThread] solaar.configuration: load => {'404D:70CE825C': {'_absent': ['hi-res-scroll', 'lowres-smooth-scroll', 'hires-smooth-invert', 'hires-smooth-resolution', 'smart-shift', 'thumb-scroll-mode', 'thumb-scroll-invert', 'onboard_profiles', 'report_rate', 'pointer_speed', 'dpi', 'dpi-sliding', 'speed-change', 'mouse-gestures', 'backlight', 'backlight-timed', 'reprogrammable-keys', 'persistent-remappable-keys', 'divert-crown', 'crown-smooth', 'divert-gkeys', 'm-key-leds', 'mr-key-led', 'multiplatform', 'change-host'], '_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_sensitive': {'disable-keyboard-keys': False, 'divert-keys': False, 'fn-swap': True, 'gesture2-divert': False, 'gesture2-gestures': False, 'gesture2-params': False}, '_serial': '70CE825C', '_unitId': '563AF230', 'disable-keyboard-keys': {'1': False, '16': False, '4': False, '8': False}, 'divert-keys': {'1': 0, '110': 0, '145': 0, '149': 0, '183': 0, '184': 0, '2': 0, '3': 0, '34': 0, '4': 0, '40': 0, '5': 0, '6': 0, '62': 0, '64': 0, '79': 0, '8': 0, '84': 0}, 'fn-swap': False, 'gesture2-divert': {'1': False, '10': False, '100': False, '2': False, '44': False, '64': False, '65': False, '67': False, '84': False, '85': False}, 'gesture2-gestures': {'1': True, '10': True, '2': True, '30': True, '34': False, '42': True, '43': True, '45': False, '64': False, '65': False, '67': False, '84': True}, 'gesture2-params': {'4': {'scale': 256}}}, '_version': '1.1.2'} 12:12:42,419 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 000B 00030000000000000000000000000000] 12:12:42,481 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 000B 02000100000000000000000000000000] 12:12:42,481 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 020D 00000000000000000000000000000000] 12:12:42,501 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 020D 03563AF2300004404D00000000000000] 12:12:42,501 INFO [MainThread] logitech_receiver.device: : unitId 563AF230 does not match serial 70CE825C 12:12:42,502 INFO [MainThread] solaar.configuration: saved {'404D:70CE825C': {'_absent': ['hi-res-scroll', 'lowres-smooth-scroll', 'hires-smooth-invert', 'hires-smooth-resolution', 'smart-shift', 'thumb-scroll-mode', 'thumb-scroll-invert', 'onboard_profiles', 'report_rate', 'pointer_speed', 'dpi', 'dpi-sliding', 'speed-change', 'mouse-gestures', 'backlight', 'backlight-timed', 'reprogrammable-keys', 'persistent-remappable-keys', 'divert-crown', 'crown-smooth', 'divert-gkeys', 'm-key-leds', 'mr-key-led', 'multiplatform', 'change-host'], '_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_sensitive': {'disable-keyboard-keys': False, 'divert-keys': False, 'fn-swap': True, 'gesture2-divert': False, 'gesture2-gestures': False, 'gesture2-params': False}, '_serial': '70CE825C', '_unitId': '563AF230', 'disable-keyboard-keys': {'1': False, '16': False, '4': False, '8': False}, 'divert-keys': {'1': 0, '110': 0, '145': 0, '149': 0, '183': 0, '184': 0, '2': 0, '3': 0, '34': 0, '4': 0, '40': 0, '5': 0, '6': 0, '62': 0, '64': 0, '79': 0, '8': 0, '84': 0}, 'fn-swap': False, 'gesture2-divert': {'1': False, '10': False, '100': False, '2': False, '44': False, '64': False, '65': False, '67': False, '84': False, '85': False}, 'gesture2-gestures': {'1': True, '10': True, '2': True, '30': True, '34': False, '42': True, '43': True, '45': False, '64': False, '65': False, '67': False, '84': True}, 'gesture2-params': {'4': {'scale': 256}}}, '_version': '1.1.2'} to /home/redqueen/.config/solaar/config.json 12:12:42,502 DEBUG [MainThread] logitech_receiver.settings: BooleanValidator: prepare_write(False, None) => b'\x00' 12:12:42,502 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings prepare write(False) => b'\x00' 12:12:42,502 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 0918 00000000000000000000000000000000] 12:12:42,523 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 0918 00010000000000000000000000000000] STARTING CONFIG FOUND DEVICE Wireless Touch Keyboard K400 Plus Setting name fn-swap Setting class fn-swap Setting fn-swap Checking connection to Solaar GUI connection to Solaar GUI False Setting fn-swap of Wireless Touch Keyboard K400 Plus to False ```

Power cycle;

``` 12:14:06,386 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 12:14:06,387 INFO [MainThread] logitech_receiver.base: New lock 3 12:14:06,387 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 12:14:06,389 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 12:14:06,389 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 12:14:06,391 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 12:14:06,393 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 12:14:06,395 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 12:14:06,395 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 12:14:06,395 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused 12:14:06,469 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 12:14:06,473 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 12:14:06,474 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 12:14:06,474 DEBUG [MainThread] logitech_receiver.base: (5) pinging device 1 12:14:06,474 INFO [MainThread] logitech_receiver.base: New lock 5 12:14:06,474 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 001A 0000AB00000000000000000000000000] 12:14:06,487 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 001A 0401AB00000000000000000000000000] 12:14:06,487 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000E 00010000000000000000000000000000] 12:14:06,503 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000E 01000100000000000000000000000000] 12:14:06,503 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 010C 00000000000000000000000000000000] 12:14:06,519 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 010C 17000000000000000000000000000000] 12:14:06,519 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000B 40A00000000000000000000000000000] 12:14:06,535 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000B 00000000000000000000000000000000] 12:14:06,535 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000C 40A20000000000000000000000000000] 12:14:06,551 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000C 09000000000000000000000000000000] 12:14:06,551 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused (solaar:44195): Gtk-WARNING **: 12:14:06.553: cannot open display: ```

Progress it seems. Manual run looks to be writing to user .config instead of root .config. :/

pfps commented 2 years ago

The problem is that the power cycle run isn't outputting any stdout output. That's either because it is using a different version of Solaar (make sure that the correct script is being invoked and that the script is running Solaar from your clone directory) or because stdout isn't being redirected correctly.

The newest version of the PR should produce better interleaving of stdout and stderr.

S3NTYN3L commented 2 years ago

Want me to move the script from /usr/local/bin to repo directory?

pfps commented 2 years ago

No, just make sure that the script is running Solaar from the repo directory. (That's almost certainly true but checking is a good idea.)

S3NTYN3L commented 2 years ago

Just double checked script is as follows:

 #!/bin/bash
sleep 1
/home/redqueen/Downloads/Solaar/bin/solaar -ddd config 1 fn-swap 0 &> /tmp/solaar-config.txt

HEAD is now at d0232bf Manually;

``` 14:18:11,184 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 14:18:11,184 INFO [MainThread] logitech_receiver.base: New lock 3 14:18:11,184 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 14:18:11,187 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 14:18:11,187 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 14:18:11,189 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 14:18:11,191 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 14:18:11,192 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 14:18:11,193 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 14:18:11,193 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => STARTING CONFIG 14:18:11,285 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 14:18:11,289 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 14:18:11,290 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 14:18:11,290 DEBUG [MainThread] logitech_receiver.base: (11) pinging device 1 14:18:11,290 INFO [MainThread] logitech_receiver.base: New lock 11 14:18:11,290 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 001D 00002F00000000000000000000000000] 14:18:11,323 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 001D 04012F00000000000000000000000000] FOUND DEVICE Wireless Touch Keyboard K400 Plus Setting name fn-swap 14:18:11,323 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 0009 00010000000000000000000000000000] 14:18:11,343 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 0009 01000100000000000000000000000000] 14:18:11,343 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 010C 00000000000000000000000000000000] 14:18:11,363 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 010C 17000000000000000000000000000000] 14:18:11,363 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 000E 40A00000000000000000000000000000] 14:18:11,383 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 000E 00000000000000000000000000000000] 14:18:11,383 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 0009 40A20000000000000000000000000000] 14:18:11,403 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 0009 09000000000000000000000000000000] 14:18:11,403 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected Setting class fn-swap Setting fn-swap Checking connection to Solaar GUI connection to Solaar GUI False 14:18:11,437 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 300000] 14:18:11,441 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 3070CE825C1E40000009000000000000] 14:18:11,437 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings write False to 14:18:11,441 DEBUG [MainThread] solaar.configuration: load => {'404D:70CE825C': {'_absent': ['hi-res-scroll', 'lowres-smooth-scroll', 'hires-smooth-invert', 'hires-smooth-resolution', 'smart-shift', 'thumb-scroll-mode', 'thumb-scroll-invert', 'onboard_profiles', 'report_rate', 'pointer_speed', 'dpi', 'dpi-sliding', 'speed-change', 'mouse-gestures', 'backlight', 'backlight-timed', 'reprogrammable-keys', 'persistent-remappable-keys', 'divert-crown', 'crown-smooth', 'divert-gkeys', 'm-key-leds', 'mr-key-led', 'multiplatform', 'change-host'], '_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_sensitive': {'disable-keyboard-keys': False, 'divert-keys': False, 'fn-swap': True, 'gesture2-divert': False, 'gesture2-gestures': False, 'gesture2-params': False}, '_serial': '70CE825C', '_unitId': '563AF230', 'disable-keyboard-keys': {'1': False, '16': False, '4': False, '8': False}, 'divert-keys': {'1': 0, '110': 0, '145': 0, '149': 0, '183': 0, '184': 0, '2': 0, '3': 0, '34': 0, '4': 0, '40': 0, '5': 0, '6': 0, '62': 0, '64': 0, '79': 0, '8': 0, '84': 0}, 'fn-swap': False, 'gesture2-divert': {'1': False, '10': False, '100': False, '2': False, '44': False, '64': False, '65': False, '67': False, '84': False, '85': False}, 'gesture2-gestures': {'1': True, '10': True, '2': True, '30': True, '34': False, '42': True, '43': True, '45': False, '64': False, '65': False, '67': False, '84': True}, 'gesture2-params': {'4': {'scale': 256}}}, '_version': '1.1.2'} 14:18:11,441 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 000B 00030000000000000000000000000000] 14:18:11,505 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 000B 02000100000000000000000000000000] 14:18:11,505 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 020A 00000000000000000000000000000000] 14:18:11,525 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 020A 03563AF2300004404D00000000000000] 14:18:11,525 INFO [MainThread] logitech_receiver.device: : unitId 563AF230 does not match serial 70CE825C 14:18:11,526 INFO [MainThread] solaar.configuration: saved {'404D:70CE825C': {'_absent': ['hi-res-scroll', 'lowres-smooth-scroll', 'hires-smooth-invert', 'hires-smooth-resolution', 'smart-shift', 'thumb-scroll-mode', 'thumb-scroll-invert', 'onboard_profiles', 'report_rate', 'pointer_speed', 'dpi', 'dpi-sliding', 'speed-change', 'mouse-gestures', 'backlight', 'backlight-timed', 'reprogrammable-keys', 'persistent-remappable-keys', 'divert-crown', 'crown-smooth', 'divert-gkeys', 'm-key-leds', 'mr-key-led', 'multiplatform', 'change-host'], '_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_sensitive': {'disable-keyboard-keys': False, 'divert-keys': False, 'fn-swap': True, 'gesture2-divert': False, 'gesture2-gestures': False, 'gesture2-params': False}, '_serial': '70CE825C', '_unitId': '563AF230', 'disable-keyboard-keys': {'1': False, '16': False, '4': False, '8': False}, 'divert-keys': {'1': 0, '110': 0, '145': 0, '149': 0, '183': 0, '184': 0, '2': 0, '3': 0, '34': 0, '4': 0, '40': 0, '5': 0, '6': 0, '62': 0, '64': 0, '79': 0, '8': 0, '84': 0}, 'fn-swap': False, 'gesture2-divert': {'1': False, '10': False, '100': False, '2': False, '44': False, '64': False, '65': False, '67': False, '84': False, '85': False}, 'gesture2-gestures': {'1': True, '10': True, '2': True, '30': True, '34': False, '42': True, '43': True, '45': False, '64': False, '65': False, '67': False, '84': True}, 'gesture2-params': {'4': {'scale': 256}}}, '_version': '1.1.2'} to /home/redqueen/.config/solaar/config.json 14:18:11,526 DEBUG [MainThread] logitech_receiver.settings: BooleanValidator: prepare_write(False, None) => b'\x00' 14:18:11,526 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings prepare write(False) => b'\x00' 14:18:11,526 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 091D 00000000000000000000000000000000] 14:18:11,545 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 091D 00010000000000000000000000000000] Setting fn-swap of Wireless Touch Keyboard K400 Plus to False ```

Power cycle;

``` 14:19:43,783 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 14:19:43,783 INFO [MainThread] logitech_receiver.base: New lock 3 14:19:43,784 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 14:19:43,786 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 14:19:43,786 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 14:19:43,788 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 14:19:43,790 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 14:19:43,792 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 14:19:43,792 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 14:19:43,792 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused STARTING CONFIG 14:19:43,872 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 14:19:43,874 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 14:19:43,876 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 14:19:43,876 DEBUG [MainThread] logitech_receiver.base: (5) pinging device 1 14:19:43,876 INFO [MainThread] logitech_receiver.base: New lock 5 14:19:43,877 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 001F 0000CA00000000000000000000000000] 14:19:43,888 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 001F 0401CA00000000000000000000000000] FOUND DEVICE Wireless Touch Keyboard K400 Plus Setting name fn-swap 14:19:43,888 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000B 00010000000000000000000000000000] 14:19:43,906 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000B 01000100000000000000000000000000] 14:19:43,907 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 0108 00000000000000000000000000000000] 14:19:43,922 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 0108 17000000000000000000000000000000] 14:19:43,922 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000B 40A00000000000000000000000000000] 14:19:43,938 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000B 00000000000000000000000000000000] 14:19:43,938 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 0009 40A20000000000000000000000000000] 14:19:43,954 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 0009 09000000000000000000000000000000] 14:19:43,954 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected Setting class fn-swap Setting fn-swap Checking connection to Solaar GUI Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused (solaar:46532): Gtk-WARNING **: 14:19:43.957: cannot open display: ```

Not sure if if this has anything to do with this issue, but I thought I'd bring it up anyway. https://stackoverflow.com/questions/20395027/scripts-launched-from-udev-do-not-have-display-access-anymore

Maybe it'd be worthwhile to look at v1.0.6 again and how it was handling this? Probably not, IDK, it seems like you guys overhauled a lot (most?) of the code since then. undecided.gif

pfps commented 2 years ago

The stackoverflow thread is definitely relevant. What is new is that solaar config tries to coordinate with a running Solaar to ensure that remembered device settings are consistent. This is new in 1.1.2 and is what is causing the problem - solaar config is trying to see whether a Solaar UI is running and that requires GTK and that requires a connect to the current display.

The newest version of the PR should have fixed the problem - I added some udev stuff to run the script out of udev and caught another problem. So please try again.

S3NTYN3L commented 2 years ago

OK, so I've got /etc/udev/rules.d/99-forcesolaarconfig.rules consisting of

ACTION=="change", SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_SERIAL_NUMBER}=="404d*", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/local/bin/forcesolaarconfig.sh"

Then /usr/local/bin/forcesolaarconfig.sh containing

#!/bin/bash

sleep 1
/home/redqueen/Downloads/Solaar/bin/solaar -ddd config 1 fn-swap 0 &> /tmp/solaar-config.txt

I then run the script manually in a terminal from /usr/local/bin with ./forcesolaarconfig.sh

HEAD is now at 3402b6b Manually;

``` 14:42:49,815 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 14:42:49,816 INFO [MainThread] logitech_receiver.base: New lock 3 14:42:49,816 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 14:42:49,818 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 14:42:49,818 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 14:42:49,820 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 14:42:49,822 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 14:42:49,824 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 14:42:49,824 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 14:42:49,824 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => STARTING CONFIG 14:42:49,912 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 14:42:49,914 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 14:42:49,916 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 14:42:49,916 DEBUG [MainThread] logitech_receiver.base: (11) pinging device 1 14:42:49,916 INFO [MainThread] logitech_receiver.base: New lock 11 14:42:49,916 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 001E 0000B800000000000000000000000000] 14:42:49,996 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 001E 0401B800000000000000000000000000] FOUND DEVICE Wireless Touch Keyboard K400 Plus Setting name fn-swap 14:42:49,997 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 000F 00010000000000000000000000000000] 14:42:50,016 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 000F 01000100000000000000000000000000] 14:42:50,017 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 010F 00000000000000000000000000000000] 14:42:50,036 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 010F 17000000000000000000000000000000] 14:42:50,037 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 0009 40A00000000000000000000000000000] 14:42:50,056 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 0009 00000000000000000000000000000000] 14:42:50,057 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 0008 40A20000000000000000000000000000] 14:42:50,076 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 0008 09000000000000000000000000000000] 14:42:50,077 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected Setting class fn-swap Setting fn-swap Checking connection to Solaar GUI connection to Solaar GUI False 14:42:50,111 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 300000] 14:42:50,112 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 3070CE825C1E40000009000000000000] 14:42:50,111 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings write False to 14:42:50,113 DEBUG [MainThread] solaar.configuration: load => {'404D:70CE825C': {'_absent': ['hi-res-scroll', 'lowres-smooth-scroll', 'hires-smooth-invert', 'hires-smooth-resolution', 'smart-shift', 'thumb-scroll-mode', 'thumb-scroll-invert', 'onboard_profiles', 'report_rate', 'pointer_speed', 'dpi', 'dpi-sliding', 'speed-change', 'mouse-gestures', 'backlight', 'backlight-timed', 'reprogrammable-keys', 'persistent-remappable-keys', 'divert-crown', 'crown-smooth', 'divert-gkeys', 'm-key-leds', 'mr-key-led', 'multiplatform', 'change-host'], '_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_sensitive': {'disable-keyboard-keys': False, 'divert-keys': False, 'fn-swap': True, 'gesture2-divert': False, 'gesture2-gestures': False, 'gesture2-params': False}, '_serial': '70CE825C', '_unitId': '563AF230', 'disable-keyboard-keys': {'1': False, '16': False, '4': False, '8': False}, 'divert-keys': {'1': 0, '110': 0, '145': 0, '149': 0, '183': 0, '184': 0, '2': 0, '3': 0, '34': 0, '4': 0, '40': 0, '5': 0, '6': 0, '62': 0, '64': 0, '79': 0, '8': 0, '84': 0}, 'fn-swap': False, 'gesture2-divert': {'1': False, '10': False, '100': False, '2': False, '44': False, '64': False, '65': False, '67': False, '84': False, '85': False}, 'gesture2-gestures': {'1': True, '10': True, '2': True, '30': True, '34': False, '42': True, '43': True, '45': False, '64': False, '65': False, '67': False, '84': True}, 'gesture2-params': {'4': {'scale': 256}}}, '_version': '1.1.2'} 14:42:50,113 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 000F 00030000000000000000000000000000] 14:42:50,178 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 000F 02000100000000000000000000000000] 14:42:50,179 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 020E 00000000000000000000000000000000] 14:42:50,198 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 020E 03563AF2300004404D00000000000000] 14:42:50,198 INFO [MainThread] logitech_receiver.device: : unitId 563AF230 does not match serial 70CE825C 14:42:50,199 INFO [MainThread] solaar.configuration: saved {'404D:70CE825C': {'_absent': ['hi-res-scroll', 'lowres-smooth-scroll', 'hires-smooth-invert', 'hires-smooth-resolution', 'smart-shift', 'thumb-scroll-mode', 'thumb-scroll-invert', 'onboard_profiles', 'report_rate', 'pointer_speed', 'dpi', 'dpi-sliding', 'speed-change', 'mouse-gestures', 'backlight', 'backlight-timed', 'reprogrammable-keys', 'persistent-remappable-keys', 'divert-crown', 'crown-smooth', 'divert-gkeys', 'm-key-leds', 'mr-key-led', 'multiplatform', 'change-host'], '_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_sensitive': {'disable-keyboard-keys': False, 'divert-keys': False, 'fn-swap': True, 'gesture2-divert': False, 'gesture2-gestures': False, 'gesture2-params': False}, '_serial': '70CE825C', '_unitId': '563AF230', 'disable-keyboard-keys': {'1': False, '16': False, '4': False, '8': False}, 'divert-keys': {'1': 0, '110': 0, '145': 0, '149': 0, '183': 0, '184': 0, '2': 0, '3': 0, '34': 0, '4': 0, '40': 0, '5': 0, '6': 0, '62': 0, '64': 0, '79': 0, '8': 0, '84': 0}, 'fn-swap': False, 'gesture2-divert': {'1': False, '10': False, '100': False, '2': False, '44': False, '64': False, '65': False, '67': False, '84': False, '85': False}, 'gesture2-gestures': {'1': True, '10': True, '2': True, '30': True, '34': False, '42': True, '43': True, '45': False, '64': False, '65': False, '67': False, '84': True}, 'gesture2-params': {'4': {'scale': 256}}}, '_version': '1.1.2'} to /home/redqueen/.config/solaar/config.json 14:42:50,199 DEBUG [MainThread] logitech_receiver.settings: BooleanValidator: prepare_write(False, None) => b'\x00' 14:42:50,199 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings prepare write(False) => b'\x00' 14:42:50,199 DEBUG [MainThread] logitech_receiver.base: (11) <= w[11 01 091A 00000000000000000000000000000000] 14:42:50,218 DEBUG [MainThread] logitech_receiver.base: (11) => r[11 01 091A 00010000000000000000000000000000] Setting fn-swap of Wireless Touch Keyboard K400 Plus to False ```

The settings take hold.

And finally with udev

Power cycle;

``` 14:44:43,959 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 14:44:43,959 INFO [MainThread] logitech_receiver.base: New lock 3 14:44:43,960 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 14:44:43,961 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 14:44:43,962 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 14:44:43,963 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 14:44:43,965 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 14:44:43,967 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 14:44:43,967 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 14:44:43,968 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused STARTING CONFIG 14:44:44,043 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 14:44:44,045 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 14:44:44,047 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 14:44:44,047 DEBUG [MainThread] logitech_receiver.base: (5) pinging device 1 14:44:44,047 INFO [MainThread] logitech_receiver.base: New lock 5 14:44:44,047 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 001B 00003E00000000000000000000000000] 14:44:44,059 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 001B 04013E00000000000000000000000000] FOUND DEVICE Wireless Touch Keyboard K400 Plus Setting name fn-swap 14:44:44,060 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000D 00010000000000000000000000000000] 14:44:44,075 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000D 01000100000000000000000000000000] 14:44:44,076 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 010E 00000000000000000000000000000000] 14:44:44,091 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 010E 17000000000000000000000000000000] 14:44:44,092 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000E 40A00000000000000000000000000000] 14:44:44,107 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000E 00000000000000000000000000000000] 14:44:44,108 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000E 40A20000000000000000000000000000] 14:44:44,123 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000E 09000000000000000000000000000000] 14:44:44,124 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected Setting class fn-swap Setting fn-swap Checking connection to Solaar GUI Unable to init server: Could not connect: Connection refused connection to Solaar GUI False 14:44:44,124 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 300000] 14:44:44,127 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 3070CE825C1E40000009000000000000] 14:44:44,124 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings write False to 14:44:44,128 DEBUG [MainThread] solaar.configuration: load => {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} 14:44:44,129 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000B 00030000000000000000000000000000] 14:44:44,147 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000B 02000100000000000000000000000000] 14:44:44,148 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 0208 00000000000000000000000000000000] 14:44:44,163 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 0208 03563AF2300004404D00000000000000] 14:44:44,164 INFO [MainThread] logitech_receiver.device: : unitId 563AF230 does not match serial 70CE825C 14:44:44,164 INFO [MainThread] solaar.configuration: saved {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} to /root/.config/solaar/config.json 14:44:44,164 DEBUG [MainThread] logitech_receiver.settings: BooleanValidator: prepare_write(False, None) => b'\x00' 14:44:44,164 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings prepare write(False) => b'\x00' 14:44:44,165 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 091C 00000000000000000000000000000000] 14:44:44,181 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 091C 00010000000000000000000000000000] Setting fn-swap of Wireless Touch Keyboard K400 Plus to False ```

Still looks like it's throwing some errors but the settings seem to take hold now! ;)

pfps commented 2 years ago

The unable to connect to server messages are mysterious but benign. They appear in other circumstances as well.

So this looks like a victory. I'll clean out the debugging stuff and update the PR.

pfps commented 2 years ago

The newest version of the PR has the debugging statements removed but no other differences.

S3NTYN3L commented 2 years ago

HEAD is now at 64c4ccf Manually;

``` 15:37:01,894 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 15:37:01,895 INFO [MainThread] logitech_receiver.base: New lock 3 15:37:01,895 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 15:37:01,896 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 15:37:01,897 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 15:37:01,898 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 15:37:01,900 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 15:37:01,902 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 15:37:01,903 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 15:37:01,903 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => 15:37:01,982 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 15:37:01,984 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 15:37:01,986 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 15:37:01,986 DEBUG [MainThread] logitech_receiver.base: (8) pinging device 1 15:37:01,986 INFO [MainThread] logitech_receiver.base: New lock 8 15:37:01,986 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 001D 00000E00000000000000000000000000] 15:37:03,305 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 001D 04010E00000000000000000000000000] 15:37:03,305 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000D 00010000000000000000000000000000] 15:37:03,324 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000D 01000100000000000000000000000000] 15:37:03,325 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 010F 00000000000000000000000000000000] 15:37:03,344 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 010F 17000000000000000000000000000000] 15:37:03,345 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000C 40A00000000000000000000000000000] 15:37:03,364 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000C 00000000000000000000000000000000] 15:37:03,365 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000C 40A20000000000000000000000000000] 15:37:03,384 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000C 09000000000000000000000000000000] 15:37:03,385 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected 15:37:03,429 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 300000] 15:37:03,432 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 3070CE825C1E40000009000000000000] 15:37:03,429 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings write False to 15:37:03,433 DEBUG [MainThread] solaar.configuration: load => {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} 15:37:03,433 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 000F 00030000000000000000000000000000] 15:37:03,486 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 000F 02000100000000000000000000000000] 15:37:03,487 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 020C 00000000000000000000000000000000] 15:37:03,506 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 020C 03563AF2300004404D00000000000000] 15:37:03,507 INFO [MainThread] logitech_receiver.device: : unitId 563AF230 does not match serial 70CE825C 15:37:03,507 INFO [MainThread] solaar.configuration: saved {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} to /root/.config/solaar/config.json 15:37:03,507 DEBUG [MainThread] logitech_receiver.settings: BooleanValidator: prepare_write(False, None) => b'\x00' 15:37:03,508 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings prepare write(False) => b'\x00' 15:37:03,508 DEBUG [MainThread] logitech_receiver.base: (8) <= w[11 01 0918 00000000000000000000000000000000] 15:37:03,526 DEBUG [MainThread] logitech_receiver.base: (8) => r[11 01 0918 00010000000000000000000000000000] Setting fn-swap of Wireless Touch Keyboard K400 Plus to False ```

Power cycle;

``` 15:37:58,526 DEBUG [MainThread] hidapi.udev: Found device BID 0003 VID 0000046D PID 0000C52B INTERFACE 2 FILTER 2 15:37:58,526 INFO [MainThread] logitech_receiver.base: New lock 3 15:37:58,526 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 030000] 15:37:58,529 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 03A4DE9A0E0E06090000000000000000] 15:37:58,529 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 80B2 000000] 15:37:58,531 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 01 4101 4D401E4000000400000000] 15:37:58,533 DEBUG [MainThread] logitech_receiver.base: (3) => r[20 00 4102 0000000000000000000000] 15:37:58,535 DEBUG [MainThread] logitech_receiver.base: (3) => r[10 FF 8F80 B20300] 15:37:58,535 DEBUG [MainThread] logitech_receiver.base: (3) device 0xFF error on request {80B2}: 3 = invalid value 15:37:58,535 DEBUG [MainThread] solaar.cli: [/dev/hidraw0] => Unable to init server: Could not connect: Connection refused Unable to init server: Could not connect: Connection refused 15:37:58,605 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 200000] 15:37:58,607 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 200708404D0402014700000000000000] 15:37:58,608 INFO [MainThread] logitech_receiver.receiver: : found new device 1 (404D) 15:37:58,608 DEBUG [MainThread] logitech_receiver.base: (5) pinging device 1 15:37:58,608 INFO [MainThread] logitech_receiver.base: New lock 5 15:37:58,609 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 001E 00001A00000000000000000000000000] 15:37:58,627 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 001E 04011A00000000000000000000000000] 15:37:58,627 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000D 00010000000000000000000000000000] 15:37:58,643 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000D 01000100000000000000000000000000] 15:37:58,643 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 010A 00000000000000000000000000000000] 15:37:58,659 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 010A 17000000000000000000000000000000] 15:37:58,659 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000C 40A00000000000000000000000000000] 15:37:58,675 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000C 00000000000000000000000000000000] 15:37:58,675 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000F 40A20000000000000000000000000000] 15:37:58,691 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000F 09000000000000000000000000000000] 15:37:58,691 INFO [MainThread] logitech_receiver.settings_templates: check_feature fn-swap [NEW FN INVERSION] detected Unable to init server: Could not connect: Connection refused 15:37:58,692 DEBUG [MainThread] logitech_receiver.base: (3) <= w[10 FF 83B5 300000] 15:37:58,695 DEBUG [MainThread] logitech_receiver.base: (3) => r[11 FF 83B5 3070CE825C1E40000009000000000000] 15:37:58,691 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings write False to 15:37:58,696 DEBUG [MainThread] solaar.configuration: load => {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} 15:37:58,696 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 000C 00030000000000000000000000000000] 15:37:58,715 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 000C 02000100000000000000000000000000] 15:37:58,715 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 020E 00000000000000000000000000000000] 15:37:58,731 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 020E 03563AF2300004404D00000000000000] 15:37:58,731 INFO [MainThread] logitech_receiver.device: : unitId 563AF230 does not match serial 70CE825C 15:37:58,732 INFO [MainThread] solaar.configuration: saved {'404D:70CE825C': {'_modelId': '404D00000000', '_name': 'Wireless Touch Keyboard K400 Plus', '_serial': '70CE825C', '_unitId': '563AF230', 'fn-swap': False}, '_version': '1.1.2'} to /root/.config/solaar/config.json 15:37:58,732 DEBUG [MainThread] logitech_receiver.settings: BooleanValidator: prepare_write(False, None) => b'\x00' 15:37:58,732 DEBUG [MainThread] logitech_receiver.settings: fn-swap: settings prepare write(False) => b'\x00' 15:37:58,732 DEBUG [MainThread] logitech_receiver.base: (5) <= w[11 01 0918 00000000000000000000000000000000] 15:37:58,747 DEBUG [MainThread] logitech_receiver.base: (5) => r[11 01 0918 00010000000000000000000000000000] Setting fn-swap of Wireless Touch Keyboard K400 Plus to False ```

Looks like a winner! Thanks so much for the infinite f'ing patience and for maintaining this wonderful app! Now go grab a beer and celebrate, lol! ;)