only execute POWER_MODE commands when in the right HCI_STATE

This commit is contained in:
matthias.ringwald 2009-08-08 21:39:58 +00:00
parent f62db1e31a
commit f12adbd6cc

View File

@ -208,7 +208,7 @@ void hci_init(hci_transport_t *transport, void *config, bt_control_t *control){
}
int hci_power_control(HCI_POWER_MODE power_mode){
if (power_mode == HCI_POWER_ON) {
if (power_mode == HCI_POWER_ON && hci_stack.state == HCI_STATE_OFF) {
// set up state machine
hci_stack.num_cmd_packets = 1; // assume that one cmd can be sent
@ -223,7 +223,7 @@ int hci_power_control(HCI_POWER_MODE power_mode){
// create internal event
} else if (power_mode == HCI_POWER_OFF){
} else if (power_mode == HCI_POWER_OFF && hci_stack.state == HCI_STATE_WORKING){
// close low-level device
hci_stack.hci_transport->close(hci_stack.config);