diff options
author | Nick Sanders <nsanders@chromium.org> | 2018-08-27 11:42:26 -0700 |
---|---|---|
committer | Sean Kau <skau@google.com> | 2018-08-27 23:10:05 +0000 |
commit | e94e84d1cf85bbbd6e87119d3ccc3a906743af12 (patch) | |
tree | 07116499646df38d55e1ba8903ac6ddccb48dfaf | |
parent | 538f722d8cb63e581ce1756868ee249caafc4ee8 (diff) | |
download | chrome-ec-e94e84d1cf85bbbd6e87119d3ccc3a906743af12.tar.gz |
Revert "ec3po: quit console & interpreter loop when parent process changes."
This reverts commit 3b39bc56d38511e10871447392b709b3b8e65637.
Reason: wedges consoles on servod.
BRANCH=None
BUG=b:113246887
TEST=reverting unbreaks servod
Change-Id: I2f4dd65727347ce4757c4863664e3b2e46c826fc
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1191383
Tested-by: Raul E Rangel <rrangel@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rwxr-xr-x | util/ec3po/console.py | 7 | ||||
-rw-r--r-- | util/ec3po/interpreter.py | 9 |
2 files changed, 6 insertions, 10 deletions
diff --git a/util/ec3po/console.py b/util/ec3po/console.py index 0b2b586252..608e1b7cba 100755 --- a/util/ec3po/console.py +++ b/util/ec3po/console.py @@ -817,14 +817,13 @@ def IsPrintable(byte): """ return byte >= ord(' ') and byte <= ord('~') -def StartLoop(console, command_active, ppid = os.getppid()): +def StartLoop(console, command_active): """Starts the infinite loop of console processing. Args: console: A Console object that has been properly initialzed. command_active: multiprocessing.Value indicating if servod owns the console, or user owns the console. This prevents input collisions. - ppid: original parent pid to stop loop when parent dies. """ console.logger.debug('Console is being served on %s.', console.user_pty) console.logger.debug('Console master is on %s.', console.master_pty) @@ -837,7 +836,7 @@ def StartLoop(console, command_active, ppid = os.getppid()): ep = select.epoll() ep.register(console.master_pty, select.EPOLLHUP) - while os.getppid() == ppid: + while True: # Check to see if pts is connected to anything events = ep.poll(0) master_connected = not events @@ -981,7 +980,7 @@ def main(argv): # Spawn an interpreter process. itpr_process = multiprocessing.Process(target=interpreter.StartLoop, - args=(itpr,os.getpid())) + args=(itpr,)) # Make sure to kill the interpreter when we terminate. itpr_process.daemon = True # Start the interpreter. diff --git a/util/ec3po/interpreter.py b/util/ec3po/interpreter.py index 6de8ff7a43..9a0880f49c 100644 --- a/util/ec3po/interpreter.py +++ b/util/ec3po/interpreter.py @@ -374,7 +374,7 @@ def Crc8(data): return crc >> 8 -def StartLoop(interp, ppid = os.getppid()): +def StartLoop(interp): """Starts an infinite loop of servicing the user and the EC. StartLoop checks to see if there are any commands to process, processing them @@ -389,13 +389,10 @@ def StartLoop(interp, ppid = os.getppid()): Args: interp: An Interpreter object that has been properly initialised. - ppid: original parent pid to stop loop when parent dies. """ try: - while os.getppid() == ppid: - # Timeout every 100ms to catch if the parent has died. - readable, writeable, _ = select.select(interp.inputs, interp.outputs, [], - 0.1) + while True: + readable, writeable, _ = select.select(interp.inputs, interp.outputs, []) for obj in readable: # Handle any debug prints from the EC. |