usb: send correct device descriptor length, and null set address response

BRANCH=none
BUG=none
TEST=verify usb operation with mac 10.7.3

Change-Id: I137a20637273b9a8683470ae42337a8d38e1b038
Signed-off-by: Dominic Chen <ddchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/206931
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Dominic Chen
2014-07-07 16:22:09 -07:00
committed by chrome-internal-fetch
parent 786e208b50
commit 3b49eaee53

View File

@@ -87,7 +87,8 @@ static void ep0_rx(void)
case USB_DT_DEVICE: /* Setup : Get device descriptor */
memcpy_usbram(ep0_buf_tx, (void *)&dev_desc,
sizeof(dev_desc));
btable_ep[0].tx_count = sizeof(dev_desc);
btable_ep[0].tx_count = MIN(ep0_buf_rx[3],
sizeof(dev_desc));
STM32_TOGGLE_EP(0, EP_TX_RX_MASK, EP_TX_RX_VALID,
EP_STATUS_OUT /*null OUT transaction */);
break;
@@ -135,6 +136,7 @@ static void ep0_rx(void)
/* set the address after we got IN packet handshake */
set_addr = ep0_buf_rx[1] & 0xff;
/* need null IN transaction -> TX Valid */
btable_ep[0].tx_count = 0;
STM32_TOGGLE_EP(0, EP_TX_RX_MASK, EP_TX_RX_VALID, 0);
break;
case USB_REQ_SET_CONFIGURATION: