From: Shea C. <she...@gm...> - 2011-02-02 01:54:40
|
This setup is admittedly a bit odd and may or may not actually be an issue with ExpectPerl, but here it is: ExpectPerl script on host machine launches ssh to target machine and logs in - this works fine launches microcom on target machine - also works fine The problem comes when I try to issue a command to the target machine's modem through microcom, let's say the command is ATI ---- Sending 'ATI\r' to spawn id(3) Returning from expect successfully. Starting EXPECT pattern matching... spawn id(3): list of patterns: #1: -re `(?-xism:OK)' spawn id(3): Does `\r\n' match: pattern #1: -re `(?-xism:OK)'? No. Waiting for new data (10 seconds)... ATI spawn id(3): Does `\r\nATI\r\n' match: pattern #1: -re `(?-xism:OK)'? No. Waiting for new data (10 seconds)... TIMEOUT ---- As you can see, it never actually submits the command, it just reads the echos in the micocom. However, if I replace the send with an interact and by hand type ATI^M (by doing ctrl-v, ctrl-m) and hit enter, it works: ---- Calling hook CODE(0x8355f28)... IO::Stty not installed, cannot change mode at ./sshtest.pl line 52 IO::Stty not installed, cannot change mode at ./sshtest.pl line 52 ATI^M ATI [Block of text removed from post, but what was expected] OK ---- Now, I've tried every variation on send I can think of, but they just echo back ATI and some characters: ^V^M/r - spawn id(3): Does `\r\nATI^\b^M\r\n' ^V^M - spawn id(3): Does `\r\nATI^\b^M' ^M/r - spawn id(3): Does `\r\nATI\r\n\r\n' /r/n - spawn id(3): Does `\r\nATI\r\n\r\n' My problem is I don't know which consoles/terminals are escaping which parts of the ctrl characters. I'm especially confused with how ^V^M gets turned into ^\b^M At first I wondered if the problem was stdin/stdout going to the modem and stderr going to the screen, but since the whole thing's wrapped in an ssh session, that shouldn't be distinguishable from the host machine, right? Just noticed: the behavior I'm seeing appears to be consistent with doing "cat | minicom" on the target machine (ATI^M by means of ^V works here too). |