I’ve been searching high and low. ZTerm is extinct, screen kinda sucks with scrolling. So what do I have left?
I attempted to write a script in Python to turn the serial port into a local socket so I could use Telnet but I couldn’t seem to get past opening the serial port.
After some searching, I found MultiCom. It does exactly what I wanted – turns my serial port into a local socket. Works prefect!
Anyway, if you have time, help me with this script. It’s fairly simple and still incomplete, but I can’t get past fixing what blocks the open() calls to /dev/tty.PL2303-0000101D.
Update: I managed to figure out why my script didn’t work; I should have used /dev/cu.* instead of /dev/tty.*. I also found that MultiCom doesn’t work with Cisco devices due to an odd Cisco behavior. Read this blog entry for more info.
#!/usr/bin/python
import os, socket
dev = '/dev/tty.PL2303-0000101D'
bind = '127.0.0.1'
port = 8023
buff = 4096
fr = open(dev, 'rb', 0)
print "Read FD open"
fw = open(dev, 'wb', 0)
print "Write FD open"
ss = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "Listening on port", port
ss.bind((bind, port))
ss.listen(1)
print "Waiting for socket"
(cs, ca) = ss.accept()
print "Got socket"
ss.close()
print "Forking"
pid = os.fork()
# child
if pid == 0:
print "In child"
while 1:
s = os.read(fr, buff)
if not s: break
print "Read serial:", s
cs.sendall(s)
close(fr)
exit(0)
# parent
else:
print "In parent"
while 1:
s = cs.recv(buff)
if not s: break
print "Read net:", s
os.write(fw, s)
close(fw)
os.wait(pid)
cs.close()
exit(0)