illiliti / libudev-zero

Daemonless replacement for libudev
ISC License
202 stars 22 forks source link

Hotplugging no longer works #39

Closed alandiwix closed 3 years ago

alandiwix commented 3 years ago

Hotplugging stopped working on sway recently, probably after update to 1.0.0 on AlpineLinux. Uevents are correctly created, but sway doesn't detect new devices. UPD after quick look on the latest commits: so now we have "fileless" netlink-based hotplug. It means that the old method through /tmp/.libudev-zero will no longer work.

TAAPArthur commented 2 years ago

@illiliti I was surprised by this behavior change too. Could you help me understand the rationale behind the change?

illiliti commented 2 years ago

The rationale is simple. Instead of polling arbitrary directory for uevents and dealing with possible race conditions, we can leverage existing netlink functionality to monitor uevents. This makes things much simpler.

mdevd supports this feature natively: https://github.com/skarnet/mdevd/commit/b61ab0373a724d38e059655d561b5fb3dcb2aff6

I also wrote helper for device managers that don't support this feature natively(e.g busybox mdev): https://github.com/illiliti/libudev-zero/blob/4154cf252c17297f98a8ca33693ead003b4509da/contrib/helper.c

TAAPArthur commented 2 years ago

Yeah I think including a working script to support hotplugging was a really nice touch and made migration trivial.

Note: this isn't a criticism of the change. I just didn't see a justification listed anywhere and thought having it recorded could avoid some confusion down the line.