diff --git a/apps/data_logger/VERSION b/apps/data_logger/VERSION index 0e5c5b92d..17c8bdc99 100644 --- a/apps/data_logger/VERSION +++ b/apps/data_logger/VERSION @@ -1,5 +1,5 @@ VERSION_MAJOR = 0 VERSION_MINOR = 3 -PATCHLEVEL = 0 +PATCHLEVEL = 1 VERSION_TWEAK = 0 EXTRAVERSION = dev diff --git a/subsys/epacket/interfaces/epacket_bt_adv.c b/subsys/epacket/interfaces/epacket_bt_adv.c index c7c6db7ef..cb4afa0e7 100644 --- a/subsys/epacket/interfaces/epacket_bt_adv.c +++ b/subsys/epacket/interfaces/epacket_bt_adv.c @@ -132,8 +132,7 @@ static void bt_adv_broadcast(const struct device *dev, struct net_buf *pkt) static void adv_set_complete_worker(struct k_work *work) { - uint8_t set_idx = bt_le_ext_adv_get_index(adv_set); - struct net_buf *curr, *next; + struct net_buf *next; if (k_sem_take(&queue_lock, K_NO_WAIT) != 0) { /* If we can't immediately access the queue, reschedule so we aren't blocking the @@ -144,26 +143,31 @@ static void adv_set_complete_worker(struct k_work *work) return; } - curr = adv_set_bufs[set_idx]; - adv_set_bufs[set_idx] = NULL; - next = net_buf_get(&tx_buf_queue, K_NO_WAIT); if (next) { LOG_DBG("Chaining next buf: %p", next); bt_adv_broadcast(DEVICE_DT_INST_GET(0), next); } else { - LOG_DBG("Adv chain complete: %d", set_idx); + LOG_DBG("Adv chain complete"); adv_set_active = false; } k_sem_give(&queue_lock); +} + +static void adv_set_complete(struct bt_le_ext_adv *adv, struct bt_le_ext_adv_sent_info *info) +{ + uint8_t set_idx = bt_le_ext_adv_get_index(adv); + struct net_buf *curr; + + /* Release the finished buffer immediately */ + curr = adv_set_bufs[set_idx]; + adv_set_bufs[set_idx] = NULL; /* Notify TX result */ epacket_notify_tx_result(DEVICE_DT_INST_GET(0), curr, 0); net_buf_unref(curr); -} -static void adv_set_complete(struct bt_le_ext_adv *adv, struct bt_le_ext_adv_sent_info *info) -{ + /* Handle chaining advertising sets in other thread context */ k_work_submit_to_queue(TASK_WORKQ, &adv_set_complete_work); } diff --git a/subsys/epacket/interfaces/epacket_udp.c b/subsys/epacket/interfaces/epacket_udp.c index 294f7327e..18f23e64b 100644 --- a/subsys/epacket/interfaces/epacket_udp.c +++ b/subsys/epacket/interfaces/epacket_udp.c @@ -133,7 +133,7 @@ static int epacket_udp_loop(void *a, void *b, void *c) /* Create the UDP socket */ udp_state.sock = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (udp_state.sock == -1) { + if (udp_state.sock < 0) { LOG_ERR("Failed to open socket (%d)", errno); goto socket_error; } diff --git a/subsys/net/dns/infuse_dns.c b/subsys/net/dns/infuse_dns.c index fc5ce9f8f..8dadf8bb1 100644 --- a/subsys/net/dns/infuse_dns.c +++ b/subsys/net/dns/infuse_dns.c @@ -35,7 +35,7 @@ int infuse_sync_dns(const char *host, uint16_t port, int family, int socktype, /* Perform DNS query */ rc = zsock_getaddrinfo(host, NULL, &hints, &res); if (rc < 0) { - LOG_WRN("%s -> Lookup failed", host); + LOG_WRN("%s -> Lookup failed (%d)", host, errno); #ifdef CONFIG_DNS_RESOLVER k_sem_give(&dns_ctx); #endif /* CONFIG_DNS_RESOLVER */