From c7eee6fef0263ed4eb5aa0d934a0a8c972d41b30 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Tue, 2 Sep 2014 18:59:01 -0400 Subject: add mtp responder to TWRP. Big thanks to Dees_Troy for helping with the implementation. Change-Id: I6c9c522b9c9de5dc139e2ecb0141008182ba07f0 --- twrp-functions.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'twrp-functions.cpp') diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 885d352db..1798c49b7 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -1260,4 +1260,22 @@ int TWFunc::Set_Brightness(std::string brightness_value) return -1; } +bool TWFunc::Toggle_MTP(bool enable) { +#ifdef TW_HAS_MTP + static int was_enabled = false; + + if (enable && was_enabled) { + if (!PartitionManager.Enable_MTP()) + PartitionManager.Disable_MTP(); + } else { + was_enabled = DataManager::GetIntValue("tw_mtp_enabled"); + PartitionManager.Disable_MTP(); + usleep(500); + } + return was_enabled; +#else + return false; +#endif +} + #endif // ndef BUILD_TWRPTAR_MAIN -- cgit v1.2.3