extracted iphone_os_at_least_40

This commit is contained in:
matthias.ringwald 2011-08-28 19:09:39 +00:00
parent c120f476eb
commit 2f84a6b35c
2 changed files with 17 additions and 2 deletions

View File

@ -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();

View File

@ -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,