Working data transmission in python terminal
This commit is contained in:
parent
3db972995a
commit
ba6866d243
@ -34,20 +34,21 @@ class TerminalEmulator:
|
|||||||
w.clear()
|
w.clear()
|
||||||
w.move(0,0)
|
w.move(0,0)
|
||||||
while True:
|
while True:
|
||||||
# read key and write to serial port
|
|
||||||
key = w.getch()
|
|
||||||
if key == 10 or (key > 31 and key < 256):
|
|
||||||
# Is a character
|
|
||||||
ser.write(key)
|
|
||||||
elif int(key) == 1: # CTRL+A, enter ADB mode
|
|
||||||
self.adbMode(w, ser)
|
|
||||||
|
|
||||||
# read serial port and write to curses
|
# read serial port and write to curses
|
||||||
if ser.inWaiting():
|
if ser.inWaiting():
|
||||||
b = ser.read(1)
|
b = ser.read(1)
|
||||||
if ord(b) > 31 or ord(b) == 10:
|
if ord(b) > 31 or ord(b) == 10:
|
||||||
w.addch(b)
|
w.addch(b)
|
||||||
|
|
||||||
|
# read key and write to serial port
|
||||||
|
key = w.getch()
|
||||||
|
if key == 10 or (key > 31 and key < 256):
|
||||||
|
# Is a character
|
||||||
|
ser.write(bytes([key]))
|
||||||
|
elif int(key) == 1: # CTRL+A, enter ADB mode
|
||||||
|
self.adbMode(w, ser)
|
||||||
|
|
||||||
|
|
||||||
w.refresh()
|
w.refresh()
|
||||||
|
|
||||||
def adbMode(self, w, ser):
|
def adbMode(self, w, ser):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user