1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

pyterm: always perform input preprocessing

This commit is contained in:
Oleg Hahm 2014-06-05 06:22:44 +02:00
parent f335cf07c3
commit a0796ae6e5

View File

@ -88,7 +88,7 @@ class SerCmd(cmd.Cmd):
time.sleep(1)
for cmd in self.init_cmd:
self.logger.debug("WRITE ----->>>>>> '" + cmd + "'\n")
self.ser.write(cmd + "\n")
self.onecmd(self.precmd(cmd))
# start serial->console thread
receiver_thread = threading.Thread(target=self.reader)
@ -96,11 +96,13 @@ class SerCmd(cmd.Cmd):
receiver_thread.start()
def precmd(self, line):
self.logger.debug("processing line #%s#" % line)
if (line.startswith("/")):
return "PYTERM_" + line[1:]
return line
def default(self, line):
self.logger.debug("%s is no pyterm command, sending to default out" % line)
for tok in line.split(';'):
tok = self.get_alias(tok)
self.ser.write((tok.strip() + "\n").encode("utf-8"))