From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Edwards To: Gary Thomas Cc: ecos-discuss@sources.redhat.com Subject: Re: [ECOS] Redboot: [xyz]modem via TCP? Date: Fri, 09 Feb 2001 07:24:00 -0000 Message-id: <20010209092810.A3808@visi.com> References: <20010208163254.A3275@visi.com> X-SW-Source: 2001-02/msg00143.html On Fri, Feb 09, 2001 at 06:29:10AM -0700, Gary Thomas wrote: > >> With Redboot, can you do [xyz]modem download via TCP instead of > >> serial port? > > > > I slapped together a Python program that uses "sx" to download > > an S record file via TCP using xmodem protocol. Small files > > (less than 2K or so) work fine, but when I get up to about 2K, > > RedBoot crashes. I can load the large files fine via TFTP and > > xmodem/serial. > > > > Anybody else see anything like this? > > I've not tried this. If you want to share [only with me if necessary] > the Python program, I'll give it a look-see when I get a chance. Thanks. Here it is. I didn't try any variations on protocol/frame-size or anything. Just the defualt x-modem mode. IP addresse and filename are hard-coded... ======================================================================== import time import socket import os import sys s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('192.168.1.21',9000)) print "connected to: ",s.getpeername()," from ",s.getsockname() r = s.recv(1024) print "received: ",r if not r.startswith("RedBoot"): raise "No answer from RedBoot" s.send("load -m x\r") r = s.recv(1024) print "received: ",r fd = s.fileno() os.dup2(fd,0) os.dup2(fd,1) os.spawnv(os.P_WAIT,"/usr/bin/sx",("/usr/sbin/sx","-v","dataFile.srec")) sys.stderr.write("done\n"); s.close() ======================================================================== -- Grant Edwards grante@visi.com