From d585cd5d8637ea06e62cf420a5e45aedcd207626 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 1 Nov 2022 00:24:55 +0100 Subject: [PATCH] ExternalKeyboard: Don't keep the menu open on toggle, the event cascade may reinit stuff and close it anyway. --- plugins/externalkeyboard.koplugin/main.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/externalkeyboard.koplugin/main.lua b/plugins/externalkeyboard.koplugin/main.lua index 04fb972ca..23ed926cb 100644 --- a/plugins/externalkeyboard.koplugin/main.lua +++ b/plugins/externalkeyboard.koplugin/main.lua @@ -130,15 +130,14 @@ function ExternalKeyboard:addToMainMenu(menu_items) sub_item_table = { { text = _("Enable OTG mode to connect peripherals"), - keep_menu_open = true, checked_func = function() return self:getOTGRole() == USB_ROLE_HOST end, callback = function(touchmenu_instance) local role = self:getOTGRole() local new_role = (role == USB_ROLE_DEVICE) and USB_ROLE_HOST or USB_ROLE_DEVICE - self:setOTGRole(new_role) - touchmenu_instance:updateItems() + -- Let the menu close itself first, as the event cascade might reinit stuff and close it anyway + UIManager:nextTick(self.setOTGRole, self, new_role) end, }, {