usb: Fix for ZLP.
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user