summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/bbu.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/common/bbu.c b/common/bbu.c
index 1a1edda96b..b6a0e623e2 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -32,12 +32,32 @@ static void append_bbu_entry(struct bbu_handler *handler, struct file_list *file
free(name);
}
+static bool bbu_handler_is_available(struct bbu_handler *handler)
+{
+ struct stat s;
+ int ret;
+
+ device_detect_by_name(devpath_to_name(handler->devicefile));
+
+ ret = stat(handler->devicefile, &s);
+ if (ret)
+ return false;
+
+ return true;
+}
+
void bbu_append_handlers_to_file_list(struct file_list *files)
{
struct bbu_handler *handler;
- list_for_each_entry(handler, &bbu_image_handlers, list)
- append_bbu_entry(handler, files);
+ list_for_each_entry(handler, &bbu_image_handlers, list) {
+ if (bbu_handler_is_available(handler)) {
+ append_bbu_entry(handler, files);
+ } else {
+ pr_info("Skipping unavailable handler bbu-%s\n",
+ handler->name);
+ }
+ }
}
int bbu_force(struct bbu_data *data, const char *fmt, ...)