mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 17:33:08 +08:00
drivers/usbdev_fs: report POLLHUP when disconnect
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
@@ -786,14 +786,6 @@ static int usbdev_fs_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Check if the usbdev device has been unbind */
|
||||
|
||||
if (fs_ep->unlinked)
|
||||
{
|
||||
nxmutex_unlock(&fs_ep->lock);
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
if (!setup)
|
||||
{
|
||||
/* This is a request to tear down the poll. */
|
||||
@@ -838,9 +830,16 @@ static int usbdev_fs_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
||||
|
||||
eventset = 0;
|
||||
|
||||
/* Check if the usbdev device has been unbind */
|
||||
|
||||
if (fs_ep->unlinked)
|
||||
{
|
||||
eventset |= POLLHUP;
|
||||
}
|
||||
|
||||
/* Notify the POLLIN/POLLOUT event if at least one request is available */
|
||||
|
||||
if (!sq_empty(&fs_ep->reqq))
|
||||
else if (!sq_empty(&fs_ep->reqq))
|
||||
{
|
||||
if (USB_ISEPIN(fs_ep->ep->eplog))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user