Skip to content

Handle attached-detached devices with udev monitor#7

Open
kikadf wants to merge 1 commit into
sizeofvoid:libopeninputfrom
kikadf:hotplug
Open

Handle attached-detached devices with udev monitor#7
kikadf wants to merge 1 commit into
sizeofvoid:libopeninputfrom
kikadf:hotplug

Conversation

@kikadf

@kikadf kikadf commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

(note: avoid the merge conflict it is based on #6)

With this change, libopeninput uses the udev monitor to detect device attach and detach events. The udev monitor only detects changes; wscons_udev_handler() calls libinput_path_add_device() or libinput_path_remove_device() to update the device list, and post_device_event() to send events, similar to libinput_udev_assign_seat().

interface_backends now only track the udev monitor state; all device handling occurs in wscons_udev_handler().

Tested on NetBSD with labwc: devices work correctly after detach/attach, and multiple mice are handled properly.

To test on OpenBSD, add a small patch to libudev-openbsd to handle wskbd and wsmouse devices, e.g., add the following to subsystem_config subsystems[] in udev-utils.c:

{
	.subsystem = "input",
	.syspath = DEV_PATH_ROOT "/wskbd[0-9]*",
	.create_handler = create_keyboard_handler,
}, {
	.subsystem = "input",
	.syspath = DEV_PATH_ROOT "/wsmouse[0-9]*",
	.create_handler = create_mouse_handler,
}, 

@mherrb

mherrb commented Mar 7, 2026

Copy link
Copy Markdown
Collaborator

On OpenBSD this doesn't work because 1) libudev-openbsd doesn't trigger on wskbd/wsmouse plug/unplug events (it's more or less restricted to USB fido keys) 2) when patched to handle wskbd/wsmouse, there is the ownership issue of the /dev/ entries (and and adding /dev/ws{kbd,mouse}[0-9]* to /etc/fbtab is not a option.
It doesn't seem to make things worse though.
Keeping that open for now.

@kikadf

kikadf commented Mar 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for your review. I tried to add wskbd and wsmouse support to libudev-openbsd, and you are right, it is not as simple as I initially thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants