diff options
author | 2021-03-07 15:54:07 -0800 | |
---|---|---|
committer | 2022-05-05 19:00:09 +0200 | |
commit | ef94d2370063b6a409ff338dc87c06c2bb6d22c2 (patch) | |
tree | 71fc5008b04aafac77c07486e2dbff94e94a238e /tools/idevicebtlogger.c | |
parent | 881d76c753846d38f7207fc992ea7fd1fd4692ed (diff) | |
download | libimobiledevice-ef94d2370063b6a409ff338dc87c06c2bb6d22c2.tar.gz libimobiledevice-ef94d2370063b6a409ff338dc87c06c2bb6d22c2.tar.bz2 |
idevicebtlogger: Minor cleanup
Diffstat (limited to 'tools/idevicebtlogger.c')
-rw-r--r-- | tools/idevicebtlogger.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/idevicebtlogger.c b/tools/idevicebtlogger.c index 7e1c0b0..b73d958 100644 --- a/tools/idevicebtlogger.c +++ b/tools/idevicebtlogger.c | |||
@@ -66,6 +66,9 @@ typedef enum { | |||
66 | RECV_ACL_DATA = 0x03 | 66 | RECV_ACL_DATA = 0x03 |
67 | } PacketLoggerPacketType; | 67 | } PacketLoggerPacketType; |
68 | 68 | ||
69 | /** | ||
70 | * Callback from the packet logger service to handle packets and log to pcap | ||
71 | */ | ||
69 | static void bt_packet_logger_callback(uint8_t * data, uint16_t len, void *user_data) | 72 | static void bt_packet_logger_callback(uint8_t * data, uint16_t len, void *user_data) |
70 | { | 73 | { |
71 | bt_packet_logger_header_t * header = (bt_packet_logger_header_t *)data; | 74 | bt_packet_logger_header_t * header = (bt_packet_logger_header_t *)data; |
@@ -128,6 +131,9 @@ static void bt_packet_logger_callback(uint8_t * data, uint16_t len, void *user_d | |||
128 | } | 131 | } |
129 | } | 132 | } |
130 | 133 | ||
134 | /** | ||
135 | * Disable HCI log capture | ||
136 | */ | ||
131 | static void stop_logging(void) | 137 | static void stop_logging(void) |
132 | { | 138 | { |
133 | fflush(NULL); | 139 | fflush(NULL); |
@@ -143,6 +149,9 @@ static void stop_logging(void) | |||
143 | } | 149 | } |
144 | } | 150 | } |
145 | 151 | ||
152 | /** | ||
153 | * Enable HCI log capture | ||
154 | */ | ||
146 | static int start_logging(void) | 155 | static int start_logging(void) |
147 | { | 156 | { |
148 | idevice_error_t ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); | 157 | idevice_error_t ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); |
@@ -180,6 +189,9 @@ static int start_logging(void) | |||
180 | return 0; | 189 | return 0; |
181 | } | 190 | } |
182 | 191 | ||
192 | /** | ||
193 | * Callback for device events | ||
194 | */ | ||
183 | static void device_event_cb(const idevice_event_t* event, void* userdata) | 195 | static void device_event_cb(const idevice_event_t* event, void* userdata) |
184 | { | 196 | { |
185 | if (use_network && event->conn_type != CONNECTION_NETWORK) { | 197 | if (use_network && event->conn_type != CONNECTION_NETWORK) { |
@@ -218,6 +230,9 @@ static void clean_exit(int sig) | |||
218 | quit_flag++; | 230 | quit_flag++; |
219 | } | 231 | } |
220 | 232 | ||
233 | /** | ||
234 | * print usage information | ||
235 | */ | ||
221 | static void print_usage(int argc, char **argv, int is_error) | 236 | static void print_usage(int argc, char **argv, int is_error) |
222 | { | 237 | { |
223 | char *name = NULL; | 238 | char *name = NULL; |
@@ -240,6 +255,9 @@ static void print_usage(int argc, char **argv, int is_error) | |||
240 | ); | 255 | ); |
241 | } | 256 | } |
242 | 257 | ||
258 | /** | ||
259 | * Program entry | ||
260 | */ | ||
243 | int main(int argc, char *argv[]) | 261 | int main(int argc, char *argv[]) |
244 | { | 262 | { |
245 | int c = 0; | 263 | int c = 0; |