diff options
author | 2020-05-07 09:42:23 -0700 | |
---|---|---|
committer | 2020-05-07 09:42:23 -0700 | |
commit | 45dd28e6a1ce8bcd42cc7d547c223b05ffebff9b (patch) | |
tree | c3b3ef80696c3291950d315aa4e32b78ffad0806 /src/main.c | |
parent | 68d4d1c89d462ebbeb3cf51120fe96813377a0f6 (diff) | |
download | usbmuxd-45dd28e6a1ce8bcd42cc7d547c223b05ffebff9b.tar.gz usbmuxd-45dd28e6a1ce8bcd42cc7d547c223b05ffebff9b.tar.bz2 |
Do not perform preflight on T2 devices
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -53,10 +53,13 @@ | |||
53 | static const char *socket_path = "/var/run/usbmuxd"; | 53 | static const char *socket_path = "/var/run/usbmuxd"; |
54 | static const char *lockfile = "/var/run/usbmuxd.pid"; | 54 | static const char *lockfile = "/var/run/usbmuxd.pid"; |
55 | 55 | ||
56 | // Global state used in other files | ||
56 | int should_exit; | 57 | int should_exit; |
57 | int should_discover; | 58 | int should_discover; |
58 | int use_logfile = 0; | 59 | int use_logfile = 0; |
60 | int no_preflight = 0; | ||
59 | 61 | ||
62 | // Global state for main.c | ||
60 | static int verbose = 0; | 63 | static int verbose = 0; |
61 | static int foreground = 0; | 64 | static int foreground = 0; |
62 | static int drop_privileges = 0; | 65 | static int drop_privileges = 0; |
@@ -151,7 +154,7 @@ static void set_signal_handlers(void) | |||
151 | sigaddset(&set, SIGUSR1); | 154 | sigaddset(&set, SIGUSR1); |
152 | sigaddset(&set, SIGUSR2); | 155 | sigaddset(&set, SIGUSR2); |
153 | sigprocmask(SIG_SETMASK, &set, NULL); | 156 | sigprocmask(SIG_SETMASK, &set, NULL); |
154 | 157 | ||
155 | memset(&sa, 0, sizeof(struct sigaction)); | 158 | memset(&sa, 0, sizeof(struct sigaction)); |
156 | sa.sa_handler = handle_signal; | 159 | sa.sa_handler = handle_signal; |
157 | sigaction(SIGINT, &sa, NULL); | 160 | sigaction(SIGINT, &sa, NULL); |
@@ -368,6 +371,7 @@ static void usage() | |||
368 | printf(" \tStarting another instance will trigger discovery instead.\n"); | 371 | printf(" \tStarting another instance will trigger discovery instead.\n"); |
369 | printf(" -z, --enable-exit\tEnable \"--exit\" request from other instances and exit\n"); | 372 | printf(" -z, --enable-exit\tEnable \"--exit\" request from other instances and exit\n"); |
370 | printf(" \tautomatically if no device is attached.\n"); | 373 | printf(" \tautomatically if no device is attached.\n"); |
374 | printf(" -p, --no-preflight\tDisable lockdownd preflight on new device.\n"); | ||
371 | #ifdef HAVE_UDEV | 375 | #ifdef HAVE_UDEV |
372 | printf(" -u, --udev\t\tRun in udev operation mode (implies -n and -z).\n"); | 376 | printf(" -u, --udev\t\tRun in udev operation mode (implies -n and -z).\n"); |
373 | #endif | 377 | #endif |
@@ -392,6 +396,7 @@ static void parse_opts(int argc, char **argv) | |||
392 | {"user", required_argument, NULL, 'U'}, | 396 | {"user", required_argument, NULL, 'U'}, |
393 | {"disable-hotplug", no_argument, NULL, 'n'}, | 397 | {"disable-hotplug", no_argument, NULL, 'n'}, |
394 | {"enable-exit", no_argument, NULL, 'z'}, | 398 | {"enable-exit", no_argument, NULL, 'z'}, |
399 | {"no-preflight", no_argument, NULL, 'p'}, | ||
395 | #ifdef HAVE_UDEV | 400 | #ifdef HAVE_UDEV |
396 | {"udev", no_argument, NULL, 'u'}, | 401 | {"udev", no_argument, NULL, 'u'}, |
397 | #endif | 402 | #endif |
@@ -407,11 +412,11 @@ static void parse_opts(int argc, char **argv) | |||
407 | int c; | 412 | int c; |
408 | 413 | ||
409 | #ifdef HAVE_SYSTEMD | 414 | #ifdef HAVE_SYSTEMD |
410 | const char* opts_spec = "hfvVuU:xXsnzl:"; | 415 | const char* opts_spec = "hfvVuU:xXsnzl:p"; |
411 | #elif HAVE_UDEV | 416 | #elif HAVE_UDEV |
412 | const char* opts_spec = "hfvVuU:xXnzl:"; | 417 | const char* opts_spec = "hfvVuU:xXnzl:p"; |
413 | #else | 418 | #else |
414 | const char* opts_spec = "hfvVU:xXnzl:"; | 419 | const char* opts_spec = "hfvVU:xXnzl:p"; |
415 | #endif | 420 | #endif |
416 | 421 | ||
417 | while (1) { | 422 | while (1) { |
@@ -437,6 +442,9 @@ static void parse_opts(int argc, char **argv) | |||
437 | drop_privileges = 1; | 442 | drop_privileges = 1; |
438 | drop_user = optarg; | 443 | drop_user = optarg; |
439 | break; | 444 | break; |
445 | case 'p': | ||
446 | no_preflight = 1; | ||
447 | break; | ||
440 | #ifdef HAVE_UDEV | 448 | #ifdef HAVE_UDEV |
441 | case 'u': | 449 | case 'u': |
442 | opt_disable_hotplug = 1; | 450 | opt_disable_hotplug = 1; |