X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fdevice-handler.c;h=251c517f884aaa0c2212898b2e71dd3ad37a8e9e;hp=02ae6884db47876cffb740d86841c6f9c40afc82;hb=b3d241164a7e34eed56159f4e0a8a2821b7ebf4d;hpb=e39c5ad541830cecbd331f877ef43ded738a9251 diff --git a/discover/device-handler.c b/discover/device-handler.c index 02ae688..251c517 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -103,6 +103,12 @@ static int device_match_id(struct discover_device *dev, const char *id) return !strcmp(dev->device->id, id); } +static int device_match_serial(struct discover_device *dev, const char *serial) +{ + const char *val = discover_device_get_param(dev, "ID_SERIAL"); + return val && !strcmp(val, serial); +} + static struct discover_device *device_lookup( struct device_handler *device_handler, int (match_fn)(struct discover_device *, const char *), @@ -154,6 +160,13 @@ struct discover_device *device_lookup_by_id( return device_lookup(device_handler, device_match_id, id); } +struct discover_device *device_lookup_by_serial( + struct device_handler *device_handler, + const char *serial) +{ + return device_lookup(device_handler, device_match_serial, serial); +} + void device_handler_destroy(struct device_handler *handler) { talloc_free(handler); @@ -327,6 +340,8 @@ static int default_timeout(void *arg) return 0; } + handler->timeout_waiter = NULL; + pb_log("Timeout expired, booting default option %s\n", opt->option->id); boot(handler, handler->default_boot_option, NULL,