From 02020176a910272a5be5d784bc8ef3166a54bbf6 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 31 Oct 2022 02:03:05 +0100 Subject: [PATCH] ExternalKeyboard: Only disable OTG on exit We currently did so on plugin destruction, which was a bit overkill/annoying, as plugin instances are torn down on view changes (i.e., when FileManager/ReaderUI are torn down) ;). --- plugins/externalkeyboard.koplugin/main.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plugins/externalkeyboard.koplugin/main.lua b/plugins/externalkeyboard.koplugin/main.lua index e8f1c9e47..eea9ca84c 100644 --- a/plugins/externalkeyboard.koplugin/main.lua +++ b/plugins/externalkeyboard.koplugin/main.lua @@ -204,12 +204,8 @@ end function ExternalKeyboard:setOTGRole(role) end --- Keep in mind this fires every time we tear down the FM or Reader, too. --- Then again, so does init when the new view spins up, --- which ensures everything works out when switching between the FM & the Reader, --- as long as `external_keyboard_otg_mode_on_start` is enabled. -function ExternalKeyboard:onCloseWidget() - logger.dbg("ExternalKeyboard:onCloseWidget") +function ExternalKeyboard:onExit() + logger.dbg("ExternalKeyboard:onExit") local role = self:getOTGRole() if role == USB_ROLE_HOST then self:setOTGRole(USB_ROLE_DEVICE)