usb: Fix for ZLP.

This commit is contained in:
NIIBE Yutaka
2018-08-20 12:43:35 +09:00
parent 802dbbd639
commit 1cbe0abdee
4 changed files with 16 additions and 10 deletions

View File

@@ -1,3 +1,9 @@
2018-08-20 NIIBE Yutaka <gniibe@fsij.org>
* mcu/usb-stm32f103.c (usb_lld_ctrl_send): Fix for ZLP.
* mcu/usb-usbip.c (usb_lld_ctrl_send): Likewise.
* mcu/usb-mkl27z.c (usb_lld_ctrl_send): Likewise.
2018-05-09 NIIBE Yutaka <gniibe@fsij.org> 2018-05-09 NIIBE Yutaka <gniibe@fsij.org>
* VERSION: 1.9. * VERSION: 1.9.

View File

@@ -950,11 +950,11 @@ usb_lld_ctrl_send (struct usb_dev *dev, const void *buf, size_t buflen)
data_p->len = buflen; data_p->len = buflen;
/* Restrict the data length to be the one host asks for */ /* Restrict the data length to be the one host asks for */
if (data_p->len > len_asked) if (data_p->len >= len_asked)
data_p->len = len_asked; data_p->len = len_asked;
/* ZLP is only required when host doesn't expect the end of packets. */
data_p->require_zlp = (data_p->len != 0 else if (data_p->len != 0 && (data_p->len % USB_MAX_PACKET_SIZE) == 0)
&& (data_p->len % USB_MAX_PACKET_SIZE) == 0); data_p->require_zlp = 1;
if (data_p->len < USB_MAX_PACKET_SIZE) if (data_p->len < USB_MAX_PACKET_SIZE)
{ {

View File

@@ -1105,10 +1105,10 @@ usb_lld_ctrl_send (struct usb_dev *dev, const void *buf, size_t buflen)
data_p->len = buflen; data_p->len = buflen;
/* Restrict the data length to be the one host asks for */ /* Restrict the data length to be the one host asks for */
if (data_p->len > len_asked) if (data_p->len >= len_asked)
data_p->len = len_asked; data_p->len = len_asked;
/* ZLP is only required when host doesn't expect the end of packets. */
if (data_p->len != 0 && (data_p->len % USB_MAX_PACKET_SIZE) == 0) else if (data_p->len != 0 && (data_p->len % USB_MAX_PACKET_SIZE) == 0)
data_p->require_zlp = 1; data_p->require_zlp = 1;
if (data_p->len < USB_MAX_PACKET_SIZE) if (data_p->len < USB_MAX_PACKET_SIZE)

View File

@@ -2169,10 +2169,10 @@ usb_lld_ctrl_send (struct usb_dev *dev, const void *buf, size_t buflen)
data_p->len = buflen; data_p->len = buflen;
/* Restrict the data length to be the one host asks for */ /* Restrict the data length to be the one host asks for */
if (data_p->len > len_asked) if (data_p->len >= len_asked)
data_p->len = len_asked; data_p->len = len_asked;
/* ZLP is only required when host doesn't expect the end of packets. */
if (data_p->len != 0 && (data_p->len % USB_MAX_PACKET_SIZE) == 0) else if (data_p->len != 0 && (data_p->len % USB_MAX_PACKET_SIZE) == 0)
data_p->require_zlp = 1; data_p->require_zlp = 1;
if (data_p->len < USB_MAX_PACKET_SIZE) if (data_p->len < USB_MAX_PACKET_SIZE)