Actually, it's minicom that would be doing cursor control, by sending the escape sequences for whatever kind of terminal it thinks you are using. You might need to specify a valid terminal type in the environment, $ENV{TERM}="vt100" or "xterm" for instance. Ordinarily you can ignore the escape sequences coming back and look for printable characters that act as prompts. When you send to minicom, you would send exactly the same characters that would be sent by the keys you would press if you started minicom by hand.