chiark / gitweb /
device: consider udev devices with SYSTEMD_READY=0 as unplugged
[elogind.git] / src / device.c
index 5289da3e42ef210896f4bb11c9cf3640415ab0ee..b9d8a2b9cf4a6444c5ee8ccf1563a1f81dddab3d 100644 (file)
@@ -526,7 +526,7 @@ fail:
 void device_fd_event(Manager *m, int events) {
         struct udev_device *dev;
         int r;
-        const char *action;
+        const char *action, *ready;
 
         assert(m);
 
@@ -552,7 +552,9 @@ void device_fd_event(Manager *m, int events) {
                 goto fail;
         }
 
-        if (streq(action, "remove")) {
+        ready = udev_device_get_property_value(dev, "SYSTEMD_READY");
+
+        if (streq(action, "remove") || (ready && parse_boolean(ready) == 0)) {
                 if ((r = device_process_removed_device(m, dev)) < 0) {
                         log_error("Failed to process udev device event: %s", strerror(-r));
                         goto fail;