1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:52:44 +01:00

drivers/slipdev: generate RX event for queued packets

This commit is contained in:
Benjamin Valentin 2022-06-13 14:53:57 +02:00
parent 324b26d67d
commit 86f55c5637
2 changed files with 8 additions and 0 deletions

View File

@ -98,6 +98,8 @@ typedef struct {
* @see [Device state definitions](@ref drivers_slipdev_states)
*/
uint8_t state;
uint8_t rx_queued; /**< pkt queued in inbuf */
uint8_t rx_done; /**< pkt processed */
} slipdev_t;
/**

View File

@ -67,6 +67,7 @@ static void _slip_rx_cb(void *arg, uint8_t byte)
check_end:
if (byte == SLIPDEV_END) {
if (dev->state == SLIPDEV_STATE_NET) {
dev->rx_queued++;
netdev_trigger_event_isr(&dev->netdev);
}
dev->state = SLIPDEV_STATE_NONE;
@ -207,6 +208,11 @@ static int _recv(netdev_t *netdev, void *buf, size_t len, void *info)
return -ENOBUFS;
}
} while (byte != SLIPDEV_END);
if (++dev->rx_done != dev->rx_queued) {
DEBUG("slipdev: pkt still in queue");
netdev_trigger_event_isr(&dev->netdev);
}
}
return res;
}