summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--devices.c8
-rw-r--r--petitboot.c29
-rw-r--r--petitboot.h2
3 files changed, 36 insertions, 3 deletions
diff --git a/devices.c b/devices.c
index 43a388d..4936f9a 100644
--- a/devices.c
+++ b/devices.c
@@ -238,7 +238,7 @@ static twin_bool_t pboot_proc_server_sock(int sock, twin_file_op_t ops,
return TWIN_TRUE;
}
-int pboot_start_device_discovery(void)
+int pboot_start_device_discovery(int udev_trigger)
{
int sock;
struct sockaddr_un addr;
@@ -269,6 +269,12 @@ int pboot_start_device_discovery(void)
twin_set_file(pboot_proc_server_sock, sock, TWIN_READ, &_ctx);
+ if (udev_trigger) {
+ int rc = system("udevtrigger");
+ if (rc)
+ LOG("udevtrigger failed, rc %d\n", rc);
+ }
+
return TWIN_TRUE;
}
diff --git a/petitboot.c b/petitboot.c
index 84a76f6..d566e3f 100644
--- a/petitboot.c
+++ b/petitboot.c
@@ -914,8 +914,35 @@ static void sigint(int sig)
syscall(__NR_exit);
}
+static void usage(const char *progname)
+{
+ fprintf(stderr, "Usage: %s [-u] [-h]\n", progname);
+}
+
int main(int argc, char **argv)
{
+ int c;
+ int udev_trigger = 0;
+
+ for (;;) {
+ c = getopt(argc, argv, "u::h");
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 'u':
+ udev_trigger = 1;
+ break;
+ case 'h':
+ usage(argv[0]);
+ return EXIT_SUCCESS;
+ default:
+ fprintf(stderr, "Unknown option '%c'\n", c);
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ }
+
atexit(exitfunc);
signal(SIGINT, sigint);
@@ -956,7 +983,7 @@ int main(int argc, char **argv)
twin_window_queue_paint(pboot_lpane->window);
twin_window_queue_paint(pboot_rpane->window);
- if (!pboot_start_device_discovery()) {
+ if (!pboot_start_device_discovery(udev_trigger)) {
LOG("Couldn't start device discovery!\n");
return 1;
}
diff --git a/petitboot.h b/petitboot.h
index 147fe7f..e9102df 100644
--- a/petitboot.h
+++ b/petitboot.h
@@ -12,5 +12,5 @@ int pboot_add_option(int devindex, const char *title,
const char *subtitle, twin_pixmap_t *badge, void *data);
int pboot_remove_device(const char *dev_id);
-int pboot_start_device_discovery(void);
+int pboot_start_device_discovery(int udev_trigger);
void pboot_exec_option(void *data);
OpenPOWER on IntegriCloud