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 */ usb_state = USB_POWERED; queue_send(&button_queue, SYS_USB_ATTACHED, NULL); break; ============================================== case SYS_USB_ATTACHED: #ifdef USB_ENABLE_STORAGE usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, false); #endif #ifdef USB_ENABLE_HID usb_core_enable_driver(USB_DRIVER_HID, false); #endif #ifdef USB_ENABLE_CHARGING_ONLY usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, false); #endif usb_core_enable_driver(USB_DRIVER_MTP, true); return 1;