From 7df887fe69d6dabe975299b45c8b99f8e74f63c0 Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Mon, 30 Apr 2018 18:57:24 -0500 Subject: [PATCH] Remove blocking option from USB connect Remove the option to block in USBDevice::connect since this should be handled at a higher level. Also call init to ensure that the USBDevice has been initalized. --- usb/device/USBDevice/USBDevice.cpp | 14 +++++++------- usb/device/USBDevice/USBDevice.h | 4 +--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/usb/device/USBDevice/USBDevice.cpp b/usb/device/USBDevice/USBDevice.cpp index fdc49a83ea..c539e5a598 100644 --- a/usb/device/USBDevice/USBDevice.cpp +++ b/usb/device/USBDevice/USBDevice.cpp @@ -994,20 +994,20 @@ bool USBDevice::configured() return ret; } -void USBDevice::connect(bool blocking) +void USBDevice::connect() { - /* Connect device */ lock(); + + /* Ensure device has been initialized */ + init(); + + /* Connect device */ if (!_connected) { _phy->connect(); _connected = true; } - unlock(); - if (blocking) { - /* Block if not configured */ - while (!configured()); - } + unlock(); } void USBDevice::disconnect() diff --git a/usb/device/USBDevice/USBDevice.h b/usb/device/USBDevice/USBDevice.h index 91bb751336..c6056059bb 100644 --- a/usb/device/USBDevice/USBDevice.h +++ b/usb/device/USBDevice/USBDevice.h @@ -117,10 +117,8 @@ public: /** * Connect a device - * - * @param blocking: block if not configured */ - void connect(bool blocking = true); + void connect(); /** * Disconnect a device