0

is there a way to use the Minicom functions in a python script? I need to transfer files via serial port on a raspberry pi 4 to another raspberry pi 4. Minicom offers this functionality and it works indeed when using the console interface.

But I need to trigger the file transfer automatically in my python script and I am not able to type this in the console.

Any kind of feedback is always appreciated.

Thanks. Michael

Michael
  • 13
  • 3
  • I would imagine you could do it fairly easily with `pexpect`. See https://pexpect.readthedocs.io/en/stable/ – Mark Setchell Jul 16 '23 at 07:53
  • Hallo @MarkSetchell. Looks like that this is what I need. I am already struggeling when spawing my minicom process, as there is no actual process generated. I am using: child = pexpect.spawn("minicom -b 115200 -o -D /dev/ttyS0") When I am checking my current processes with ps -ef | grep minicom There is no such process.... Can you help? – Michael Jul 17 '23 at 09:29
  • Hello @MarkSetchell. I get my process now, but I can not parse the response with: child.expect("CTRL-Z", timeout=120) Any ideas? – Michael Jul 17 '23 at 09:30
  • Maybe you can look at my new question: https://stackoverflow.com/questions/76703024/how-to-use-pexpect-with-minicom – Michael Jul 17 '23 at 09:31

0 Answers0