Skip to content

Commit dc29075

Browse files
committed
workaround: Fix double init crash on macosx
1 parent 0f9f914 commit dc29075

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct dfu_if *dfu_root = NULL;
2828
libusb_context *ctx;
2929

3030
const char *libusbOpen() {
31+
if (ctx != NULL) return NULL;
3132
int err = libusb_init(&ctx);
3233
if (err != 0) {
3334
return libusb_strerror(err);
@@ -36,8 +37,8 @@ const char *libusbOpen() {
3637
}
3738

3839
void libusbClose() {
39-
libusb_exit(ctx);
40-
ctx = NULL;
40+
//libusb_exit(ctx);
41+
//ctx = NULL;
4142
}
4243

4344
void dfuProbeDevices() {

0 commit comments

Comments
 (0)