开发者

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

I have device connected开发者_JS百科 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜