From 21113242b1322f14ec0fd3bdef20dc5bf2d9b8ee Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Sat, 9 Jan 2010 21:27:47 +0000 Subject: [PATCH] fix compile for posix platforms --- src/bt_control_iphone.m | 17 ++++++++++------- src/hci_transport_h4.c | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/bt_control_iphone.m b/src/bt_control_iphone.m index b53f64f11..726e6594c 100644 --- a/src/bt_control_iphone.m +++ b/src/bt_control_iphone.m @@ -55,6 +55,8 @@ #include #include +#ifdef USE_BLUETOOL + // minimal IOKit #ifdef __APPLE__ #include @@ -72,6 +74,7 @@ kern_return_t IOObjectRelease(mach_port_t object); #endif #endif + // minimal BluetoothManager swiped from BigBoss SBSettings Toggle #import @class UIDevice; @@ -118,7 +121,7 @@ void iphone_system_bt_set_enabled(int enabled) CFPreferencesAppSynchronize(kAppNetwork); } - +#endif #define BUFF_LEN 80 static char buffer[BUFF_LEN+1]; @@ -328,7 +331,12 @@ static int iphone_on (void *transport_config){ hci_uart_config_t * hci_uart_config = (hci_uart_config_t*) transport_config; -#if 0 +#ifdef USE_BLUETOOL + if (iphone_system_bt_enabled()){ + perror("iphone_on: System Bluetooth enabled!"); + return 1; + } +#else // quick test if Bluetooth UART can be opened int fd = open(hci_uart_config->device_name, O_RDWR | O_NOCTTY | O_NDELAY); if (fd == -1) { @@ -337,11 +345,6 @@ static int iphone_on (void *transport_config){ return 1; } close(fd); -#else - if (iphone_system_bt_enabled()){ - perror("iphone_on: System Bluetooth enabled!"); - return 1; - } #endif int err = 0; diff --git a/src/hci_transport_h4.c b/src/hci_transport_h4.c index 4da9b10a2..cc620b081 100644 --- a/src/hci_transport_h4.c +++ b/src/hci_transport_h4.c @@ -238,7 +238,7 @@ static int h4_process(struct data_source *ds) { bytes_to_read = HCI_ACL_DATA_PKT_HDR; h4_state = H4_W4_ACL_HEADER; } else { - fprintf(stderr, "h4_process: invalid packet type 0x%02x\n"); + fprintf(stderr, "h4_process: invalid packet type 0x%02x\n", hci_packet[0]); read_pos = 0; bytes_to_read = 1; }