Closed webodan closed 1 year ago
It may be that devices in openbox are not set up early enough to be able to run solaar config during autostart. If you can run solaar config later this is likely the case. I've never run openbox so I don' t know how to get around this problem, although you might try adding a delay before running solaar config.
But you shouldn't need to run solaar config at all if you are running the Solaar GUI. Solaar should notice when your device first shows up (and also when the device comes back from a power-saving state) and apply the saved value for fn-swap. If you use solaar config by itself any value you change will be forgotten when the device goes into a power-saving state.
I did try adding a delay before running solaar -w hide &
(something like sleep 5s
; or lower)a couple times too, while testing, but it still didn't apply the fn-swap. Hopefully I didn't break anything with the solaar config command, I'll try making a new config from scratch or something.
For the moment what I did was change the alt+f4 hotkey from openbox into Alt+Menu so at least I can close windows easily without running commands manually in the middle.
What would be useful is running solaar -ddd -w hide
during autostart and capturing its error output. That would show the interactions between Solaar and the device.
I set up my K400+ on my main computer and set up an autostart desktop file running
Exec=/usr/bin/sh -c "solaar -ddd --window=hide &> /home/pfps/log.text"
When I looked at log.text everything was fine, including setting the fn-swap. The relevant lines are
2023-01-06 14:02:26,933,933 DEBUG [ReceiverListener:hidraw1] logitech_receiver.settings: fn-swap: apply None (<Device(1,404D,Wireless Touch Keyboard K400 Plus,132A9261)>)
2023-01-06 14:02:26,933,933 DEBUG [ReceiverListener:hidraw1] logitech_receiver.settings: fn-swap: settings read None from <Device(1,404D,Wireless Touch Keyboard K400 Plus,132A9261)>
2023-01-06 14:02:26,933,933 DEBUG [ReceiverListener:hidraw1] logitech_receiver.settings: fn-swap: setting write False to <Device(1,404D,Wireless Touch Keyboard K400 Plus,132A9261)>
2023-01-06 14:02:26,933,933 DEBUG [ReceiverListener:hidraw1] logitech_receiver.settings: BooleanValidator: prepare_write(False, None) => b'\x00'
2023-01-06 14:02:26,933,933 DEBUG [ReceiverListener:hidraw1] logitech_receiver.settings: fn-swap: settings prepare write(False) => b'\x00'
2023-01-06 14:02:26,933,933 DEBUG [ReceiverListener:hidraw1] logitech_receiver.base: (17) <= w[11 01 091F 00000000000000000000000000000000]
2023-01-06 14:02:26,953,953 DEBUG [ReceiverListener:hidraw1] logitech_receiver.base: (17) => r[11 01 091F 00010000000000000000000000000000]
Showing Solaar turning fn-swap off and the device acknowledgement (including that the default is on).
You should see a similar interaction in the file.
If you see a line in the file looking like the acknowledgement line (i.e., containing => r[11 01 091X) but with a different value as the first byte of the long hex sequence then some other piece of code is interfering with the setting. (You will likely see two acknowledgement lines, as Solaar sees most responses from devices twice - what you should look for is a third line, particularly with a different value for the setting or a different nibble for the X.)
After deleting the config.yaml and regenerating a new one with the GUI, then disabling fn-swap so it's false from there, and running solar -w hide & from openbox's autostart, it's doing what it should, idk, maybe my config file was bad or something.
I'm posting the output of my "solaar -ddd --window=hide &> ~/log.text"
in a sec...
EDIT: the command didn't output a log for me, neither in openbox's autostart nor in the Exec line of an xsessions desktop file...
Here it goes again, I just rebooted and it doesn't alt+f4 to close windows, f4 is mapped to Menu in xev
, gonna try logging from a terminal since it seems like it works for me...
2023-01-07 09:20:13,498,498 DEBUG [ReceiverListener:hidraw8] logitech_receiver.settings: fn-swap: apply None (<Device(1,404D,Wireless Touch Keyboard K400 Plus,304E66B3)>)
2023-01-07 09:20:13,498,498 DEBUG [ReceiverListener:hidraw8] logitech_receiver.settings: fn-swap: settings read None from <Device(1,404D,Wireless Touch Keyboard K400 Plus,304E66B3)>
2023-01-07 09:20:13,498,498 DEBUG [ReceiverListener:hidraw8] logitech_receiver.settings: fn-swap: setting write False to <Device(1,404D,Wireless Touch Keyboard K400 Plus,304E66B3)>
2023-01-07 09:20:13,499,499 DEBUG [ReceiverListener:hidraw8] logitech_receiver.settings: BooleanValidator: prepare_write(False, None) => b'\x00'
2023-01-07 09:20:13,499,499 DEBUG [ReceiverListener:hidraw8] logitech_receiver.settings: fn-swap: settings prepare write(False) => b'\x00'`
It's super strange, it does log when i run the program manually but it neither logs nor swaps the function keys if I run it doing boot in the autostart....
I've also noticed it works kinda spotty, sometimes it will swap the fn, sometimes it won't, which also led me to opening a bug report, it's like it's not consistent
I found out that even if it solaar boots up along with the system with the fn-swap set to true (f4 mapped to menu) if I turn off the keyboard then turn it on with its on/off switch, solaar applies the fn-swap and then maps menu to f4. Maybe this was in the documentation, idk, but at least there's an easy way for it to work that doesn't involve delays or remembering hotkeys, so for the moment I'll go with this, just gotta remember to turn off the keyboard during reboots or when putting the PC to sleep.
Because devices forget their settings when powered off or in a power-saving mode, Solaar pushes settings each time a device connects. So when you turn the device off and on Solaar will push settings to it.
It is still unclear why this is not effective when you start your computer.
Can you give me a reliable way to make it show what it prints after autostarting openbox? so I can show you if it gives a different error now, since I've been trying for a couple more hours, and now it most definitely gets fixed if i switch off and on my keyboard after a reboot. Adding delays using sleep was spotty; sometimes they worked, other times they didn't. I assume there's something wrong when it's starting from a fast WM? I don't really know,
What I did was put
Exec=/usr/bin/sh -c "solaar -ddd --window=hide &> /home/pfps/log.text"
in my solaar.desktop autostart file. If you start programs some other way then you may have to do something else.
Note that if you are autostarting Solaar as root then Solaar will look under root's home directory for its configuration file. That file is likely to be different from the one under your home directory. Running Solaar as root is not a good idea in any case.
It would be useful to see the complete output from running solaar config at autostart.
Closed due to no response from submitter.
Information
solaar --version
orgit describe --tags
if cloned from this repository): 1.1.8uname -srmo
):Linux 6.1.2-273-tkg-pds-llvm x86_64 GNU/Linux
solaar show
:~/.config/solaar/config.yaml
(or~/.config/solaar/config.json
if~/.config/solaar/config.yaml
not present):Describe the bug I'm trying to use Solaar in Openbox, but no matter what I do, it always reverts back to fn-swap true, when i want fn-swap false. Trying to run
solaar config 0 fn-swap false
from the autostart file in openbox throws me the error I describe on the thread title. (happens if i runsolaar config 1 ...
as well).To Reproduce Steps to reproduce the behavior: Try running Solaar with
solaar -w hide &
on the autostart, thensolaar config 1 (or 0) fn-swap false &
, or thesolaar config
command first, thensolaar -w hide
, or just one of either. It always printsException: no online device found matching '0' (or '1')
.Nothing works, i'm ALWAYS getting the fn-swap true behavior, and I have to manually touch the GUI (clicking the lockpick so it's open, then again so it's closed, will restore my desired fn-swap behavior, but it does not retain this between system reboots) or run
solaar config 1 fn-swap false
manually, by opening a terminal, and then run the command, or with a keyboard hotkey so that it actually takes effect and works. Only doing it manually every time will make it work. Trying to automate it doing the same commands that I do manually will crash solaar.I also tried using
usbreset
to try to reset the USB device before running solaar either with the GUI or with the config command, since the "online device" error suggested me it wasn't picking up the receiver correctly. Still no dice.I don't understand its problem with the fn-swap, I manually set the config.yaml so it will always do false, even foregoing the GUI and making sure it said false so it would apply as such in there but it just does what it wants.
Sorry for the tl;dr, but I've been trying to make it work for a couple hours now, trying to understand what's wrong with it, since it makes no sense to me that commands run here or there would produce a different result, despite them being the same commands run as the same user. It annoyed me like crazy.
Additional context Simply trying to run solaar in openbox's autostart script will just break it. Even trying to run it from a terminal as in xterm -e "solaar config 1 fn-swap false" will make it break with the aforementioned no online device error. If I manually run that same command from that same terminal then it works, what sense does that make? :confused: