fix crash

This commit is contained in:
Milanka Ringwald 2016-12-07 11:47:28 +01:00
parent 0e1608747d
commit 1d3b8c809d
2 changed files with 6 additions and 3 deletions

View File

@ -507,7 +507,7 @@ static int handle_l2cap_data_packet_for_connection(avdtp_connection_t * connecti
sep.seid = packet[i] >> 2;
if (sep.seid < 0x01 || sep.seid > 0x3E){
printf("invalid sep id\n");
return 0;
return 01;
}
sep.in_use = (packet[i] >> 1) & 0x01;
sep.media_type = (avdtp_media_type_t)(packet[i+1] >> 4);
@ -666,6 +666,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
if (connection){
log_info(" -> L2CAP_EVENT_CHANNEL_CLOSED signaling cid 0x%0x", local_cid);
stream_endpoint = get_avdtp_stream_endpoint_for_connection(connection);
if (!stream_endpoint) break;
stream_endpoint->connection = NULL;
connection->state = AVDTP_SIGNALING_CONNECTION_IDLE;
btstack_linked_list_remove(&avdtp_connections, (btstack_linked_item_t*) connection);

View File

@ -328,8 +328,10 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
}
static void show_usage(void){
printf("\n--- CLI for L2CAP TEST ---\n");
printf("c - create connection to SDP at addr %s\n", bd_addr_to_str(remote));
bd_addr_t iut_address;
gap_local_bd_addr(iut_address);
printf("\n--- Bluetooth AVDTP SINK Test Console %s ---\n", bd_addr_to_str(iut_address));
printf("c - create connection to addr %s\n", bd_addr_to_str(remote));
printf("d - disconnect\n");
printf("Ctrl-c - exit\n");
printf("---\n");