mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 12:35:25 +00:00
re-activate sleep notifications, but don't disconnect if power mangement is enabled
This commit is contained in:
parent
a48c56425a
commit
66da704455
@ -41,6 +41,9 @@
|
||||
|
||||
extern bt_control_t bt_control_iphone;
|
||||
|
||||
int bt_control_iphone_power_management_enabled(void);
|
||||
|
||||
// control system Bluetooth
|
||||
int iphone_system_bt_enabled();
|
||||
void iphone_system_bt_set_enabled(int enabled);
|
||||
|
||||
|
@ -539,9 +539,7 @@ static int iphone_on (void *transport_config){
|
||||
};
|
||||
err = pclose(outputFile);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// if we sleep for about 3 seconds, we miss a strage packet... but we don't care
|
||||
// sleep(3);
|
||||
|
||||
@ -641,10 +639,11 @@ static void MySleepCallBack( void * refCon, io_service_t service, natural_t mess
|
||||
data = POWER_WILL_SLEEP;
|
||||
write(power_notification_pipe_fds[1], &data, 1);
|
||||
|
||||
// only allow power change when power management active (and BT goes to sleep alone)
|
||||
if (!power_management_active) break;
|
||||
|
||||
IOAllowPowerChange( root_port, (long)messageArgument );
|
||||
// don't allow power change, even when power management is active
|
||||
// BTstack needs to disable discovery mode during sleep to save power
|
||||
|
||||
// if (!power_management_active) break;
|
||||
// IOAllowPowerChange( root_port, (long)messageArgument );
|
||||
|
||||
break;
|
||||
|
||||
@ -726,3 +725,8 @@ bt_control_t bt_control_iphone = {
|
||||
NULL // register_for_power_notifications
|
||||
#endif
|
||||
};
|
||||
|
||||
// direct access
|
||||
int bt_control_iphone_power_management_enabled(void){
|
||||
return power_management_active;
|
||||
}
|
||||
|
@ -1060,6 +1060,13 @@ void hci_run(){
|
||||
log_info("HCI_STATE_FALLING_ASLEEP\n");
|
||||
// close all open connections
|
||||
connection = (hci_connection_t *) hci_stack.connections;
|
||||
|
||||
#if defined(USE_POWERMANAGEMENT) && defined(BLUETOOL)
|
||||
// don't close connections, if H4 supports power management
|
||||
if (bt_control_iphone_power_management_enabled()){
|
||||
connection = NULL;
|
||||
}
|
||||
#endif
|
||||
if (connection){
|
||||
|
||||
// send disconnect
|
||||
|
Loading…
x
Reference in New Issue
Block a user