hci.c (5061f3af3483449939afc1846694ba83b7095409) hci.c (c9af4d3f19c8eb0849d0dbf67148b9c0bf6a3082)
1/*
2 * Copyright (C) 2009-2012 by Matthias Ringwald
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 727 unchanged lines hidden (view full) ---

736#endif
737
738 default:
739 break;
740 }
741
742 // handle BT initialization
743 if (hci_stack.state == HCI_STATE_INITIALIZING){
1/*
2 * Copyright (C) 2009-2012 by Matthias Ringwald
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 727 unchanged lines hidden (view full) ---

736#endif
737
738 default:
739 break;
740 }
741
742 // handle BT initialization
743 if (hci_stack.state == HCI_STATE_INITIALIZING){
744 // handle H4 synchronization loss on restart
745 // if (hci_stack.substate == 1 && packet[0] == HCI_EVENT_HARDWARE_ERROR){
746 // hci_stack.substate = 0;
747 // }
748 // handle normal init sequence
749 if (hci_stack.substate % 2){
750 // odd: waiting for event
751 if (packet[0] == HCI_EVENT_COMMAND_COMPLETE || packet[0] == HCI_EVENT_COMMAND_STATUS){
744 if (hci_stack.substate % 2){
745 // odd: waiting for event
746 if (packet[0] == HCI_EVENT_COMMAND_COMPLETE || packet[0] == HCI_EVENT_COMMAND_STATUS){
752 hci_stack.substate++;
747 // wait for explicit COMMAND COMPLETE on RESET
748 if (hci_stack.substate > 1 || COMMAND_COMPLETE_EVENT(packet, hci_reset)) {
749 hci_stack.substate++;
750 }
753 }
754 }
755 }
756
757 // help with BT sleep
758 if (hci_stack.state == HCI_STATE_FALLING_ASLEEP
759 && hci_stack.substate == 1
760 && COMMAND_COMPLETE_EVENT(packet, hci_write_scan_enable)){

--- 845 unchanged lines hidden ---
751 }
752 }
753 }
754
755 // help with BT sleep
756 if (hci_stack.state == HCI_STATE_FALLING_ASLEEP
757 && hci_stack.substate == 1
758 && COMMAND_COMPLETE_EVENT(packet, hci_write_scan_enable)){

--- 845 unchanged lines hidden ---