From 8097785b8a1d668944747bc02431451664669986 Mon Sep 17 00:00:00 2001
From: Giovanni Di Sirio <gdisirio@gmail.com>
Date: Sun, 15 Apr 2018 08:57:50 +0000
Subject: Fixed bug #938 and #939.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11940 110e8d01-0319-4d1e-a829-52ad28d1bb01
---
 os/hal/src/hal_usb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'os/hal/src')

diff --git a/os/hal/src/hal_usb.c b/os/hal/src/hal_usb.c
index d264a2ac3..eedc541c2 100644
--- a/os/hal/src/hal_usb.c
+++ b/os/hal/src/hal_usb.c
@@ -142,9 +142,12 @@ static bool default_handler(USBDriver *usbp) {
     usbSetupTransfer(usbp, &usbp->configuration, 1, NULL);
     return true;
   case (uint32_t)USB_RTYPE_RECIPIENT_DEVICE | ((uint32_t)USB_REQ_SET_CONFIGURATION << 8):
+#if defined(USB_SET_CONFIGURATION_OLD_BEHAVIOR)
     /* Handling configuration selection from the host only if it is different
        from the current configuration.*/
-    if (usbp->configuration != usbp->setup[2]) {
+    if (usbp->configuration != usbp->setup[2])
+#endif
+    {
       /* If the USB device is already active then we have to perform the clear
          procedure on the current configuration.*/
       if (usbp->state == USB_ACTIVE) {
-- 
cgit v1.2.3