diff --git a/src/l2cap.c b/src/l2cap.c index 5bf7f4c3e..6a73d0d2c 100644 --- a/src/l2cap.c +++ b/src/l2cap.c @@ -1723,7 +1723,7 @@ uint8_t l2cap_le_create_channel(btstack_packet_handler_t packet_handler, bd_addr // start connection uint8_t res = gap_auto_connection_start(address_type, address); - if (!res){ + if (res){ // discard channel object btstack_linked_list_remove(&l2cap_channels, (btstack_linked_item_t *) channel); btstack_memory_l2cap_channel_free(channel); diff --git a/test/pts/le_data_channel.c b/test/pts/le_data_channel.c index f05607216..475599036 100644 --- a/test/pts/le_data_channel.c +++ b/test/pts/le_data_channel.c @@ -184,6 +184,7 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac switch (buffer){ case 'a': printf("Creating connection to %s\n", bd_addr_to_str(pts_address)); + gap_advertisements_enable(0); l2cap_le_create_channel(&app_packet_handler,pts_address, pts_address_type, psm_x, buffer_x, sizeof(buffer_x), 1, LEVEL_0, &cid_x); break; @@ -219,9 +220,10 @@ int btstack_main(int argc, const char * argv[]){ btstack_stdin_setup(stdin_process); - gap_random_address_set_update_period(5000); - gap_random_address_set_mode(GAP_RANDOM_ADDRESS_RESOLVABLE); + // gap_random_address_set_update_period(5000); + // gap_random_address_set_mode(GAP_RANDOM_ADDRESS_RESOLVABLE); gap_advertisements_set_data(sizeof(adv_general_discoverable), adv_general_discoverable); + gap_advertisements_enable(1); sm_set_io_capabilities(IO_CAPABILITY_NO_INPUT_NO_OUTPUT); sm_set_authentication_requirements(0);