summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/usbh_driver_hub.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/usbh_driver_hub.c b/src/usbh_driver_hub.c
index 266cd71..7678dd7 100644
--- a/src/usbh_driver_hub.c
+++ b/src/usbh_driver_hub.c
@@ -31,12 +31,14 @@
static hub_device_t hub_device[USBH_MAX_HUBS];
static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data);
-
+static bool initialized = false;
void hub_driver_init(void)
{
uint32_t i;
+ initialized = true;
+
for (i = 0; i < USBH_MAX_HUBS; i++) {
hub_device[i].device[0] = 0;
hub_device[i].ports_num = 0;
@@ -51,6 +53,11 @@ void hub_driver_init(void)
*/
static void *init(void *usbh_dev)
{
+ if (!initialized) {
+ LOG_PRINTF("\n%s/%d : driver not initialized\r\n", __FILE__, __LINE__);
+ return 0;
+ }
+
uint32_t i;
hub_device_t *drvdata = 0;
// find free data space for hub device