Tutorial :How to send file to serial port using kermit protocol in python



Question:

I have device connected through serial port to PC. Using c-kermit I can send commands to device and read output. I can also send files using kermit protocol.

In python we have pretty nice library - pySerial. I can use it to send/receive data from device. But is there some nice solution to send files using kermit protocol?


Solution:1

You should be able to do it via the subprocess module. The following assumes that you can send commands to your remote machine and parse out the results already. :-)

I don't have anything to test this on at the moment, so I'm going to be pretty general. Roughly: 1.) use pyserial to connect to the remote system through the serial port. 2.) run the kermit client on the remote system using switches that will send the file or files you wish to transfer over the remote systems serial port (the serial line you are using.) 3.) disconnect your pyserial instance 4.) start your kermit client with subprocess and accept the files. 5.) reconnect your pyserial instance and clean everything up.

I'm willing to bet this isn't much help, but when I actually did this a few years ago (using os.system, rather than subprocess on a hideous, hideous SuperDOS system) it took me a while to get my fat head around the fact that I had to start a kermit client remotely to send the file to my client!

If I have some time this week I'll break out one of my old geode boards and see if I can post some actual working code.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »