diff --git a/example/embedded/panu_demo.c b/example/embedded/panu_demo.c index f3e9e1898..b10658da9 100644 --- a/example/embedded/panu_demo.c +++ b/example/embedded/panu_demo.c @@ -375,6 +375,7 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha int rc; uint8_t event; bd_addr_t event_addr; + bd_addr_t local_addr; uint16_t uuid_source; uint16_t uuid_dest; uint16_t mtu; @@ -422,7 +423,8 @@ static void packet_handler (void * connection, uint8_t packet_type, uint16_t cha memcpy(&event_addr, &packet[8], sizeof(bd_addr_t)); printf("BNEP connection from %s source UUID 0x%04x dest UUID: 0x%04x, max frame size: %u\n", bd_addr_to_str(event_addr), uuid_source, uuid_dest, mtu); /* Create the tap interface */ - tap_fd = tap_alloc(tap_dev_name, *hci_local_bd_addr()); + hci_local_bd_addr(local_addr); + tap_fd = tap_alloc(tap_dev_name, local_addr); if (tap_fd < 0) { printf("Creating BNEP tap device failed: %s\n", strerror(errno)); } else { diff --git a/src/hci.c b/src/hci.c index 3bfbc4960..e51d427ae 100644 --- a/src/hci.c +++ b/src/hci.c @@ -496,7 +496,10 @@ static int hci_send_acl_packet_fragments(hci_connection_t *connection){ // release buffer now for synchronous transport if (hci_transport_synchronous()){ - hci_release_packet_buffer(); + hci_release_packet_buffer(); + // notify upper stack that iit might be possible to send again + uint8_t event[] = { DAEMON_EVENT_HCI_PACKET_SENT, 0}; + hci_stack->packet_handler(HCI_EVENT_PACKET, &event[0], sizeof(event)); } return err; @@ -1883,8 +1886,8 @@ void hci_connectable_control(uint8_t enable){ hci_update_scan_enable(); } -uint8_t * hci_local_bd_addr(void){ - return hci_stack->local_bd_addr; +void hci_local_bd_addr(bd_addr_t address_buffer){ + memcpy(address_buffer, hci_stack->local_bd_addr, 6); } void hci_run(){ diff --git a/src/hci.h b/src/hci.h index d4e1ed7fa..56c0ff96a 100644 --- a/src/hci.h +++ b/src/hci.h @@ -667,8 +667,8 @@ int hci_is_packet_buffer_reserved(void); // get point to packet buffer uint8_t* hci_get_outgoing_packet_buffer(void); -// returns pointer to a bd_addr_t array -uint8_t * hci_local_bd_addr(void); +// gets local address +void hci_local_bd_addr(bd_addr_t address_buffer); hci_connection_t * hci_connection_for_handle(hci_con_handle_t con_handle); hci_connection_t * hci_connection_for_bd_addr_and_type(bd_addr_t addr, bd_addr_type_t addr_type);