diff options
Diffstat (limited to 'firmware/usb.c')
-rw-r--r-- | firmware/usb.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/firmware/usb.c b/firmware/usb.c index 2ac56a9c15..fa7eef40d2 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -361,14 +361,9 @@ static void usb_thread(void) | |||
361 | break; | 361 | break; |
362 | } | 362 | } |
363 | 363 | ||
364 | exclusive_storage_access = false; | ||
365 | #endif /* HAVE_USBSTACK */ | 364 | #endif /* HAVE_USBSTACK */ |
365 | num_acks_to_expect = usb_release_exclusive_storage(); | ||
366 | 366 | ||
367 | /* Tell all threads that we are back in business */ | ||
368 | num_acks_to_expect = | ||
369 | queue_broadcast(SYS_USB_DISCONNECTED, 0) - 1; | ||
370 | DEBUGF("USB extracted. Waiting for ack from %d threads...\n", | ||
371 | num_acks_to_expect); | ||
372 | break; | 367 | break; |
373 | 368 | ||
374 | case SYS_USB_DISCONNECTED_ACK: | 369 | case SYS_USB_DISCONNECTED_ACK: |
@@ -657,6 +652,20 @@ bool usb_exclusive_storage(void) | |||
657 | } | 652 | } |
658 | #endif | 653 | #endif |
659 | 654 | ||
655 | int usb_release_exclusive_storage(void) | ||
656 | { | ||
657 | int num_acks_to_expect; | ||
658 | #ifdef HAVE_USBSTACK | ||
659 | exclusive_storage_access = false; | ||
660 | #endif /* HAVE_USBSTACK */ | ||
661 | /* Tell all threads that we are back in business */ | ||
662 | num_acks_to_expect = | ||
663 | queue_broadcast(SYS_USB_DISCONNECTED, 0) - 1; | ||
664 | DEBUGF("USB extracted. Waiting for ack from %d threads...\n", | ||
665 | num_acks_to_expect); | ||
666 | return num_acks_to_expect; | ||
667 | } | ||
668 | |||
660 | #ifdef HAVE_USB_POWER | 669 | #ifdef HAVE_USB_POWER |
661 | bool usb_powered(void) | 670 | bool usb_powered(void) |
662 | { | 671 | { |