From 8b93e0f57ddd5aeb55daf25c28d341c75cceb1d0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 12 Feb 2020 17:43:48 +1100 Subject: [PATCH] HAL_ChibiOS: prevent double init of USB this prevented init of USB CubeBlack on Windows. Thanks to Randy for reporting --- libraries/AP_HAL_ChibiOS/UARTDriver.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/UARTDriver.cpp b/libraries/AP_HAL_ChibiOS/UARTDriver.cpp index 46eee82de4..bb331c5161 100644 --- a/libraries/AP_HAL_ChibiOS/UARTDriver.cpp +++ b/libraries/AP_HAL_ChibiOS/UARTDriver.cpp @@ -256,21 +256,7 @@ void UARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS) */ if (!_device_initialised) { if ((SerialUSBDriver*)sdef.serial == &SDU1) { - sduObjectInit(&SDU1); - sduStart(&SDU1, &serusbcfg1); -#if HAL_HAVE_DUAL_USB_CDC - sduObjectInit(&SDU2); - sduStart(&SDU2, &serusbcfg2); -#endif - /* - * Activates the USB driver and then the USB bus pull-up on D+. - * Note, a delay is inserted in order to not have to disconnect the cable - * after a reset. - */ - usbDisconnectBus(serusbcfg1.usbp); - hal.scheduler->delay_microseconds(1500); - usbStart(serusbcfg1.usbp, &usbcfg); - usbConnectBus(serusbcfg1.usbp); + usb_initialise(); } _device_initialised = true; } @@ -1458,7 +1444,6 @@ void usb_initialise(void) return; } initialised = true; - setup_usb_strings(); sduObjectInit(&SDU1); sduStart(&SDU1, &serusbcfg1); #if HAL_HAVE_DUAL_USB_CDC