USB host CDC/ACM fixes. Still kind of buggy
This commit is contained in:
parent
513344a084
commit
c35bb693a9
3 changed files with 33 additions and 9 deletions
|
|
@ -3220,15 +3220,15 @@ static int lpc17_cancel(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep)
|
|||
irqstate_t flags;
|
||||
int ret = OK;
|
||||
|
||||
DEBUGASSERT(ed != NULL);
|
||||
|
||||
/* These first steps must be atomic as possible */
|
||||
|
||||
flags = irqsave();
|
||||
flags = irqsave();
|
||||
|
||||
/* It might be possible for no transfer to be in progress */
|
||||
/* It is possible there there is no transfer to be in progress */
|
||||
|
||||
DEBUGASSERT(ed != NULL && ed->xfrinfo != NULL);
|
||||
xfrinfo = ed->xfrinfo;
|
||||
|
||||
if (xfrinfo)
|
||||
{
|
||||
/* It would be an usage error to use the interface to try to cancel a
|
||||
|
|
|
|||
|
|
@ -1467,7 +1467,7 @@ static int cdcacm_setup(FAR struct usbdevclass_driver_s *driver,
|
|||
{
|
||||
/* Save the new line coding in the private data structure. NOTE:
|
||||
* that this is conditional now because not all device controller
|
||||
* drivers supported provisioni of EP0 OUT data with the setup
|
||||
* drivers supported provision of EP0 OUT data with the setup
|
||||
* command.
|
||||
*/
|
||||
|
||||
|
|
@ -1476,6 +1476,8 @@ static int cdcacm_setup(FAR struct usbdevclass_driver_s *driver,
|
|||
memcpy(&priv->linecoding, dataout, SIZEOF_CDC_LINECODING);
|
||||
}
|
||||
|
||||
/* Respond with a zero length packet */
|
||||
|
||||
ret = 0;
|
||||
|
||||
/* If there is a registered callback to receive line status info, then
|
||||
|
|
@ -1504,7 +1506,7 @@ static int cdcacm_setup(FAR struct usbdevclass_driver_s *driver,
|
|||
index == CDCACM_NOTIFID)
|
||||
{
|
||||
/* Save the control line state in the private data structure. Only bits
|
||||
* 0 and 1 have meaning.
|
||||
* 0 and 1 have meaning. Respond with a zero length packet.
|
||||
*/
|
||||
|
||||
priv->ctrlline = value & 3;
|
||||
|
|
@ -1534,7 +1536,7 @@ static int cdcacm_setup(FAR struct usbdevclass_driver_s *driver,
|
|||
index == CDCACM_NOTIFID)
|
||||
{
|
||||
/* If there is a registered callback to handle the SendBreak request,
|
||||
* then callout now.
|
||||
* then callout now. Respond with a zero length packet.
|
||||
*/
|
||||
|
||||
ret = 0;
|
||||
|
|
@ -1589,6 +1591,8 @@ static int cdcacm_setup(FAR struct usbdevclass_driver_s *driver,
|
|||
}
|
||||
}
|
||||
|
||||
/* Returning a negative value will cause a STALL */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ static int usbhost_linecoding_send(FAR struct usbhost_cdcacm_s *priv)
|
|||
ctrlreq->req = ACM_SET_LINE_CODING;
|
||||
|
||||
usbhost_putle16(ctrlreq->value, 0);
|
||||
usbhost_putle16(ctrlreq->index, priv->dataif);
|
||||
usbhost_putle16(ctrlreq->index, priv->ctrlif);
|
||||
usbhost_putle16(ctrlreq->len, SIZEOF_CDC_LINECODING);
|
||||
|
||||
/* And send the request */
|
||||
|
|
@ -723,7 +723,7 @@ static void usbhost_notification_work(FAR void *arg)
|
|||
USB_REQ_RECIPIENT_INTERFACE)) &&
|
||||
(inmsg->notification == ACM_SERIAL_STATE) &&
|
||||
(value == 0) &&
|
||||
(index == priv->dataif) &&
|
||||
(index == priv->ctrlif) &&
|
||||
(len == 2))
|
||||
{
|
||||
uint16_t state = usbhost_getle16(inmsg->data);
|
||||
|
|
@ -2062,9 +2062,16 @@ errout:
|
|||
static int usbhost_disconnected(struct usbhost_class_s *usbclass)
|
||||
{
|
||||
FAR struct usbhost_cdcacm_s *priv = (FAR struct usbhost_cdcacm_s *)usbclass;
|
||||
#ifndef CONFIG_USBHOST_CDCACM_BULKONLY
|
||||
FAR struct usbhost_hubport_s *hport;
|
||||
#endif
|
||||
irqstate_t flags;
|
||||
|
||||
DEBUGASSERT(priv != NULL);
|
||||
#ifndef CONFIG_USBHOST_CDCACM_BULKONLY
|
||||
DEBUGASSERT(priv->usbclass.hport != NULL);
|
||||
hport = priv->usbclass.hport;
|
||||
#endif
|
||||
|
||||
/* Set an indication to any users of the CDC/ACM device that the device
|
||||
* is no longer available.
|
||||
|
|
@ -2073,6 +2080,19 @@ static int usbhost_disconnected(struct usbhost_class_s *usbclass)
|
|||
flags = irqsave();
|
||||
priv->disconnected = true;
|
||||
|
||||
#ifndef CONFIG_USBHOST_CDCACM_BULKONLY
|
||||
/* Cancel any pending asynchronous I/O */
|
||||
|
||||
if (priv->intin)
|
||||
{
|
||||
int ret = DRVR_CANCEL(hport->drvr, priv->intin);
|
||||
if (ret < 0)
|
||||
{
|
||||
udbg("WARNING: DRVR_CANCEL failed: %d\n", ret);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now check the number of references on the class instance. If it is one,
|
||||
* then we can free the class instance now. Otherwise, we will have to
|
||||
* wait until the holders of the references free them by closing the
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue