drivers/usbdev: support send ZLP(zero length packet) data packet in bulkin

status = write(g_usb_ep_in, (void*)0xFEE1DEAD, 0);

sched_backtrace
nuttx/arch/arm/src/../../../sched/sched/sched_backtrace.c:57
_assert
nuttx/arch/arm/src/../../../sched/misc/assert.c:659
__assert
nuttx/arch/arm/src/../../../libs/libc/assert/lib_assert.c:36
usbdev_fs_write
nuttx/arch/arm/src/../../../drivers/usbdev/usbdev_fs.c:770 (discriminator 1)
file_write
nuttx/arch/arm/src/../../../fs/vfs/fs_write.c:91
nx_write
nuttx/arch/arm/src/../../../fs/vfs/fs_write.c:148
ffs_transport_thread_usb_write
nuttx/arch/arm/src/../../../../external/mtp-responder/mtp-responder/src/mtp_usb_driver_nuttx.c:224
_transport_thread_usb_write
nuttx/arch/arm/src/../../../../external/mtp-responder/mtp-responder/src/mtp_usb_driver.c:80
pthread_startup
nuttx/arch/arm/src/../../../libs/libc/pthread/pthread_create.c:59 (discriminator 2)

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2024-02-22 22:34:47 +08:00 committed by Xiang Xiao
parent 2b571e1d11
commit d6bfa87c8d
1 changed files with 5 additions and 2 deletions

View File

@ -721,7 +721,7 @@ static ssize_t usbdev_fs_write(FAR struct file *filep,
/* Device ready for write */ /* Device ready for write */
while (len > 0 && !sq_empty(&fs_ep->reqq)) while (!sq_empty(&fs_ep->reqq))
{ {
uint16_t cur_len; uint16_t cur_len;
@ -764,9 +764,12 @@ static ssize_t usbdev_fs_write(FAR struct file *filep,
wlen += cur_len; wlen += cur_len;
len -= cur_len; len -= cur_len;
if (len == 0)
{
break;
}
} }
assert(wlen > 0);
ret = wlen; ret = wlen;
errout: errout: