Enerccio / ewlc

Wayland compositor library - extended
MIT License
20 stars 3 forks source link

Input devices lost when doing vt switch (FreeBSD) #81

Open WLCIssuesBot opened 7 years ago

WLCIssuesBot commented 7 years ago

Issue by johalun Tuesday Jan 10, 2017 at 04:57 GMT Originally opened as https://github.com/Cloudef/wlc/issues/223


Have anyone seen anything similar on Linux?

After resume (vt switch back) libinput_resume is called and /dev/input/event[0-4] is being re-opened as expected but each device is immediately closed again except for the last one which is neither kb or mouse so I lose input methods...

(sorry for the excessive udev output...)

log snippet from when switching back to vt9 where Sway is running.

01/09/17 20:52:04 - [main.c:43] [wlc] fd.c fd_open: Open path /dev/input/event4. Stored fd 4 to index 0
udev_device_get_udev(0x80d95d7a0(/dev/input/event3))
udev_device_get_syspath(0x80d849140) ukbd0
udev_device_get_syspath(0x80d95d980) /dev/input/event3
udev_device_get_devnode(0x80d95d980) /dev/input/event3
udev_device_get_udev(0x80d95d980(/dev/input/event3))
udev_device_get_syspath(0x80d849780) ukbd0
udev_device_get_syspath(0x80d95d7a0) /dev/input/event3
udev_device_get_syspath(0x80ba3b450) /dev/input/event4
udev_device_unref(0x80d95d7a0//dev/input/event3) 1
01/09/17 20:52:04 - [main.c:43] [wlc] fd.c wlc_fd_close 20
udev_device_unref(0x80ba3b450//dev/input/event4) 1
01/09/17 20:52:04 - udev_list_entry_get_name() /dev/kbdmux0
[main.c:43] udev_device_new_from_syspath(/dev/kbdmux0)
[wlc] fd.c handle_requestudev_device_get_syspath(0x80ba3b450) /dev/kbdmux0

udev_device_get_sysname(0x80ba3b450(/dev/kbdmux0)) kbdmux0
01/09/17 20:52:04 - udev_device_get_udev(0x80ba3b450(/dev/kbdmux0))
[main.c:43] udev_device_get_syspath(0x80d849680) kbdmux0
[wlc] fd.c handle_request: FD_CLOSEudev_device_get_sysname(0x80ba3b450(/dev/kbdmux0)) kbdmux0

udev_device_unref(0x80ba3b450//dev/kbdmux0) 1
01/09/17 20:52:04 - udev_list_entry_get_name() /dev/sysmouse
[main.c:43] udev_device_new_from_syspath(/dev/sysmouse)
[wlc] Close index 1, fd 6udev_device_get_syspath(0x80ba3b450) /dev/sysmouse

udev_device_get_sysname(0x80ba3b450(/dev/sysmouse)) sysmouse
udev_device_get_udev(0x80ba3b450(/dev/sysmouse))
udev_device_get_syspath(0x80d95a550) sysmouse
udev_device_get_sysname(0x80ba3b450(/dev/sysmouse)) sysmouse
udev_device_unref(0x80ba3b450//dev/sysmouse) 1
udev_list_entry_get_name() /dev/ukbd0
udev_device_new_from_syspath(/dev/ukbd0)
udev_device_get_syspath(0x80ba3b450) /dev/ukbd0
udev_device_get_sysname(0x80ba3b450(/dev/ukbd0)) ukbd0
udev_device_get_udev(0x80ba3b450(/dev/ukbd0))
udev_device_get_syspath(0x80d849780) ukbd0
udev_device_get_sysname(0x80ba3b450(/dev/ukbd0)) ukbd0
udev_device_unref(0x80ba3b450//dev/ukbd0) 1
udev_list_entry_get_name() /dev/ums0
udev_device_new_from_syspath(/dev/ums0)
udev_device_get_syspath(0x80ba3b450) /dev/ums0
udev_device_get_sysname(0x80ba3b450(/dev/ums0)) ums0
udev_device_get_udev(0x80ba3b450(/dev/ums0))
udev_device_get_syspath(0x80d849600) ums0
udev_device_get_sysname(0x80ba3b450(/dev/ums0)) ums0
udev_device_unref(0x80ba3b450//dev/ums0) 1
udev_enumerate_unref(0x80ba316f0) refcount=1
udev_unref(0x80ba39650) refcount=14
01/09/17 20:52:04 - [main.c:43] [wlc] fd.c wlc_fd_activate
01/09/17 20:52:04 - [main.c:43] [wlc] fd.c handle_request
01/09/17 20:52:04 - [main.c:43] [wlc] fd.c handle_request: TYPE_ACTIVATE
01/09/17 20:52:04 - [main.c:43] [wlc] Activate: Iterate fd 0, value 4
01/09/17 20:52:04 - [main.c:43] [wlc] Activate: FD_INPUT
01/09/17 20:52:04 - [main.c:43] [wlc] Activate: Iterate fd 1, value -1
01/09/17 20:52:04 - [main.c:43] [wlc] Activate: Iterate fd 2, value -1
01/09/17 20:52:04 - [main.c:43] [wlc] Activate: Iterate fd 3, value -1
01/09/17 20:52:04 - [main.c:43] [wlc] Activate: Iterate fd 4, value -1
01/09/17 20:52:04 - [main.c:43] [wlc] Activate: Iterate fd 5, value 10
01/09/17 20:52:04 - [main.c:43] [wlc] Activate: FD_DRM
01/09/17 20:52:04 - [main.c:43] [wlc] Set drm master

fd 1,2,3,4 should contain input devices (they do before vt switch). As can be seen in the log, for some reason FD_CLOSE requests are coming in and closing the input devices....

Until doing vt switch Sway works fine with all input devices.

WLCIssuesBot commented 7 years ago

Comment by johalun Tuesday Jan 10, 2017 at 06:39 GMT


Cleaner log:

01/09/17 22:37:09 - [main.c:43] [wlc] SIGUSR2
01/09/17 22:37:09 - [main.c:43] [wlc] wlc_set_active 1
01/09/17 22:37:09 - [main.c:43] [wlc] udev.c activate_event: active 1
01/09/17 22:37:09 - [main.c:43] [wlc] libinput: resume
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c wlc_fd_open /dev/input/event0
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request: FD_OPEN
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c fd_open: Open path /dev/input/event0. Stored fd 4 to index 0
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c wlc_fd_open /dev/input/event1
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request: FD_OPEN
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c fd_open: Open path /dev/input/event1. Stored fd 6 to index 1
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c wlc_fd_close 20
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request: FD_CLOSE
01/09/17 22:37:09 - [main.c:43] [wlc] Close index 0, fd 4
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c wlc_fd_open /dev/input/event2
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request: FD_OPEN
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c fd_open: Open path /dev/input/event2. Stored fd 4 to index 0
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c wlc_fd_close 20
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request: FD_CLOSE
01/09/17 22:37:09 - [main.c:43] [wlc] Close index 1, fd 6
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c wlc_fd_open /dev/input/event3
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request: FD_OPEN
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c fd_open: Open path /dev/input/event3. Stored fd 6 to index 1
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c wlc_fd_close 20
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request: FD_CLOSE
01/09/17 22:37:09 - [main.c:43] [wlc] Close index 0, fd 4
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c wlc_fd_open /dev/input/event4
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request: FD_OPEN
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c fd_open: Open path /dev/input/event4. Stored fd 4 to index 0
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c wlc_fd_close 20
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request: FD_CLOSE
01/09/17 22:37:09 - 01/09/17 22:37:09 - [main.c:43] [main.c:43] [wlc] fd.c wlc_fd_activate[wlc] Close index 1, fd 6

01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request
01/09/17 22:37:09 - [main.c:43] [wlc] fd.c handle_request: TYPE_ACTIVATE
01/09/17 22:37:09 - [main.c:43] [wlc] Activate: Iterate fd 0, value 4
01/09/17 22:37:09 - [main.c:43] [wlc] Activate: FD_INPUT
01/09/17 22:37:09 - [main.c:43] [wlc] Activate: Iterate fd 1, value -1
01/09/17 22:37:09 - [main.c:43] [wlc] Activate: Iterate fd 2, value -1
01/09/17 22:37:09 - [main.c:43] [wlc] Activate: Iterate fd 3, value -1
01/09/17 22:37:09 - [main.c:43] [wlc] Activate: Iterate fd 4, value -1
01/09/17 22:37:09 - [main.c:43] [wlc] Activate: Iterate fd 5, value 10
01/09/17 22:37:09 - [main.c:43] [wlc] Activate: FD_DRM
01/09/17 22:37:09 - [main.c:43] [wlc] Set drm master
WLCIssuesBot commented 7 years ago

Comment by Cloudef Tuesday Jan 10, 2017 at 09:44 GMT


I've seen this in rare cases so there is probably race condition somewhere. Whole tty switching is flaky.

WLCIssuesBot commented 7 years ago

Comment by johalun Tuesday Jan 10, 2017 at 17:23 GMT


Some more debugging gave me this output: [wlc] opening input device '/dev/input/event0' failed (Operation not permitted)

That would explain why they're closed again after opened.