mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-24 15:02:43 +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;
|
extern bt_control_t bt_control_iphone;
|
||||||
|
|
||||||
|
int bt_control_iphone_power_management_enabled(void);
|
||||||
|
|
||||||
// control system Bluetooth
|
// control system Bluetooth
|
||||||
int iphone_system_bt_enabled();
|
int iphone_system_bt_enabled();
|
||||||
void iphone_system_bt_set_enabled(int enabled);
|
void iphone_system_bt_set_enabled(int enabled);
|
||||||
|
|
||||||
|
@ -540,8 +540,6 @@ static int iphone_on (void *transport_config){
|
|||||||
err = pclose(outputFile);
|
err = pclose(outputFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// if we sleep for about 3 seconds, we miss a strage packet... but we don't care
|
// if we sleep for about 3 seconds, we miss a strage packet... but we don't care
|
||||||
// sleep(3);
|
// sleep(3);
|
||||||
|
|
||||||
@ -641,10 +639,11 @@ static void MySleepCallBack( void * refCon, io_service_t service, natural_t mess
|
|||||||
data = POWER_WILL_SLEEP;
|
data = POWER_WILL_SLEEP;
|
||||||
write(power_notification_pipe_fds[1], &data, 1);
|
write(power_notification_pipe_fds[1], &data, 1);
|
||||||
|
|
||||||
// only allow power change when power management active (and BT goes to sleep alone)
|
// don't allow power change, even when power management is active
|
||||||
if (!power_management_active) break;
|
// BTstack needs to disable discovery mode during sleep to save power
|
||||||
|
|
||||||
IOAllowPowerChange( root_port, (long)messageArgument );
|
// if (!power_management_active) break;
|
||||||
|
// IOAllowPowerChange( root_port, (long)messageArgument );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -726,3 +725,8 @@ bt_control_t bt_control_iphone = {
|
|||||||
NULL // register_for_power_notifications
|
NULL // register_for_power_notifications
|
||||||
#endif
|
#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");
|
log_info("HCI_STATE_FALLING_ASLEEP\n");
|
||||||
// close all open connections
|
// close all open connections
|
||||||
connection = (hci_connection_t *) hci_stack.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){
|
if (connection){
|
||||||
|
|
||||||
// send disconnect
|
// send disconnect
|
||||||
|
Loading…
x
Reference in New Issue
Block a user