Merge pull request #10472 from c1728p9/ep0_fix

Fix USB control transfers using small size
pull/10516/head
Martin Kojtal 2019-04-30 14:43:14 +01:00 committed by GitHub
commit 3b71f12f2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -48,6 +48,7 @@
#define ENDPOINT_ENABLED (1 << 0)
#define ENDPOINT_STALLED (1 << 1)
/* The maximum wMaxPacketSize for endpoint 0 */
#if defined(MAX_PACKET_SIZE_EP0)
#undef MAX_PACKET_SIZE_EP0
#endif
@ -663,7 +664,7 @@ void USBDevice::_control_setup()
/* Control transfer setup stage */
uint8_t buffer[MAX_PACKET_SIZE_EP0];
_phy->ep0_setup_read_result(buffer, MAX_PACKET_SIZE_EP0);
_phy->ep0_setup_read_result(buffer, _max_packet_size_ep0);
/* Initialise control transfer state */
_decode_setup_packet(buffer, &_transfer.setup);
@ -805,7 +806,7 @@ void USBDevice::_control_setup_continue()
/* the end of this transfer */
if (_transfer.setup.wLength > _transfer.remaining) {
/* Device wishes to transfer less than host requested */
if ((_transfer.remaining % MAX_PACKET_SIZE_EP0) == 0) {
if ((_transfer.remaining % _max_packet_size_ep0) == 0) {
/* Transfer is a multiple of EP0 max packet size */
_transfer.zlp = true;
}