diff --git a/src/bt_control_iphone.h b/src/bt_control_iphone.h index 9dd34f3b9..b9fe933f9 100644 --- a/src/bt_control_iphone.h +++ b/src/bt_control_iphone.h @@ -42,6 +42,7 @@ extern bt_control_t bt_control_iphone; int bt_control_iphone_power_management_enabled(void); +int bt_control_iphone_power_management_supported(void); // control system Bluetooth int iphone_system_bt_enabled(); diff --git a/src/bt_control_iphone.m b/src/bt_control_iphone.m index 8dd702d16..8733ee350 100644 --- a/src/bt_control_iphone.m +++ b/src/bt_control_iphone.m @@ -152,6 +152,13 @@ static int power_management_active = 0; static char *os3xBlueTool = "BlueTool"; static char *os4xBlueTool = "/usr/local/bin/BlueToolH4"; +/** + * check OS version for >= 4.0 + */ +static int iphone_os_at_least_40(){ + return kCFCoreFoundationVersionNumber >= 550.32; +} + /** * get machine name */ @@ -473,8 +480,7 @@ static int iphone_on (void *transport_config){ err = system ("launchctl unload /System/Library/LaunchDaemons/com.apple.BTServer.plist"); // check for os version >= 4.0 - int os4x = kCFCoreFoundationVersionNumber >= 550.32; - log_info("CFVersion %f, >= 4.0 %u\n", kCFCoreFoundationVersionNumber, os4x); + int os4x = iphone_os_at_least_40(); // OS 4.0 char * bluetool = os3xBlueTool; @@ -709,6 +715,14 @@ void iphone_register_for_power_notifications(void (*cb)(POWER_NOTIFICATION_t eve } #endif +int bt_control_iphone_power_management_supported(void){ + // only supported on Broadcom chipsets with iOS 4.0+ + if ( iphone_has_csr()) return 0; + if (!iphone_os_at_least_40()) return 0; + return 1; +} + + // single instance bt_control_t bt_control_iphone = { .on = iphone_on,