send write sco flow control enable if #HAVE_SCO_OVER_HCI

This commit is contained in:
Matthias Ringwald 2016-01-14 14:19:37 +01:00
parent 5f1e82e4ed
commit 729ed62ea0
3 changed files with 28 additions and 5 deletions

View File

@ -39,6 +39,8 @@
//
// Minimal test for HSP Headset (!! UNDER DEVELOPMENT !!)
//
// Requires HAVE_SCO and HAVE_SCO_OVER_HCI to be defined
//
// Tested working setups:
// - Ubuntu 14 64-bit, CC2564B connected via FTDI USB-2-UART adapter, 921600 baud
//
@ -149,8 +151,7 @@ static void packet_handler(uint8_t * event, uint16_t event_size){
switch (event[0]) {
case BTSTACK_EVENT_STATE:
if (event[2] != HCI_STATE_WORKING) break;
// request num completed events for SCO packets
hci_send_cmd(&hci_write_synchronous_flow_control_enable, 1);
printf("Working!\n");
break;
case HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS:
// printf("HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS\n");

View File

@ -1000,6 +1000,10 @@ static void hci_initializing_run(void){
hci_send_cmd(&hci_write_scan_enable, (hci_stack->connectable << 1) | hci_stack->discoverable); // page scan
hci_stack->substate = HCI_INIT_W4_WRITE_SCAN_ENABLE;
break;
case HCI_INIT_WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE:
hci_stack->substate = HCI_INIT_W4_WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE;
hci_send_cmd(&hci_write_synchronous_flow_control_enable, 1); // SCO tracking enabled
break;
#ifdef HAVE_BLE
// LE INIT
case HCI_INIT_LE_READ_BUFFER_SIZE:
@ -1188,17 +1192,34 @@ static void hci_initializing_event_handler(uint8_t * packet, uint16_t size){
return;
}
break;
case HCI_INIT_W4_WRITE_PAGE_TIMEOUT:
break;
case HCI_INIT_W4_LE_READ_BUFFER_SIZE:
// skip write le host if not supported (e.g. on LE only EM9301)
if (hci_stack->local_supported_commands[0] & 0x02) break;
hci_stack->substate = HCI_INIT_LE_SET_SCAN_PARAMETERS;
return;
#ifdef HAVE_SCO_OVER_HCI
case HCI_INIT_W4_WRITE_SCAN_ENABLE:
// just go to next state
break;
case HCI_INIT_W4_WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE:
if (!hci_le_supported()){
// SKIP LE init for Classic only configuration
hci_stack->substate = HCI_INIT_DONE;
return;
}
break;
#else
case HCI_INIT_W4_WRITE_SCAN_ENABLE:
if (!hci_le_supported()){
// SKIP LE init for Classic only configuration
hci_stack->substate = HCI_INIT_DONE;
return;
}
#endif
break;
default:
break;
}

View File

@ -591,15 +591,16 @@ typedef enum hci_init_state{
HCI_INIT_W4_WRITE_SIMPLE_PAIRING_MODE,
HCI_INIT_WRITE_PAGE_TIMEOUT,
HCI_INIT_W4_WRITE_PAGE_TIMEOUT,
// HCI_INIT_WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE,
// HCI_INIT_W4_SYNCHRONOUS_FLOW_CONTROL_ENABLE,
HCI_INIT_WRITE_CLASS_OF_DEVICE,
HCI_INIT_W4_WRITE_CLASS_OF_DEVICE,
HCI_INIT_WRITE_LOCAL_NAME,
HCI_INIT_W4_WRITE_LOCAL_NAME,
HCI_INIT_WRITE_SCAN_ENABLE,
HCI_INIT_W4_WRITE_SCAN_ENABLE,
HCI_INIT_WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE,
HCI_INIT_W4_WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE,
HCI_INIT_LE_READ_BUFFER_SIZE,
HCI_INIT_W4_LE_READ_BUFFER_SIZE,
HCI_INIT_WRITE_LE_HOST_SUPPORTED,