From 90951f9baaddd97e819db604e8082cfa3ff7957b Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Tue, 7 Jul 2020 12:39:20 -0400 Subject: [PATCH] Check the right event index. --- source/usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/usb.c b/source/usb.c index 2cca612..c2d6124 100644 --- a/source/usb.c +++ b/source/usb.c @@ -376,7 +376,7 @@ static int usbDetectionThreadFunc(void *arg) rwlockWriteLock(&g_usbDeviceLock); rwlockWriteLock(&(g_usbDeviceInterface.lock)); - /* Retrieve current USB connection status */ + /* Retrieve current USB connection status. */ /* Only proceed if we're dealing with a status change. */ g_usbHostAvailable = usbIsHostAvailable(); g_usbSessionStarted = false; @@ -384,7 +384,7 @@ static int usbDetectionThreadFunc(void *arg) /* Start a USB session if we're connected to a host device and if the status change event was triggered. */ /* This will essentially hang this thread and all other threads that call USB-related functions until a session is established. */ - if (g_usbHostAvailable && idx == 1) g_usbSessionStarted = usbStartSession(); + if (g_usbHostAvailable && idx == 0) g_usbSessionStarted = usbStartSession(); rwlockWriteUnlock(&(g_usbDeviceInterface.lock)); rwlockWriteUnlock(&g_usbDeviceLock);