summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32/stm32_usbdev.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-10-31 19:14:00 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-10-31 19:14:00 +0000
commit411628c0323ea54bb7b36ebd521fd92f9a88dbd8 (patch)
tree7c5266a00de29cedee66d21bc4aae8c403e4610f /nuttx/arch/arm/src/stm32/stm32_usbdev.c
parent83c9faf31886039782c0e674ea14714e1b3a466b (diff)
downloadpx4-nuttx-411628c0323ea54bb7b36ebd521fd92f9a88dbd8.tar.gz
px4-nuttx-411628c0323ea54bb7b36ebd521fd92f9a88dbd8.tar.bz2
px4-nuttx-411628c0323ea54bb7b36ebd521fd92f9a88dbd8.zip
Fix direction logic in the submit method
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2204 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/stm32/stm32_usbdev.c')
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_usbdev.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_usbdev.c b/nuttx/arch/arm/src/stm32/stm32_usbdev.c
index 3cfd3de31..3cf50c766 100644
--- a/nuttx/arch/arm/src/stm32/stm32_usbdev.c
+++ b/nuttx/arch/arm/src/stm32/stm32_usbdev.c
@@ -1857,8 +1857,8 @@ static void stm32_ep0setup(struct stm32_usbdev_s *priv)
* 1. The setup request was successfully handled above and a response packet
* must be sent (may be a zero length packet).
* 2. The request was successfully handled by the class implementation. In
- * case, the response has already been sent and the local variable 'handled'
- * will be set to TRUE;
+ * case, the EP0 IN response has already been queued and the local variable
+ * 'handled' will be set to TRUE;
* 3. An error was detected in either the above logic or by the class implementation
* logic. In either case, priv->state will be set DEVSTATE_STALLED
* to indicate this case.
@@ -1872,9 +1872,13 @@ static void stm32_ep0setup(struct stm32_usbdev_s *priv)
}
else if ((priv->ctrl.type & USB_REQ_DIR_IN) != 0)
{
+ /* Check if the class driver already handled the IN response */
+
if (!handled)
{
- /* Restrict the data length to requested length */
+ /* NO.. Then we will respond. First, restrict the data length to
+ * the length requested in the setup packet
+ */
if (nbytes > len.w)
{
@@ -2800,9 +2804,12 @@ static int stm32_epsubmit(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
ret = -EBUSY;
}
- /* Handle IN (device-to-host) requests */
+ /* Handle IN (device-to-host) requests. NOTE: If the class device is
+ * using the bi-directional EP0, then we assume that they intend the EP0
+ * IN functionality.
+ */
- else if (USB_ISEPIN(ep->eplog))
+ else if (USB_ISEPIN(ep->eplog) || USB_EPNO(ep->eplog) == EP0)
{
/* Add the new request to the request queue for the IN endpoint */