Skip to content

Commit 5af1d8f

Browse files
authored
Merge pull request #5800 from abougouffa/feature_unsupported_usbhost
Some enhancements for the USBHost feature and small bug fix
2 parents 6a708d1 + 4bba4e5 commit 5af1d8f

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

features/unsupported/USBHost/USBHost/USBDeviceConnected.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class USBDeviceConnected
106106
template<typename T>
107107
inline void onDisconnect(uint8_t intf_nb, T* tptr, void (T::*mptr)(void)) {
108108
if ((mptr != NULL) && (tptr != NULL)) {
109-
intf[intf_nb].detach.attach(tptr, mptr);
109+
intf[intf_nb].detach = callback(tptr, mptr);
110110
}
111111
}
112112

@@ -118,7 +118,7 @@ class USBDeviceConnected
118118
*/
119119
inline void onDisconnect(uint8_t intf_nb, void (*fn)(void)) {
120120
if (fn != NULL) {
121-
intf[intf_nb].detach.attach(fn);
121+
intf[intf_nb].detach = fn;
122122
}
123123
}
124124

features/unsupported/USBHost/USBHost/USBEndpoint.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class USBEndpoint
8989
template<typename T>
9090
inline void attach(T* tptr, void (T::*mptr)(void)) {
9191
if((mptr != NULL) && (tptr != NULL)) {
92-
rx.attach(tptr, mptr);
92+
rx = callback(tptr, mptr);
9393
}
9494
}
9595

@@ -100,7 +100,7 @@ class USBEndpoint
100100
*/
101101
inline void attach(void (*fptr)(void)) {
102102
if(fptr != NULL) {
103-
rx.attach(fptr);
103+
rx = fptr;
104104
}
105105
}
106106

features/unsupported/USBHost/USBHost/USBHost.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,14 @@ void USBHost::usb_process()
8888
/* check that hub is connected to root port */
8989
if (usb_msg->hub_parent) {
9090
/* a hub device must be present */
91+
#if MAX_HUB_NB
92+
9193
for (k = 0; k < MAX_HUB_NB; k++) {
9294
if ((&hubs[k] == usb_msg->hub_parent) && (hub_in_use[k])) {
9395
hub_unplugged=false;
9496
}
9597
}
98+
#endif
9699
} else {
97100
hub_unplugged = false;
98101
}
@@ -312,7 +315,7 @@ USBHost::USBHost() : usbThread(osPriorityNormal, USB_THREAD_STACK)
312315
}
313316
#endif
314317

315-
usbThread.start(this, &USBHost::usb_process);
318+
usbThread.start(callback(this, &USBHost::usb_process));
316319
}
317320

318321
USBHost::Lock::Lock(USBHost* pHost) : m_pHost(pHost)

0 commit comments

Comments
 (0)