case USB_INSERTED: /* inject an event into the button queue so the main thread * will run the USB-UI code and return after the desired * drivers are enabled */ queue_send(&button_queue, SYS_USB_ATTACHED, NULL); usb_state = USB_POWERED; #ifdef HAVE_USBSTACK /* Check any drivers enabled at this point for exclusive storage * access requirements. */ exclusive_storage_access = usb_core_any_exclusive_storage(); if(!exclusive_storage_access) { usb_attach(); break; } #endif /* HAVE_USBSTACK */ /* Tell all threads that they have to back off the storage. We subtract one for our own thread. */ num_acks_to_expect = queue_broadcast(SYS_USB_CONNECTED, 0) - 1; DEBUGF("USB inserted. Waiting for ack from %d threads...\n", num_acks_to_expect); break;