From fb142329a98946230bfb40ff090df0cc88f37a87 Mon Sep 17 00:00:00 2001 From: Stephen Erickson Date: Mon, 12 Jan 2015 12:55:37 -0500 Subject: [PATCH] Added support for commands that run until manually finished/terminated --- RootTools/RootTools.iws | 492 +++++++++--------- .../com/stericson/RootTools/Constants.java | 2 +- .../internal/RootToolsInternalMethods.java | 15 +- .../RootToolsTests/SanityCheckRootTools.java | 16 + 4 files changed, 280 insertions(+), 245 deletions(-) diff --git a/RootTools/RootTools.iws b/RootTools/RootTools.iws index fc249ac..f88036c 100644 --- a/RootTools/RootTools.iws +++ b/RootTools/RootTools.iws @@ -82,35 +82,37 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -169,8 +171,8 @@ - - + + @@ -189,8 +191,8 @@ - - + + @@ -214,10 +216,10 @@ @@ -272,8 +274,6 @@ - - @@ -371,6 +371,8 @@ + + @@ -583,11 +585,12 @@ - + - + + @@ -596,7 +599,6 @@ - @@ -656,32 +658,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -795,32 +799,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -870,32 +876,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -945,32 +953,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1020,32 +1030,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1071,32 +1083,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1125,10 +1139,10 @@ - + - - + + @@ -1149,62 +1163,64 @@ - + - - + + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RootTools/src/com/stericson/RootTools/Constants.java b/RootTools/src/com/stericson/RootTools/Constants.java index cb3544b..5ed0332 100644 --- a/RootTools/src/com/stericson/RootTools/Constants.java +++ b/RootTools/src/com/stericson/RootTools/Constants.java @@ -2,7 +2,7 @@ public class Constants { - public static final String TAG = "RootTools v4.1"; + public static final String TAG = "RootTools v4.2"; public static final int FPS = 1; public static final int BBA = 3; public static final int BBV = 4; diff --git a/RootTools/src/com/stericson/RootTools/internal/RootToolsInternalMethods.java b/RootTools/src/com/stericson/RootTools/internal/RootToolsInternalMethods.java index b2edb41..1636d3b 100644 --- a/RootTools/src/com/stericson/RootTools/internal/RootToolsInternalMethods.java +++ b/RootTools/src/com/stericson/RootTools/internal/RootToolsInternalMethods.java @@ -488,19 +488,20 @@ public void fixUtil(String util, String utilPath) RootTools.remount("/system", "rw"); List foundPaths = RootShell.findBinary(util); + if (foundPaths.size() > 0) { for (String path : foundPaths) { Command command = new Command(0, false, utilPath + " rm " + path + "/" + util); - Shell.startRootShell().add(command); - commandWait(Shell.startRootShell(), command); + RootShell.getShell(true).add(command); + commandWait(RootShell.getShell(true), command); } Command command = new Command(0, false, utilPath + " ln -s " + utilPath + " /system/bin/" + util, utilPath + " chmod 0755 /system/bin/" + util); - Shell.startRootShell().add(command); - commandWait(Shell.startRootShell(), command); + RootShell.getShell(true).add(command); + commandWait(RootShell.getShell(true), command); } @@ -814,6 +815,7 @@ public void commandOutput(int id, String line) String[] lineArray = line.split(" "); if (lineArray[0].length() != 10) { + super.commandOutput(id, line); return; } @@ -849,8 +851,8 @@ public void commandOutput(int id, String line) super.commandOutput(id, line); } }; - Shell.startRootShell().add(command); - commandWait(Shell.startRootShell(), command); + RootShell.getShell(true).add(command); + commandWait(RootShell.getShell(true), command); return InternalVariables.permissions; @@ -1587,6 +1589,7 @@ private void commandWait(Shell shell, Command cmd) throws Exception { RootTools.log(Constants.TAG, shell.getCommandQueuePositionString(cmd)); + RootTools.log(Constants.TAG, "Processed " + cmd.totalOutputProcessed + " of " + cmd.totalOutput + " output from command."); synchronized (cmd) { diff --git a/RootTools/src/com/stericson/RootToolsTests/SanityCheckRootTools.java b/RootTools/src/com/stericson/RootToolsTests/SanityCheckRootTools.java index ed72e62..cf069e9 100644 --- a/RootTools/src/com/stericson/RootToolsTests/SanityCheckRootTools.java +++ b/RootTools/src/com/stericson/RootToolsTests/SanityCheckRootTools.java @@ -320,6 +320,21 @@ public void commandOutput(int id, String line) }; shell.add(cmd); + visualUpdate(TestHandler.ACTION_PDISPLAY, "getevent - /dev/input/event0"); + visualUpdate(TestHandler.ACTION_DISPLAY, "[ getevent - /dev/input/event0 ]\n"); + + cmd = new Command(0, 0, "getevent /dev/input/event0") + { + @Override + public void commandOutput(int id, String line) + { + visualUpdate(TestHandler.ACTION_DISPLAY, line + "\n"); + super.commandOutput(id, line); + } + + }; + shell.add(cmd); + } catch (Exception e) { @@ -362,6 +377,7 @@ public void commandOutput(int id, String line) } }; shell.add(cmd); + } catch (Exception e) {