Skip to content

Handle attached-detached devices with udev monitor#7

Open
kikadf wants to merge 2 commits intosizeofvoid:build-on-openbsdfrom
kikadf:hotplug
Open

Handle attached-detached devices with udev monitor#7
kikadf wants to merge 2 commits intosizeofvoid:build-on-openbsdfrom
kikadf:hotplug

Conversation

@kikadf
Copy link

@kikadf kikadf commented Jan 30, 2026

(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,
}, 

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.

1 participant