diff options
| author | sakumisu <[email protected]> | 2026-05-19 21:03:42 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2026-05-19 21:03:42 +0800 |
| commit | 3e595a30db1c2de08c15d721ed4a1fa2a11c92dd (patch) | |
| tree | 0387d7479f3bfd5ae866f2b3c62a443e3143c534 | |
| parent | 9b95c1d61751640b0678be8971c06ca68ae42276 (diff) | |
fix(platform/rtthread): implement rx_complete_callback for rtt device->rx_indicate
Signed-off-by: sakumisu <[email protected]>
| -rw-r--r-- | platform/rtthread/rt_usbh_serial.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/platform/rtthread/rt_usbh_serial.c b/platform/rtthread/rt_usbh_serial.c index ab16f325..96f27eee 100644 --- a/platform/rtthread/rt_usbh_serial.c +++ b/platform/rtthread/rt_usbh_serial.c @@ -146,6 +146,18 @@ const static struct rt_device_ops usbh_serial_ops = { }; #endif +static void rt_usbh_serial_rx_complete_callback(struct usbh_serial *serial, int nbytes) +{ + struct rt_device *device; + RT_ASSERT(serial != RT_NULL && serial->user_data != RT_NULL); + + device = (struct rt_device *)serial->user_data; + + if (device->rx_indicate) { + device->rx_indicate(device, nbytes); + } +} + rt_err_t usbh_serial_register(struct usbh_serial *serial) { rt_err_t ret; @@ -175,6 +187,7 @@ rt_err_t usbh_serial_register(struct usbh_serial *serial) #endif device->user_data = serial; serial->user_data = device; + serial->rx_complete_callback = rt_usbh_serial_rx_complete_callback; /* skip /dev/ to avoid BAD file */ const char *dev_name = serial->hport->config.intf[serial->intf].devname; |
