Skip to content

Commit 3b0bbe0

Browse files
fixed connection callback triggering when device not connected
1 parent adf6c1a commit 3b0bbe0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/USBHost/USBHost.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ void USBHost::usb_process()
180180
res = getDeviceDescriptor(&devices[i], buf, 8);
181181

182182
if (res == USB_TYPE_OK) {
183+
184+
185+
if (nullptr != mount_fnc) {
186+
mount_fnc();
187+
}
188+
183189
break;
184190
}
185191

@@ -189,9 +195,7 @@ void USBHost::usb_process()
189195
USB_INFO("New device connected: %p [hub: %d - port: %d]", &devices[i], usb_msg->hub, usb_msg->port);
190196

191197
// Call the device connected callback if registered
192-
if (nullptr != mount_fnc) {
193-
mount_fnc();
194-
}
198+
195199

196200
#if MAX_HUB_NB
197201
if (buf[4] == HUB_CLASS) {

0 commit comments

Comments
 (0)