@@ -169,6 +169,7 @@ struct fastboot_ctx_s
169
169
*/
170
170
171
171
uint64_t left ;
172
+ FAR void * handle ;
172
173
FAR void * download_buffer ;
173
174
FAR struct fastboot_var_s * varlist ;
174
175
CODE int (* upload_func )(FAR struct fastboot_ctx_s * );
@@ -1157,7 +1158,6 @@ static int fastboot_usbdev_initialize(FAR struct fastboot_ctx_s *ctx)
1157
1158
# else
1158
1159
uint8_t dev = BOARDIOC_USBDEV_FASTBOOT ;
1159
1160
# endif
1160
- FAR void * handle ;
1161
1161
int ret ;
1162
1162
1163
1163
ctrl .usbdev = dev ;
@@ -1177,7 +1177,7 @@ static int fastboot_usbdev_initialize(FAR struct fastboot_ctx_s *ctx)
1177
1177
ctrl .action = BOARDIOC_USBDEV_CONNECT ;
1178
1178
ctrl .instance = 0 ;
1179
1179
ctrl .config = 0 ;
1180
- ctrl .handle = & handle ;
1180
+ ctrl .handle = & ctx -> handle ;
1181
1181
1182
1182
ret = boardctl (BOARDIOC_USBDEV_CONTROL , (uintptr_t )& ctrl );
1183
1183
if (ret < 0 )
@@ -1208,13 +1208,37 @@ static int fastboot_usbdev_initialize(FAR struct fastboot_ctx_s *ctx)
1208
1208
1209
1209
static void fastboot_usbdev_deinit (FAR struct fastboot_ctx_s * ctx )
1210
1210
{
1211
+ #ifdef CONFIG_SYSTEM_FASTBOOTD_USB_BOARDCTL
1212
+ struct boardioc_usbdev_ctrl_s ctrl ;
1213
+ #endif
1211
1214
int i ;
1212
1215
1213
1216
for (i = 0 ; i < nitems (ctx -> tran_fd ); i ++ )
1214
1217
{
1215
1218
close (ctx -> tran_fd [i ]);
1216
1219
ctx -> tran_fd [i ] = -1 ;
1217
1220
}
1221
+
1222
+ #ifdef CONFIG_SYSTEM_FASTBOOTD_USB_BOARDCTL
1223
+ if (ctx -> handle )
1224
+ {
1225
+ # ifdef CONFIG_USBDEV_COMPOSITE
1226
+ ctrl .usbdev = BOARDIOC_USBDEV_COMPOSITE ;
1227
+ # else
1228
+ ctrl .usbdev = BOARDIOC_USBDEV_FASTBOOT ;
1229
+ # endif
1230
+ ctrl .action = BOARDIOC_USBDEV_DISCONNECT ;
1231
+ ctrl .instance = 0 ;
1232
+ ctrl .config = 0 ;
1233
+ ctrl .handle = & ctx -> handle ;
1234
+
1235
+ i = boardctl (BOARDIOC_USBDEV_CONTROL , (uintptr_t )& ctrl );
1236
+ if (i < 0 )
1237
+ {
1238
+ fb_err ("boardctl(BOARDIOC_USBDEV_DISCONNECT) failed: %d\n" , i );
1239
+ }
1240
+ }
1241
+ #endif /* SYSTEM_FASTBOOTD_USB_BOARDCTL */
1218
1242
}
1219
1243
1220
1244
static ssize_t fastboot_usbdev_read (FAR struct fastboot_ctx_s * ctx ,
0 commit comments