diff --git a/drivers/usb/device/Kconfig b/drivers/usb/device/Kconfig index 3cf7278e23f..1143c194fd1 100644 --- a/drivers/usb/device/Kconfig +++ b/drivers/usb/device/Kconfig @@ -61,6 +61,7 @@ menuconfig USB_NRF52840 depends on SOC_NRF52840 select USB_DEVICE_DRIVER select NRFX_USBD + select USB_DEVICE_DISABLE_ZLP_EPIN_HANDLING help nRF52840 USB Device Controller Driver diff --git a/subsys/usb/Kconfig b/subsys/usb/Kconfig index eab969f7b4f..c29d91b232e 100644 --- a/subsys/usb/Kconfig +++ b/subsys/usb/Kconfig @@ -79,6 +79,12 @@ config USB_DEVICE_REMOTE_WAKEUP help This option requires USBD peripheral driver to also support remote wakeup. +config USB_DEVICE_DISABLE_ZLP_EPIN_HANDLING + bool + help + Stack should not handle ZLP for Variable-length Data Stage + bacause it is taken over by the hardware. + config USB_DEVICE_BOS bool "Enable USB Binary Device Object Store (BOS)" diff --git a/subsys/usb/usb_device.c b/subsys/usb/usb_device.c index 50e11670f1d..96727c5af3e 100644 --- a/subsys/usb/usb_device.c +++ b/subsys/usb/usb_device.c @@ -245,6 +245,7 @@ static void usb_data_to_host(u16_t len) usb_dev.data_buf += chunk; usb_dev.data_buf_residue -= chunk; +#ifndef CONFIG_USB_DEVICE_DISABLE_ZLP_EPIN_HANDLING /* * Set ZLP flag when host asks for a bigger length and the * last chunk is wMaxPacketSize long, to indicate the last @@ -259,6 +260,7 @@ static void usb_data_to_host(u16_t len) usb_dev.zlp_flag = true; } } +#endif } else { usb_dev.zlp_flag = false;