usb: fix bug with multiple usb interfaces

for interface specific requests, the interface number is equivalent to
(wIndex & 0xff). this corresponds to ep0_buf_rx[2], since the setup
packet has format: bmRequestType (1), bRequest (1), wValue (2),
wIndex (2), wLength (2).

BUG=none
BRANCH=none
TEST=verify stm32 does not panic with multiple interfaces

Change-Id: Ied7750035f87fa81f9a6c03c6e73ae606c110398
Signed-off-by: Dominic Chen <ddchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/209903
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Dominic Chen
2014-07-25 10:18:26 -07:00
committed by chrome-internal-fetch
parent 47e74b8ca8
commit 3e993df474

View File

@@ -71,7 +71,7 @@ static void ep0_rx(void)
/* interface specific requests */
if ((req & USB_RECIP_MASK) == USB_RECIP_INTERFACE) {
uint8_t iface = ep0_buf_rx[1] & 0xff;
uint8_t iface = ep0_buf_rx[2] & 0xff;
if (iface < USB_IFACE_COUNT)
usb_iface_request[iface](ep0_buf_rx, ep0_buf_tx);
return;