zocker-160 / keyboard-center

Application for mapping macro keys on Logitech keyboards
GNU General Public License v3.0
66 stars 3 forks source link

'Unable to open device' upon log in #10

Closed aquova closed 3 years ago

aquova commented 3 years ago

Most of the times when I log into my computer upon rebooting, keyboard-center does not immediately function. Upon running systemctl --user status keyboard-center, the process has crashed with the following errors, possibly due to the process attempting to initialize before the keyboard is ready:

Sep 16 22:35:28 mars python3[1187]: ERROR: Task exception was never retrieved
Sep 16 22:35:28 mars python3[1187]: future: <Task finished name='Task-1' coro=<usbListener() done, defined at /usr/lib/keyboard-center/service.py:141> exception=HIDException('unable to open device')>
Sep 16 22:35:28 mars python3[1187]: Traceback (most recent call last):
Sep 16 22:35:28 mars python3[1187]:   File "/usr/lib/keyboard-center/service.py", line 153, in usbListener
Sep 16 22:35:28 mars python3[1187]:     await disableGkeyMapping(keyboardDev, HIDpath_disable)
Sep 16 22:35:28 mars python3[1187]:   File "/usr/lib/keyboard-center/service.py", line 53, in disableGkeyMapping
Sep 16 22:35:28 mars python3[1187]:     with HIDDevice(path=HIDpath) as hdev:
Sep 16 22:35:28 mars python3[1187]:   File "/usr/lib/keyboard-center/lib/hid.py", line 136, in __init__
Sep 16 22:35:28 mars python3[1187]:     raise HIDException('unable to open device')
Sep 16 22:35:28 mars python3[1187]: lib.hid.HIDException: unable to open device

Running systemctl --user restart keyboard-center is a workaround which allows the program to then function as intended.

zocker-160 commented 3 years ago

thanks for this report, I will add a retry count, adding a startup delay is not a good idea I think, because it also is in effect when manually starting the service

zocker-160 commented 3 years ago

with version 0.1.13 the service will retry when opening the HID device fails.

Current default is 5 times with a delay of 5 seconds each. The number of retries can be changed in the settings files.

I hope this is a viable solution.

zocker-160 commented 3 years ago

closing, please reopen if issue still exists