diff options
-rw-r--r-- | src/device.c | 2 | ||||
-rw-r--r-- | src/main.c | 16 | ||||
-rw-r--r-- | src/preflight.c | 10 |
3 files changed, 22 insertions, 6 deletions
diff --git a/src/device.c b/src/device.c index 6858cf5..64e4e8d 100644 --- a/src/device.c +++ b/src/device.c | |||
@@ -690,7 +690,7 @@ static void device_tcp_input(struct mux_device *dev, struct tcphdr *th, unsigned | |||
690 | return; | 690 | return; |
691 | } | 691 | } |
692 | conn->state = CONN_CONNECTED; | 692 | conn->state = CONN_CONNECTED; |
693 | usbmuxd_log(LL_DEBUG, "Client connected to device %d (%d->%d)", dev->id, sport, dport); | 693 | usbmuxd_log(LL_INFO, "Client connected to device %d (%d->%d)", dev->id, sport, dport); |
694 | if(client_notify_connect(conn->client, RESULT_OK) < 0) { | 694 | if(client_notify_connect(conn->client, RESULT_OK) < 0) { |
695 | conn->client = NULL; | 695 | conn->client = NULL; |
696 | connection_teardown(conn); | 696 | connection_teardown(conn); |
@@ -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; |
diff --git a/src/preflight.c b/src/preflight.c index c7cfa50..820f3fc 100644 --- a/src/preflight.c +++ b/src/preflight.c | |||
@@ -41,6 +41,9 @@ | |||
41 | #include "client.h" | 41 | #include "client.h" |
42 | #include "conf.h" | 42 | #include "conf.h" |
43 | #include "log.h" | 43 | #include "log.h" |
44 | #include "usb.h" | ||
45 | |||
46 | extern int no_preflight; | ||
44 | 47 | ||
45 | #ifdef HAVE_LIBIMOBILEDEVICE | 48 | #ifdef HAVE_LIBIMOBILEDEVICE |
46 | #ifndef HAVE_ENUM_IDEVICE_CONNECTION_TYPE | 49 | #ifndef HAVE_ENUM_IDEVICE_CONNECTION_TYPE |
@@ -270,7 +273,7 @@ retry: | |||
270 | "com.apple.mobile.lockdown.request_pair", | 273 | "com.apple.mobile.lockdown.request_pair", |
271 | "com.apple.mobile.lockdown.request_host_buid", | 274 | "com.apple.mobile.lockdown.request_host_buid", |
272 | NULL | 275 | NULL |
273 | }; | 276 | }; |
274 | np_observe_notifications(np, spec); | 277 | np_observe_notifications(np, spec); |
275 | 278 | ||
276 | /* TODO send notification to user's desktop */ | 279 | /* TODO send notification to user's desktop */ |
@@ -353,6 +356,11 @@ void preflight_device_remove_cb(void *data) | |||
353 | 356 | ||
354 | void preflight_worker_device_add(struct device_info* info) | 357 | void preflight_worker_device_add(struct device_info* info) |
355 | { | 358 | { |
359 | if (info->pid == PID_APPLE_T2_COPROCESSOR || no_preflight == 1) { | ||
360 | client_device_add(info); | ||
361 | return; | ||
362 | } | ||
363 | |||
356 | #ifdef HAVE_LIBIMOBILEDEVICE | 364 | #ifdef HAVE_LIBIMOBILEDEVICE |
357 | struct device_info *infocopy = (struct device_info*)malloc(sizeof(struct device_info)); | 365 | struct device_info *infocopy = (struct device_info*)malloc(sizeof(struct device_info)); |
358 | 366 | ||