aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorgdisirio <gdisirio@110e8d01-0319-4d1e-a829-52ad28d1bb01>2018-03-25 15:10:41 +0000
committergdisirio <gdisirio@110e8d01-0319-4d1e-a829-52ad28d1bb01>2018-03-25 15:10:41 +0000
commit354096a9730611e2af046273e5758c6504cac79e (patch)
treee52861a2f7dfc478cab47bb5fede8a8f1ba345eb /os/hal
parenteca81753c8acb5b99425c7ae8930d0f39d58a7a6 (diff)
downloadChibiOS-354096a9730611e2af046273e5758c6504cac79e.tar.gz
ChibiOS-354096a9730611e2af046273e5758c6504cac79e.tar.bz2
ChibiOS-354096a9730611e2af046273e5758c6504cac79e.zip
Fixed bug #930.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11855 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h1
-rw-r--r--os/hal/src/hal_serial_usb.c17
2 files changed, 11 insertions, 7 deletions
diff --git a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h
index 56ef3792c..7c2019685 100644
--- a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h
+++ b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h
@@ -616,7 +616,6 @@ extern "C" {
void usb_lld_stall_in(USBDriver *usbp, usbep_t ep);
void usb_lld_clear_out(USBDriver *usbp, usbep_t ep);
void usb_lld_clear_in(USBDriver *usbp, usbep_t ep);
- void usb_lld_pump(void *p);
#ifdef __cplusplus
}
#endif
diff --git a/os/hal/src/hal_serial_usb.c b/os/hal/src/hal_serial_usb.c
index ec1f1c4fe..246360ebc 100644
--- a/os/hal/src/hal_serial_usb.c
+++ b/os/hal/src/hal_serial_usb.c
@@ -484,20 +484,25 @@ void sduDataTransmitted(USBDriver *usbp, usbep_t ep) {
* @param[in] ep OUT endpoint number
*/
void sduDataReceived(USBDriver *usbp, usbep_t ep) {
+ size_t size;
SerialUSBDriver *sdup = usbp->out_params[ep - 1U];
+
if (sdup == NULL) {
return;
}
osalSysLockFromISR();
- /* Signaling that data is available in the input queue.*/
- chnAddFlagsI(sdup, CHN_INPUT_AVAILABLE);
+ /* Checking for zero-size transactions.*/
+ size = usbGetReceiveTransactionSizeX(sdup->config->usbp,
+ sdup->config->bulk_out);
+ if (size > (size_t)0) {
+ /* Signaling that data is available in the input queue.*/
+ chnAddFlagsI(sdup, CHN_INPUT_AVAILABLE);
- /* Posting the filled buffer in the queue.*/
- ibqPostFullBufferI(&sdup->ibqueue,
- usbGetReceiveTransactionSizeX(sdup->config->usbp,
- sdup->config->bulk_out));
+ /* Posting the filled buffer in the queue.*/
+ ibqPostFullBufferI(&sdup->ibqueue, size);
+ }
/* The endpoint cannot be busy, we are in the context of the callback,
so a packet is in the buffer for sure. Trying to get a free buffer