Bug 270603 - sysutils/keyd breaks after S3 suspend/resume cycle
Summary: sysutils/keyd breaks after S3 suspend/resume cycle
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Jan Beich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-02 17:44 UTC by Ivan
Modified: 2024-03-05 09:35 UTC (History)
1 user (show)

See Also:
jbeich: maintainer-feedback+


Attachments
invoke "service keyd start" on resume (1.19 KB, patch)
2023-04-04 16:08 UTC, Jan Beich
no flags Details | Diff
fixes resume issue (511 bytes, patch)
2024-03-05 09:32 UTC, Ivan
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan 2023-04-02 17:44:45 UTC
It breaks after S3 suspend/resume cycle.

I believe there must be some flag in RC script to restart it automatically.

Logs:
Apr  3 01:01:01 iv keyd[26536]: device removed: 1e7d:2dbf ROCCAT ROCCAT Kone Pure Military, class 0/0, rev 2.00/2.00, addr/dev/input/event3 (/dev/input/event3)
Apr  3 01:01:01 iv keyd[26536]: device removed: 0c45:1a0a vendor 0x0c45 FC660M, class 0/0, rev 2.00/0.01, addr 2 (/dev/input/event4)
Apr  3 01:01:01 iv keyd[26536]: device removed: 1e7d:2dbf ROCCAT ROCCAT Kone Pure Military, class 0/0, rev 2.00/2.00, addr/dev/input/event5 (/dev/input/event5)
Comment 1 Jan Beich freebsd_committer freebsd_triage 2023-04-04 16:08:52 UTC
Created attachment 241296 [details]
invoke "service keyd start" on resume

Does this help? I don't have a laptop to test.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2023-04-04 16:13:00 UTC
Also, check via pgrep(1) the number of keyd instances. If there's more than one try changing "start" to "restart" on "resume_cmd" line (and notify me, so I'll land the correct version).
Comment 3 Jan Beich freebsd_committer freebsd_triage 2023-04-04 16:22:14 UTC
Restarting keyd shouldn't be required as it uses libinotify to discover new/lost devices under /dev/input/. Maybe it doesn't work for some reason on FreeBSD (never tested the feature myself).
Comment 4 Ivan 2023-04-05 05:22:23 UTC
Thanks! Tested.

"run_rc_command restart" is required. Otherwise nothing is restarted at all.

But, the problem is:

Apr  5 13:12:42 iv acpi[54418]: resumed at 20230405 13:12:42
Apr  5 13:12:42 iv keyd[58852]: Starting keyd v2.4.2
Apr  5 13:12:42 iv keyd[58852]: socket: /var/run/keyd.socket
Apr  5 13:12:42 iv keyd[58852]: device added: 0000:0000 System keyboard multiplexer (/dev/input/event1)
Apr  5 13:12:42 iv keyd[58852]: 	ignored (no matching config)
Apr  5 13:12:42 iv kernel: uhub0: 6 ports with 6 removable, self powered
Apr  5 13:12:42 iv kernel: uhub1: 6 ports with 6 removable, self powered
Apr  5 13:12:43 iv kernel: ugen1.2: <ROCCAT ROCCAT Kone Pure Military> at usbus1
Apr  5 13:12:43 iv kernel: ums0 on uhub1
Apr  5 13:12:43 iv kernel: ums0: <ROCCAT ROCCAT Kone Pure Military, class 0/0, rev 2.00/2.00, addr 1> on usbus1
Apr  5 13:12:43 iv kernel: ums0: 5 buttons and [XYZT] coordinates ID=1
Apr  5 13:12:43 iv kernel: ukbd0 on uhub1
Apr  5 13:12:43 iv kernel: ukbd0: <ROCCAT ROCCAT Kone Pure Military, class 0/0, rev 2.00/2.00, addr 1> on usbus1
Apr  5 13:12:43 iv kernel: kbd1 at ukbd0
Apr  5 13:12:43 iv kernel: ugen1.3: <vendor 0x0c45 FC660M> at usbus1
Apr  5 13:12:43 iv kernel: ukbd1 on uhub1
Apr  5 13:12:43 iv kernel: ukbd1: <vendor 0x0c45 FC660M, class 0/0, rev 2.00/0.01, addr 2> on usbus1
Apr  5 13:12:43 iv kernel: kbd2 at ukbd1
Apr  5 13:12:43 iv kernel: uhid0 on uhub1
Apr  5 13:12:43 iv kernel: uhid0: <vendor 0x0c45 FC660M, class 0/0, rev 2.00/0.01, addr 2> on usbus1

The usb devices aren't ready at the moment of the restart
Comment 5 Ivan 2023-04-05 06:18:50 UTC
A hack resume_cmd="sleep 3; run_rc_command restart" works fine.
But may be there is a better way?
Comment 6 Ivan 2023-04-11 09:31:28 UTC
Tested my hack with sleep for a 6 days. Works very well. No issues at all. Jan, you can update the port safely.
Comment 7 Jan Beich freebsd_committer freebsd_triage 2023-05-18 05:51:10 UTC
Can you report upstream (per comment 3)? I'm reluctant to add workarounds for what works "as is" (or supposed to) on Linux at least without more investigation.
Comment 8 Ivan 2023-05-18 07:19:07 UTC
Sure. Reported upstream
https://github.com/rvaiya/keyd/issues/497
Comment 9 Ivan 2024-03-05 09:32:57 UTC
Created attachment 248945 [details]
fixes resume issue
Comment 10 Ivan 2024-03-05 09:35:57 UTC
Hi!
Any news here?

The patch really fixes the issue. Tested for a long time. Have no luck with upstream fix yet.

There is a similar issue.
At the boot time it couldn't find the keyboard. Switch the keyboard cable off and on helps. But it's really annoying.
Can we add a similar fix for delaying keyd startup?