Browse Source

Send ^D when a connection is made

This removes any garbage that the Sink may have in its buffer, e.g.
partially entered commands or nonsense that appeared when moving the
device to/from a VM.
Clara Hobbs 7 years ago
parent
commit
a6c566691a
1 changed files with 5 additions and 0 deletions
  1. 5
    0
      pdbuddy/__init__.py

+ 5
- 0
pdbuddy/__init__.py View File

@@ -29,6 +29,11 @@ class Sink:
29 29
         except ValueError:
30 30
             self._port = serial.Serial(sp.device, baudrate=115200)
31 31
 
32
+        # Put communications in a known state, cancelling any partially-entered
33
+        # command that may be sitting in the buffer.
34
+        self._port.write("\x04".encode("utf-8"))
35
+        self._port.flush()
36
+
32 37
     def __enter__(self):
33 38
         return self
34 39
 

Loading…
Cancel
Save