Loading gui/action.cpp +1 −1 Original line number Diff line number Diff line /*update /* Copyright 2013 bigbiff/Dees_Troy TeamWin This file is part of TWRP/TeamWin Recovery Project. Loading gui/gui.cpp +30 −16 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ #include <sys/mount.h> #include <time.h> #include <unistd.h> #include <stdlib.h> extern "C" { Loading Loading @@ -79,6 +78,8 @@ int gGuiRunning = 0; int g_pty_fd = -1; // set by terminal on init void terminal_pty_read(); int select_fd = 0; static int gRecorder = -1; extern "C" void gr_write_frame_to_file(int fd); Loading Loading @@ -395,9 +396,18 @@ void InputHandler::handleDrag() } } void set_select_fd() { select_fd = ors_read_fd + 1; if (g_pty_fd >= select_fd) select_fd = g_pty_fd + 1; if (PartitionManager.uevent_pfd.fd >= select_fd) select_fd = PartitionManager.uevent_pfd.fd + 1; } static void setup_ors_command() { ors_read_fd = -1; set_select_fd(); unlink(ORS_INPUT_FILE); if (mkfifo(ORS_INPUT_FILE, 06660) != 0) { Loading @@ -417,6 +427,7 @@ static void setup_ors_command() unlink(ORS_INPUT_FILE); unlink(ORS_OUTPUT_FILE); } set_select_fd(); } // callback called after a CLI command was executed Loading Loading @@ -448,6 +459,7 @@ static void ors_command_read() if (!orsout) { close(ors_read_fd); ors_read_fd = -1; set_select_fd(); LOGINFO("Unable to fopen %s\n", ORS_OUTPUT_FILE); unlink(ORS_INPUT_FILE); unlink(ORS_OUTPUT_FILE); Loading Loading @@ -554,29 +566,30 @@ static int runPages(const char *page_name, const int stop_on_page_done) for (;;) { loopTimer(input_timeout_ms); if (g_pty_fd > 0) { // TODO: this is not nice, we should have one central select for input, pty, and ors FD_ZERO(&fdset); FD_SET(g_pty_fd, &fdset); timeout.tv_sec = 0; timeout.tv_usec = 1; has_data = select(g_pty_fd+1, &fdset, NULL, NULL, &timeout); if (has_data > 0) { terminal_pty_read(); if (g_pty_fd > 0) { FD_SET(g_pty_fd, &fdset); } if (PartitionManager.uevent_pfd.fd > 0) { FD_SET(PartitionManager.uevent_pfd.fd, &fdset); } #ifndef TW_OEM_BUILD if (ors_read_fd > 0 && !orsout) { // orsout is non-NULL if a command is still running FD_ZERO(&fdset); FD_SET(ors_read_fd, &fdset); timeout.tv_sec = 0; timeout.tv_usec = 1; has_data = select(ors_read_fd+1, &fdset, NULL, NULL, &timeout); } #endif // TODO: combine this select with the poll done by input handling has_data = select(select_fd, &fdset, NULL, NULL, &timeout); if (has_data > 0) { if (g_pty_fd > 0 && FD_ISSET(g_pty_fd, &fdset)) terminal_pty_read(); if (PartitionManager.uevent_pfd.fd > 0 && FD_ISSET(PartitionManager.uevent_pfd.fd, &fdset)) PartitionManager.read_uevent(); if (ors_read_fd > 0 && !orsout && FD_ISSET(ors_read_fd, &fdset)) ors_command_read(); } } #endif if (!gForceRender.get_value()) { Loading Loading @@ -636,6 +649,7 @@ static int runPages(const char *page_name, const int stop_on_page_done) if (ors_read_fd > 0) close(ors_read_fd); ors_read_fd = -1; set_select_fd(); gGuiRunning = 0; return 0; } Loading gui/gui.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ #include "twmsg.h" void set_select_fd(); void gui_msg(const char* text); void gui_warn(const char* text); void gui_err(const char* text); Loading gui/terminal.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ extern "C" { #include "../twcommon.h" } #include "../minuitwrp/minui.h" #include "gui.hpp" #include "rapidxml.hpp" #include "objects.hpp" Loading Loading @@ -83,6 +84,7 @@ public: // and write it to the terminal // this currently works through gui.cpp calling terminal_pty_read below g_pty_fd = fdMaster; set_select_fd(); return true; } else { Loading Loading @@ -174,6 +176,7 @@ public: } close(fdMaster); g_pty_fd = fdMaster = -1; set_select_fd(); int status; waitpid(pid, &status, WNOHANG); // avoid zombies but don't hang if the child is still alive and we got here due to some error pid = 0; Loading gui/theme/common/languages/en.xml +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ <string name="sdext">SD-EXT</string> <string name="adopted_data">Adopted Data</string> <string name="adopted_storage">Adopted Storage</string> <string name="autostorage">Storage</string> <!-- GUI XML strings --> <string name="twrp_header">Team Win Recovery Project</string> Loading Loading
gui/action.cpp +1 −1 Original line number Diff line number Diff line /*update /* Copyright 2013 bigbiff/Dees_Troy TeamWin This file is part of TWRP/TeamWin Recovery Project. Loading
gui/gui.cpp +30 −16 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ #include <sys/mount.h> #include <time.h> #include <unistd.h> #include <stdlib.h> extern "C" { Loading Loading @@ -79,6 +78,8 @@ int gGuiRunning = 0; int g_pty_fd = -1; // set by terminal on init void terminal_pty_read(); int select_fd = 0; static int gRecorder = -1; extern "C" void gr_write_frame_to_file(int fd); Loading Loading @@ -395,9 +396,18 @@ void InputHandler::handleDrag() } } void set_select_fd() { select_fd = ors_read_fd + 1; if (g_pty_fd >= select_fd) select_fd = g_pty_fd + 1; if (PartitionManager.uevent_pfd.fd >= select_fd) select_fd = PartitionManager.uevent_pfd.fd + 1; } static void setup_ors_command() { ors_read_fd = -1; set_select_fd(); unlink(ORS_INPUT_FILE); if (mkfifo(ORS_INPUT_FILE, 06660) != 0) { Loading @@ -417,6 +427,7 @@ static void setup_ors_command() unlink(ORS_INPUT_FILE); unlink(ORS_OUTPUT_FILE); } set_select_fd(); } // callback called after a CLI command was executed Loading Loading @@ -448,6 +459,7 @@ static void ors_command_read() if (!orsout) { close(ors_read_fd); ors_read_fd = -1; set_select_fd(); LOGINFO("Unable to fopen %s\n", ORS_OUTPUT_FILE); unlink(ORS_INPUT_FILE); unlink(ORS_OUTPUT_FILE); Loading Loading @@ -554,29 +566,30 @@ static int runPages(const char *page_name, const int stop_on_page_done) for (;;) { loopTimer(input_timeout_ms); if (g_pty_fd > 0) { // TODO: this is not nice, we should have one central select for input, pty, and ors FD_ZERO(&fdset); FD_SET(g_pty_fd, &fdset); timeout.tv_sec = 0; timeout.tv_usec = 1; has_data = select(g_pty_fd+1, &fdset, NULL, NULL, &timeout); if (has_data > 0) { terminal_pty_read(); if (g_pty_fd > 0) { FD_SET(g_pty_fd, &fdset); } if (PartitionManager.uevent_pfd.fd > 0) { FD_SET(PartitionManager.uevent_pfd.fd, &fdset); } #ifndef TW_OEM_BUILD if (ors_read_fd > 0 && !orsout) { // orsout is non-NULL if a command is still running FD_ZERO(&fdset); FD_SET(ors_read_fd, &fdset); timeout.tv_sec = 0; timeout.tv_usec = 1; has_data = select(ors_read_fd+1, &fdset, NULL, NULL, &timeout); } #endif // TODO: combine this select with the poll done by input handling has_data = select(select_fd, &fdset, NULL, NULL, &timeout); if (has_data > 0) { if (g_pty_fd > 0 && FD_ISSET(g_pty_fd, &fdset)) terminal_pty_read(); if (PartitionManager.uevent_pfd.fd > 0 && FD_ISSET(PartitionManager.uevent_pfd.fd, &fdset)) PartitionManager.read_uevent(); if (ors_read_fd > 0 && !orsout && FD_ISSET(ors_read_fd, &fdset)) ors_command_read(); } } #endif if (!gForceRender.get_value()) { Loading Loading @@ -636,6 +649,7 @@ static int runPages(const char *page_name, const int stop_on_page_done) if (ors_read_fd > 0) close(ors_read_fd); ors_read_fd = -1; set_select_fd(); gGuiRunning = 0; return 0; } Loading
gui/gui.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ #include "twmsg.h" void set_select_fd(); void gui_msg(const char* text); void gui_warn(const char* text); void gui_err(const char* text); Loading
gui/terminal.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ extern "C" { #include "../twcommon.h" } #include "../minuitwrp/minui.h" #include "gui.hpp" #include "rapidxml.hpp" #include "objects.hpp" Loading Loading @@ -83,6 +84,7 @@ public: // and write it to the terminal // this currently works through gui.cpp calling terminal_pty_read below g_pty_fd = fdMaster; set_select_fd(); return true; } else { Loading Loading @@ -174,6 +176,7 @@ public: } close(fdMaster); g_pty_fd = fdMaster = -1; set_select_fd(); int status; waitpid(pid, &status, WNOHANG); // avoid zombies but don't hang if the child is still alive and we got here due to some error pid = 0; Loading
gui/theme/common/languages/en.xml +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ <string name="sdext">SD-EXT</string> <string name="adopted_data">Adopted Data</string> <string name="adopted_storage">Adopted Storage</string> <string name="autostorage">Storage</string> <!-- GUI XML strings --> <string name="twrp_header">Team Win Recovery Project</string> Loading