Add udev trigger
authorGeoff Levand <geoffrey.levand@am.sony.com>
Sun, 12 Apr 2009 15:11:40 +0000 (15:11 +0000)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 30 Jun 2009 07:29:03 +0000 (15:29 +0800)
Add a new routine udev_trigger() that requests a replay of
system udev events.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/pb-discover.c
discover/udev.c
discover/udev.h

index 2b04e62ee0247ab95d153325c9d3f2f865ca28bb..4d618147f15c8e1a18a4ec6a900dd92c240ba2b7 100644 (file)
@@ -52,6 +52,8 @@ int main(void)
        if (!udev)
                return EXIT_FAILURE;
 
+       udev_trigger(udev);
+
        for (running = 1; running;) {
                if (waiter_poll())
                        break;
index b93c1a5f0ff6d68dace1c0cf8605c528dd11f3c2..54967128f6006db813332ebc886821118d3d25b3 100644 (file)
@@ -208,6 +208,16 @@ out_err:
        return NULL;
 }
 
+int udev_trigger(struct udev __attribute__((unused)) *udev)
+{
+       int rc = system("/sbin/udevadm trigger --subsystem-match=block");
+
+       if (rc)
+               pb_log("udev trigger failed: %d (%d)\n", rc, WEXITSTATUS(rc));
+
+       return WEXITSTATUS(rc);
+}
+
 void udev_destroy(struct udev *udev)
 {
        talloc_free(udev);
index 250273f2722eb27e52774adfb560e7d92cbbac41..afdbbe18667c1158e1f7523930e12e2f04f1b00a 100644 (file)
@@ -21,6 +21,7 @@ struct udev;
 struct device_handler;
 
 struct udev *udev_init(struct device_handler *handler);
+int udev_trigger(struct udev *udev);
 
 void udev_destroy(struct udev *udev);