diff --git a/apps/usb_timer.cpp b/apps/usb_timer.cpp index d14fa8965..d38599db2 100644 --- a/apps/usb_timer.cpp +++ b/apps/usb_timer.cpp @@ -12,6 +12,9 @@ USBTimer::USBTimer(AppsContainer * container) : bool USBTimer::fire() { bool needRedrawing = false; if (Ion::USB::isPlugged()) { + if (!m_previousPluggedState) { + Ion::USB::removeSoftDisconnect(); + } if (!m_previousPluggedState && GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Activate) { m_container->displayExamModePopUp(false); needRedrawing = true; diff --git a/ion/include/ion/usb.h b/ion/include/ion/usb.h index f30aacbaa..db478b4cc 100644 --- a/ion/include/ion/usb.h +++ b/ion/include/ion/usb.h @@ -5,6 +5,7 @@ namespace Ion { namespace USB { bool isPlugged(); +void removeSoftDisconnect(); void DFU(); } diff --git a/ion/src/device/usb.cpp b/ion/src/device/usb.cpp index 84ee6838c..f33fa1b66 100644 --- a/ion/src/device/usb.cpp +++ b/ion/src/device/usb.cpp @@ -13,6 +13,10 @@ bool isPlugged() { return Device::VbusPin.group().IDR()->get(Device::VbusPin.pin()); } +void removeSoftDisconnect() { + OTG.DCTL()->setSDIS(false); +} + } } diff --git a/ion/src/shared/dummy/usb.cpp b/ion/src/shared/dummy/usb.cpp index bc077012e..aad90aed5 100644 --- a/ion/src/shared/dummy/usb.cpp +++ b/ion/src/shared/dummy/usb.cpp @@ -4,5 +4,8 @@ bool Ion::USB::isPlugged() { return false; } +void Ion::USB::removeSoftDisconnect() { +} + void Ion::USB::DFU() { }