}
struct discover_device *discover_device_create(struct device_handler *handler,
- const char *id)
+ const char *uuid, const char *id)
{
struct discover_device *dev;
- dev = device_lookup_by_id(handler, id);
+ if (uuid)
+ dev = device_lookup_by_uuid(handler, uuid);
+ else
+ dev = device_lookup_by_id(handler, id);
+
if (dev)
return dev;
dev = talloc_zero(handler, struct discover_device);
dev->device = talloc_zero(dev, struct device);
dev->device->id = talloc_strdup(dev->device, id);
+ dev->uuid = talloc_strdup(dev, uuid);
list_init(&dev->params);
list_init(&dev->boot_options);
return 0;
}
-/* incoming conf event */
-int device_handler_conf(struct device_handler *handler,
- struct discover_device *dev, struct pb_url *url)
-{
- struct discover_context *ctx;
- struct boot_status *status;
-
- status = talloc_zero(handler, struct boot_status);
- status->type = BOOT_STATUS_INFO;
- status->message = talloc_asprintf(status, _("Processing user config"));
- device_handler_boot_status(handler, status);
-
- /* create our context */
- ctx = device_handler_discover_context_create(handler, dev);
- ctx->conf_url = url;
-
- iterate_parsers(ctx);
-
- device_handler_discover_context_commit(handler, ctx);
-
- status->message = talloc_asprintf(status,
- _("Processing user config complete"));
- device_handler_boot_status(handler, status);
-
- talloc_free(status);
- talloc_unlink(handler, ctx);
-
- return 0;
-}
-
static struct discover_boot_option *find_boot_option_by_id(
struct device_handler *handler, const char *id)
{
event = talloc(handler, struct event);
event->type = EVENT_TYPE_USER;
- event->action = EVENT_ACTION_CONF;
+ event->action = EVENT_ACTION_URL;
if (url[strlen(url) - 1] == '/') {
event->params = talloc_array(event, struct param, 3);
goto msg;
}
- dev = discover_device_create(handler, event->device);
+ dev = discover_device_create(handler, mac, event->device);
if (pb_url->scheme == pb_url_file)
dev->device->type = DEVICE_TYPE_ANY;
ctx = device_handler_discover_context_create(handler, dev);
struct discover_device *dev = ctx->device;
struct discover_boot_option *opt, *tmp;
- if (!device_lookup_by_id(handler, dev->device->id))
+ if (!device_lookup_by_uuid(handler, dev->uuid))
device_handler_add_device(handler, dev);
/* move boot options from the context to the device */