diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-05-28 13:36:01 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-05-28 13:36:01 -0600 |
commit | 1a74256ee53b36e73f0d2afa4d9e8b7199be2a10 (patch) | |
tree | d2aefd57856c849d84f214bdc9c139cb4f9b484f /nuttx/drivers/usbdev | |
parent | 0e779830120932500dee6b192b553562b6958a9b (diff) | |
download | px4-nuttx-1a74256ee53b36e73f0d2afa4d9e8b7199be2a10.tar.gz px4-nuttx-1a74256ee53b36e73f0d2afa4d9e8b7199be2a10.tar.bz2 px4-nuttx-1a74256ee53b36e73f0d2afa4d9e8b7199be2a10.zip |
Fix null packet handling in the PIC32 USB device driver. This is a critical bug fix for PIC32. Add support for the USB monitor to the Sure-PIC32MX configuration
Diffstat (limited to 'nuttx/drivers/usbdev')
-rw-r--r-- | nuttx/drivers/usbdev/cdcacm.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/nuttx/drivers/usbdev/cdcacm.c b/nuttx/drivers/usbdev/cdcacm.c index cb8679976..cf0ebad82 100644 --- a/nuttx/drivers/usbdev/cdcacm.c +++ b/nuttx/drivers/usbdev/cdcacm.c @@ -369,7 +369,7 @@ static int cdcacm_sndpacket(FAR struct cdcacm_dev_s *priv) { /* Peek at the request in the container at the head of the list */ - reqcontainer = (struct cdcacm_req_s *)sq_peek(&priv->reqlist); + reqcontainer = (FAR struct cdcacm_req_s *)sq_peek(&priv->reqlist); req = reqcontainer->req; /* Fill the request with serial TX data */ @@ -901,16 +901,22 @@ static void cdcacm_wrcomplete(FAR struct usbdev_ep_s *ep, switch (req->result) { case OK: /* Normal completion */ - usbtrace(TRACE_CLASSWRCOMPLETE, priv->nwrq); - cdcacm_sndpacket(priv); + { + usbtrace(TRACE_CLASSWRCOMPLETE, priv->nwrq); + cdcacm_sndpacket(priv); + } break; case -ESHUTDOWN: /* Disconnection */ - usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_WRSHUTDOWN), priv->nwrq); + { + usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_WRSHUTDOWN), priv->nwrq); + } break; default: /* Some other error occurred */ - usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_WRUNEXPECTED), (uint16_t)-req->result); + { + usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_WRUNEXPECTED), (uint16_t)-req->result); + } break; } } @@ -1023,6 +1029,7 @@ static int cdcacm_bind(FAR struct usbdevclass_driver_s *driver, ret = -ENOMEM; goto errout; } + reqcontainer->req->priv = reqcontainer; reqcontainer->req->callback = cdcacm_rdcomplete; } @@ -1045,6 +1052,7 @@ static int cdcacm_bind(FAR struct usbdevclass_driver_s *driver, ret = -ENOMEM; goto errout; } + reqcontainer->req->priv = reqcontainer; reqcontainer->req->callback = cdcacm_wrcomplete; |