diff options
author | Geoffrey Kruse | 2021-03-07 15:48:04 -0800 |
---|---|---|
committer | Nikias Bassen | 2022-05-05 18:57:35 +0200 |
commit | 881d76c753846d38f7207fc992ea7fd1fd4692ed (patch) | |
tree | 5752924dca98aeb00b061beff5bd314b5c345da1 /tools | |
parent | 34629755cebc5fb6f9b6923c9a66649acd28ba53 (diff) | |
download | libimobiledevice-881d76c753846d38f7207fc992ea7fd1fd4692ed.tar.gz libimobiledevice-881d76c753846d38f7207fc992ea7fd1fd4692ed.tar.bz2 |
idevicebtlogger: Simplify by using bt_packet_logger_client_start_service()
Diffstat (limited to 'tools')
-rw-r--r-- | tools/idevicebtlogger.c | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/tools/idevicebtlogger.c b/tools/idevicebtlogger.c index 8728ef0..7e1c0b0 100644 --- a/tools/idevicebtlogger.c +++ b/tools/idevicebtlogger.c @@ -161,41 +161,10 @@ static int start_logging(void) } /* start bt_packet_logger service */ - lockdownd_service_descriptor_t svc = NULL; - lerr = lockdownd_start_service(lockdown, BT_PACKETLOGGER_SERVICE_NAME, &svc); - if (lerr == LOCKDOWN_E_PASSWORD_PROTECTED) { - fprintf(stderr, "*** Device is passcode protected, enter passcode on the device to continue ***\n"); - while (!quit_flag) { - lerr = lockdownd_start_service(lockdown, BT_PACKETLOGGER_SERVICE_NAME, &svc); - if (lerr != LOCKDOWN_E_PASSWORD_PROTECTED) { - break; - } - sleep(1); - } - } - if (lerr != LOCKDOWN_E_SUCCESS) { - fprintf(stderr, "ERROR: Could not connect to lockdownd: %d\n", lerr); - fprintf(stderr, "Please ensure the target device has a valid Bluetooth logging profile installed\n"); - idevice_free(device); - device = NULL; - return -1; - } - lockdownd_client_free(lockdown); - - /* connect to bt_packet_logger service */ - bt_packet_logger_error_t serr = BT_PACKET_LOGGER_E_UNKNOWN_ERROR; - serr = bt_packet_logger_client_new(device, svc, &bt_packet_logger); - lockdownd_service_descriptor_free(svc); - if (serr != BT_PACKET_LOGGER_E_SUCCESS) { - fprintf(stderr, "ERROR: Could not start service %s.\n", BT_PACKETLOGGER_SERVICE_NAME); - fprintf(stderr, "Please ensure the target device has a valid Bluetooth logging profile installed\n"); - idevice_free(device); - device = NULL; - return -1; - } + bt_packet_logger_client_start_service(device, &bt_packet_logger, TOOL_NAME); /* start capturing bt_packet_logger */ - serr = bt_packet_logger_start_capture(bt_packet_logger, bt_packet_logger_callback, NULL); + bt_packet_logger_error_t serr = bt_packet_logger_start_capture(bt_packet_logger, bt_packet_logger_callback, NULL); if (serr != BT_PACKET_LOGGER_E_SUCCESS) { fprintf(stderr, "ERROR: Unable to start capturing bt_packet_logger.\n"); bt_packet_logger_client_free(bt_packet_logger); |