mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-03 23:47:08 +00:00
don't release UART during SLEEP - fixes problem with BTServer trying to do power management
This commit is contained in:
parent
8bbce7f8c2
commit
b429b9b757
15
TODO.txt
15
TODO.txt
@ -16,22 +16,19 @@
|
||||
- automate scan enable management: hci_set_discoverable(bool) sets inquiry scan, page scan is always active
|
||||
|
||||
NEXT:
|
||||
- check apps for sleep mode/reactivated compatibility - see what happens on ACTIVATED event
|
||||
- BTstackManager
|
||||
- WiiMote example
|
||||
- Keyboard
|
||||
- Mouse
|
||||
- WeBe++
|
||||
- check apps for sleep/wake mode compatibility - see what happens on ACTIVATED event
|
||||
- update WiiMote example to use BTstackManager
|
||||
|
||||
- BTstackManager & new remote_db
|
||||
- don't keep device info
|
||||
- don't hanle link keys
|
||||
|
||||
- don't handle link keys
|
||||
- react to remote_name_cached event
|
||||
|
||||
- create Retina status bar icons
|
||||
|
||||
- bugs:
|
||||
- verify: if (hic?) disconnect fails, l2cap channels are never discarded
|
||||
|
||||
- verify: TestBTstackManager can do an inquiry, with 0 or more devices in the list
|
||||
- get rid of BTInquireViewController
|
||||
- update WiiMoteExample to use BTstackManager
|
||||
- Update/rewrite BTstack Keyboard
|
||||
|
63
src/hci.c
63
src/hci.c
@ -585,34 +585,6 @@ static int hci_power_control_on(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hci_power_control_wake(){
|
||||
|
||||
log_dbg("hci_power_control_wake");
|
||||
|
||||
// wake on
|
||||
int err = 0;
|
||||
if (hci_stack.control && hci_stack.control->wake){
|
||||
err = (*hci_stack.control->wake)(hci_stack.config);
|
||||
}
|
||||
if (err){
|
||||
log_err( "WAKE_ON failed\n");
|
||||
hci_emit_hci_open_failed();
|
||||
return err;
|
||||
}
|
||||
|
||||
// open low-level device
|
||||
err = hci_stack.hci_transport->open(hci_stack.config);
|
||||
if (err){
|
||||
log_err( "HCI_INIT failed, turning Bluetooth off again\n");
|
||||
if (hci_stack.control && hci_stack.control->off){
|
||||
(*hci_stack.control->off)(hci_stack.config);
|
||||
}
|
||||
hci_emit_hci_open_failed();
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hci_power_control_off(){
|
||||
|
||||
// close low-level device
|
||||
@ -626,19 +598,50 @@ static void hci_power_control_off(){
|
||||
}
|
||||
|
||||
static void hci_power_control_sleep(){
|
||||
|
||||
|
||||
log_dbg("hci_power_control_sleep");
|
||||
|
||||
|
||||
#if 0
|
||||
// don't close serial port during sleep
|
||||
|
||||
// close low-level device
|
||||
hci_stack.hci_transport->close(hci_stack.config);
|
||||
#endif
|
||||
|
||||
// sleep mode
|
||||
if (hci_stack.control && hci_stack.control->sleep){
|
||||
(*hci_stack.control->sleep)(hci_stack.config);
|
||||
}
|
||||
|
||||
hci_stack.state = HCI_STATE_SLEEPING;
|
||||
}
|
||||
|
||||
static int hci_power_control_wake(){
|
||||
|
||||
log_dbg("hci_power_control_wake");
|
||||
|
||||
// wake on
|
||||
if (hci_stack.control && hci_stack.control->wake){
|
||||
(*hci_stack.control->wake)(hci_stack.config);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// open low-level device
|
||||
int err = hci_stack.hci_transport->open(hci_stack.config);
|
||||
if (err){
|
||||
log_err( "HCI_INIT failed, turning Bluetooth off again\n");
|
||||
if (hci_stack.control && hci_stack.control->off){
|
||||
(*hci_stack.control->off)(hci_stack.config);
|
||||
}
|
||||
hci_emit_hci_open_failed();
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int hci_power_control(HCI_POWER_MODE power_mode){
|
||||
|
||||
log_dbg("hci_power_control: %u\n", power_mode);
|
||||
|
Loading…
Reference in New Issue
Block a user