summaryrefslogtreecommitdiffstats
path: root/tools/idevicebtlogger.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevicebtlogger.c')
-rw-r--r--tools/idevicebtlogger.c18
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 */
69static void bt_packet_logger_callback(uint8_t * data, uint16_t len, void *user_data) 72static 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 */
131static void stop_logging(void) 137static 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 */
146static int start_logging(void) 155static 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 */
183static void device_event_cb(const idevice_event_t* event, void* userdata) 195static 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 */
221static void print_usage(int argc, char **argv, int is_error) 236static 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 */
243int main(int argc, char *argv[]) 261int main(int argc, char *argv[])
244{ 262{
245 int c = 0; 263 int c = 0;