usbdev/adb: fixed usbclass steup issue
1. set usbdev when usb class bind 2. don't call EP_SUBMIT when receive OUT message Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
parent
d9acaeaccf
commit
5dc4e23bb7
@ -549,7 +549,8 @@ static void usb_adb_wrcomplete(FAR struct usbdev_ep_s *ep,
|
||||
|
||||
case -ESHUTDOWN: /* Disconnection */
|
||||
{
|
||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_WRSHUTDOWN), sq_count(&priv->txfree));
|
||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_WRSHUTDOWN),
|
||||
sq_count(&priv->txfree));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -957,6 +958,8 @@ static int usbclass_bind(FAR struct usbdevclass_driver_s *driver,
|
||||
|
||||
usbtrace(TRACE_CLASSBIND, 0);
|
||||
|
||||
priv->usbdev = dev;
|
||||
|
||||
priv->ctrlreq = usbclass_allocreq(dev->ep0, USBADB_MXDESCLEN);
|
||||
if (priv->ctrlreq == NULL)
|
||||
{
|
||||
@ -1123,6 +1126,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
|
||||
uint16_t value;
|
||||
uint16_t len;
|
||||
int ret = -EOPNOTSUPP;
|
||||
bool cfg_req = true;
|
||||
|
||||
FAR struct usbdev_adb_s *priv;
|
||||
FAR struct usbdev_req_s *ctrlreq;
|
||||
@ -1255,6 +1259,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
|
||||
if (ctrl->type == 0)
|
||||
{
|
||||
ret = usbclass_setconfig(priv, value);
|
||||
cfg_req = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1265,6 +1270,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case USB_REQ_TYPE_CLASS:
|
||||
{
|
||||
@ -1277,8 +1283,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
|
||||
|
||||
default:
|
||||
{
|
||||
usbtrace(
|
||||
TRACE_CLSERROR(USBSER_TRACEERR_UNSUPPORTEDTYPE),
|
||||
usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_UNSUPPORTEDTYPE),
|
||||
ctrl->type);
|
||||
}
|
||||
}
|
||||
@ -1288,7 +1293,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
|
||||
* value (ret < 0), the USB driver will stall.
|
||||
*/
|
||||
|
||||
if (ret >= 0)
|
||||
if (ret >= 0 && cfg_req)
|
||||
{
|
||||
ctrlreq->len = (len < ret) ? len : ret;
|
||||
ctrlreq->flags = USBDEV_REQFLAGS_NULLPKT;
|
||||
|
Loading…
Reference in New Issue
Block a user