summaryrefslogtreecommitdiffstats
path: root/tools/idevicebtlogger.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2022-05-09 13:03:01 +0200
committerGravatar Nikias Bassen2022-05-09 13:03:01 +0200
commit2b48c417c5b4f2fa78ab0960eb718ff081fa48e6 (patch)
treed06e9df1772236a571251797a7e0e92f48ae20bb /tools/idevicebtlogger.c
parentcad15f71204f32a389bee2797be22f84e7480f58 (diff)
downloadlibimobiledevice-2b48c417c5b4f2fa78ab0960eb718ff081fa48e6.tar.gz
libimobiledevice-2b48c417c5b4f2fa78ab0960eb718ff081fa48e6.tar.bz2
Add new idevice_events_subscribe/unsubscribe API with context
The older API idevice_event_subscribe/unsubscribe can only be used by a single instance. With the addition of a context, is is now possible to register multiple callback functions in different threads. For backwards compatibility the old API will still be available for a while before being removed in a future release.
Diffstat (limited to 'tools/idevicebtlogger.c')
-rw-r--r--tools/idevicebtlogger.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/idevicebtlogger.c b/tools/idevicebtlogger.c
index 421ce98..8de6b22 100644
--- a/tools/idevicebtlogger.c
+++ b/tools/idevicebtlogger.c
@@ -440,13 +440,14 @@ int main(int argc, char *argv[])
440 assert(0); 440 assert(0);
441 return -2; 441 return -2;
442 } 442 }
443 idevice_event_subscribe(device_event_cb, NULL); 443 idevice_subscription_context_t context = NULL;
444 idevice_events_subscribe(&context, device_event_cb, NULL);
444 445
445 while (!quit_flag) { 446 while (!quit_flag) {
446 sleep(1); 447 sleep(1);
447 } 448 }
448 449
449 idevice_event_unsubscribe(); 450 idevice_events_unsubscribe(context);
450 stop_logging(); 451 stop_logging();
451 452
452 fclose(packetlogger_file); 453 fclose(packetlogger_file);