diff --git a/drivers/dose/dose.c b/drivers/dose/dose.c index 177c96f7cae1..2ef51a9c08f4 100644 --- a/drivers/dose/dose.c +++ b/drivers/dose/dose.c @@ -532,9 +532,9 @@ static inline void _send_done(dose_t *ctx, bool collision) static int _confirm_send(netdev_t *dev, void *info) { - (void)dev; (void)info; - return -EOPNOTSUPP; + dose_t *ctx = container_of(dev, dose_t, netdev); + return ctx->tx_result; } static int _send(netdev_t *dev, const iolist_t *iolist) @@ -543,6 +543,7 @@ static int _send(netdev_t *dev, const iolist_t *iolist) int8_t retries = 3; size_t pktlen; uint16_t crc; + ctx->tx_result = -EAGAIN; /* discard data when interface is in SLEEP mode */ if (ctx->state == DOSE_STATE_SLEEP) { @@ -603,7 +604,10 @@ static int _send(netdev_t *dev, const iolist_t *iolist) /* Get out of the SEND state */ state(ctx, DOSE_SIGNAL_END); - return pktlen; + ctx->tx_result = (int)pktlen; + dev->event_callback(dev, NETDEV_EVENT_TX_COMPLETE); + + return 0; collision: _send_done(ctx, true); diff --git a/drivers/include/dose.h b/drivers/include/dose.h index 5acdbf776907..1c31b7279bfa 100644 --- a/drivers/include/dose.h +++ b/drivers/include/dose.h @@ -204,6 +204,7 @@ typedef struct { ztimer_t timeout; /**< Timeout timer ensuring always to get back to IDLE state */ uint32_t timeout_base; /**< Base timeout in us */ uart_t uart; /**< UART device to use */ + int tx_result; /**< return code for confirm_send() */ uint8_t uart_octet; /**< Last received octet */ uint8_t flags; /**< Several flags */ } dose_t;