diff --git a/make/mcu/STM32F7.mk b/make/mcu/STM32F7.mk
index 437bf67fb4..cd1f2da5fb 100644
--- a/make/mcu/STM32F7.mk
+++ b/make/mcu/STM32F7.mk
@@ -83,21 +83,17 @@ USBCDC_SRC := $(filter-out ${EXCLUDES}, $(USBCDC_SRC))
USBHID_DIR = $(ROOT)/lib/main/STM32F7/Middlewares/ST/STM32_USB_Device_Library/Class/HID
USBHID_SRC = $(notdir $(wildcard $(USBHID_DIR)/Src/*.c))
-USBHIDCDC_DIR = $(ROOT)/lib/main/STM32F7/Middlewares/ST/STM32_USB_Device_Library/Class/CDC_HID
-USBHIDCDC_SRC = $(notdir $(wildcard $(USBHIDCDC_DIR)/Src/*.c))
-
USBMSC_DIR = $(ROOT)/lib/main/STM32F7/Middlewares/ST/STM32_USB_Device_Library/Class/MSC
USBMSC_SRC = $(notdir $(wildcard $(USBMSC_DIR)/Src/*.c))
EXCLUDES = usbd_msc_storage_template.c
USBMSC_SRC := $(filter-out ${EXCLUDES}, $(USBMSC_SRC))
-VPATH := $(VPATH):$(USBCDC_DIR)/Src:$(USBCORE_DIR)/Src:$(USBHID_DIR)/Src:$(USBHIDCDC_DIR)/Src:$(USBMSC_DIR)/Src
+VPATH := $(VPATH):$(USBCDC_DIR)/Src:$(USBCORE_DIR)/Src:$(USBHID_DIR)/Src:$(USBMSC_DIR)/Src
DEVICE_STDPERIPH_SRC := $(STDPERIPH_SRC) \
$(USBCORE_SRC) \
$(USBCDC_SRC) \
$(USBHID_SRC) \
- $(USBHIDCDC_SRC) \
$(USBMSC_SRC)
#CMSIS
@@ -109,7 +105,6 @@ INCLUDE_DIRS := $(INCLUDE_DIRS) \
$(USBCORE_DIR)/Inc \
$(USBCDC_DIR)/Inc \
$(USBHID_DIR)/Inc \
- $(USBHIDCDC_DIR)/Inc \
$(USBMSC_DIR)/Inc \
$(CMSIS_DIR)/Core/Include \
$(ROOT)/lib/main/STM32F7/Drivers/CMSIS/Device/ST/STM32F7xx/Include \
@@ -163,6 +158,7 @@ TARGET_FLAGS = -D$(TARGET)
VCP_SRC = \
vcp_hal/usbd_desc.c \
vcp_hal/usbd_conf.c \
+ vcp_hal/usbd_cdc_hid.c \
vcp_hal/usbd_cdc_interface.c \
drivers/serial_usb_vcp.c \
drivers/usb_io.c
diff --git a/lib/main/STM32F7/Middlewares/ST/STM32_USB_Device_Library/Class/CDC_HID/Src/usbd_cdc_hid.c b/src/main/vcp_hal/usbd_cdc_hid.c
similarity index 94%
rename from lib/main/STM32F7/Middlewares/ST/STM32_USB_Device_Library/Class/CDC_HID/Src/usbd_cdc_hid.c
rename to src/main/vcp_hal/usbd_cdc_hid.c
index 5baa7a7c6d..163912d4ff 100644
--- a/lib/main/STM32F7/Middlewares/ST/STM32_USB_Device_Library/Class/CDC_HID/Src/usbd_cdc_hid.c
+++ b/src/main/vcp_hal/usbd_cdc_hid.c
@@ -1,23 +1,30 @@
/*
- * This file is part of Cleanflight.
+ * This file is part of Cleanflight and Betaflight.
*
- * Cleanflight is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * Cleanflight and Betaflight are free software. You can redistribute
+ * this software and/or modify this software under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option)
+ * any later version.
*
- * Cleanflight is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Cleanflight and Betaflight are distributed in the hope that they
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Cleanflight. If not, see .
+ * along with this software.
+ *
+ * If not, see .
*
* Author: Chris Hockuba (https://github.com/conkerkh)
*
*/
+#include "platform.h"
+
+#ifdef USE_USB_CDC_HID
+
//#include "usbd_cdc_hid.h"
#include "usbd_desc.h"
#include "usbd_ctlreq.h"
@@ -327,6 +334,4 @@ uint8_t *USBD_HID_CDC_GetDeviceQualifierDescriptor (uint16_t *length)
*length = sizeof(USBD_HID_CDC_DeviceQualifierDesc);
return USBD_HID_CDC_DeviceQualifierDesc;
}
-
-
-
+#endif