From 44409c16e7e3c5875b642a088b4b24bb637eaa67 Mon Sep 17 00:00:00 2001 From: illiliti Date: Fri, 21 Aug 2020 14:55:24 +0300 Subject: [PATCH] attempt to write docs --- README.md | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a26abc5..3bf3882 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ libudev-zero ============ -Drop-in replacement for libudev intended to work without daemon +Drop-in replacement for libudev enables you to use whatever +device manager you like without worrying about udev dependency at all! What Works ---------- + * [x] xorg-server * [x] libinput * [x] wlroots @@ -32,6 +34,45 @@ make PREFIX=/usr install # will overwrite existing udev libraries if any # here we go ! ``` +Hotplugging +----------- + +There is no complicated or overengineered way to use hotplugging. Everything is +portable as much as possible. To use hotplugging the only thing you need is +uevent's receiver (device manager, busybox `uevent`, CONFIG_UEVENT_HELPER, ...). +I will describe only mdev and CONFIG_UEVENT_HELPER because their usage is very basic. +For busybox `uevent` you need to write your own parser which is kinda ... complex. + +UDEV_MONITOR_DIR is arbitrary directory where uevent files stored. +Default is `/tmp/.libudev-zero`. You can change it at build time by appending +`-DUDEV_MONITOR_DIR=` to CFLAGS. I don't recommend setting UDEV_MONITOR_DIR +to regular fs (i.e non-tmpfs) because unneeded files aren't automatically discarded +after reboot or termination (yet). + +* mdev + + - merge [mdev.conf](contrib/mdev.conf) with your mdev.conf + - restart mdev daemon + +* CONFIG_UEVENT_HELPER + + - ensure that CONFIG_UEVENT_HELPER enabled in kernel + - add full path of [helper.sh](contrib/helper.sh) (must be executable) or + [helper.c](contrib/helper.c) (compile it first) to /proc/sys/kernel/hotplug + + example: + ```sh + echo /full/path/to/helper > /proc/sys/kernel/hotplug # will use default UDEV_MONITOR_DIR + OR + echo "/full/path/to/helper " > /proc/sys/kernel/hotplug # change to your UDEV_MONITOR_DIR + ``` + +* run application which uses hotplugging (e.g xorg-server) +* unplug and plug something to test working capacity + +That's all! If you realized that this doesn't work for you, +you can always open an issue and describe your bug. + TODO ----