File tree Expand file tree Collapse file tree 4 files changed +13
-8
lines changed Expand file tree Collapse file tree 4 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -703,12 +703,15 @@ bool USBDevice::configured(void)
703
703
return (device.state == CONFIGURED);
704
704
}
705
705
706
- void USBDevice::connect (void )
706
+ void USBDevice::connect (bool blocking )
707
707
{
708
708
/* Connect device */
709
709
USBHAL::connect ();
710
- /* Block if not configured */
711
- while (!configured ());
710
+
711
+ if (blocking) {
712
+ /* Block if not configured */
713
+ while (!configured ());
714
+ }
712
715
}
713
716
714
717
void USBDevice::disconnect (void )
Original file line number Diff line number Diff line change @@ -37,8 +37,10 @@ class USBDevice: public USBHAL
37
37
38
38
/*
39
39
* Connect a device
40
+ *
41
+ * @param blocking: block if not configured
40
42
*/
41
- void connect (void );
43
+ void connect (bool blocking = true );
42
44
43
45
/*
44
46
* Disconnect a device
Original file line number Diff line number Diff line change @@ -103,8 +103,7 @@ bool USBMSD::USBCallback_request(void) {
103
103
}
104
104
105
105
106
- bool USBMSD::connect () {
107
-
106
+ bool USBMSD::connect (bool blocking) {
108
107
// disk initialization
109
108
if (disk_status () & NO_INIT) {
110
109
if (disk_initialize ()) {
@@ -131,7 +130,7 @@ bool USBMSD::connect() {
131
130
}
132
131
133
132
// connect the device
134
- USBDevice::connect ();
133
+ USBDevice::connect (blocking );
135
134
return true ;
136
135
}
137
136
Original file line number Diff line number Diff line change @@ -70,9 +70,10 @@ class USBMSD: public USBDevice {
70
70
/* *
71
71
* Connect the USB MSD device. Establish disk initialization before really connect the device.
72
72
*
73
+ * @param blocking if not configured
73
74
* @returns true if successful
74
75
*/
75
- bool connect ();
76
+ bool connect (bool blocking = true );
76
77
77
78
/* *
78
79
* Disconnect the USB MSD device.
You can’t perform that action at this time.
0 commit comments