Create device-handler for managing registered devices
[petitboot] / discover / pb-discover.c
index 45b6ba1c7207c62a870a73fe3d22c317bf418326..63aaf0089543965a228849dcdccadceaa16c02fe 100644 (file)
@@ -4,26 +4,33 @@
 
 #include "udev.h"
 #include "discover-server.h"
+#include "device-handler.h"
 #include "waiter.h"
 #include "log.h"
 
-
 int main(void)
 {
+       struct device_handler *handler;
        struct discover_server *server;
        struct udev *udev;
 
        /* we look for closed sockets when we write, so ignore SIGPIPE */
        signal(SIGPIPE, SIG_IGN);
 
-       udev = udev_init();
-       if (!udev)
-               return EXIT_FAILURE;
-
        server = discover_server_init();
        if (!server)
                return EXIT_FAILURE;
 
+       handler = device_handler_init(server);
+       if (!handler)
+               return EXIT_FAILURE;
+
+       discover_server_set_device_source(server, handler);
+
+       udev = udev_init();
+       if (!udev)
+               return EXIT_FAILURE;
+
        for (;;) {
                if (waiter_poll())
                        return EXIT_FAILURE;