3

I need send AT commands to my modem (Huawei e171) in a loop. I try this script (file script.txt):

start:
  send AT+CSQ
  sleep 2
  goto start

and run it via minicom -S script.txt but got nothing: empty minicom screen opened. enter image description here but script with single command works well:

start:
  send AT+CSQ

gives expected output: enter image description here

What I'm doing wrong?

PS: I try this script:

start:
  send AT+CSQ

  send AT+CSQ

  send AT+CSQ

but it gives only one answer from modem instead of three....

3

Agree that "expect" is a workaround, not perfect though because it can only print the serial port output after it sees its expectation, if it does not see the expected keyword it does not print anything regardless of serial port output.

Below example sends "help" every 2 seconds and lasts 20 seconds, it expects "kann>" in the response to "help" command and print whatever characters before and including "kann>" after "help"

debian@bbb:~$ cat minicomscript.txt
verbose on
timeout 20
loop:
  send help
  expect "kann>"
  sleep 2
  goto loop
debian@bbb:~$ minicom -S minicomscript.txt
4
  • does anybody know how to print whatever that serial port outputs to screen with minicom runscript? – jasper Oct 16 '19 at 17:04
  • I'm not sure I understand your question. Do you mean what you send to the serial port isn't being echoed back? Or do you mean you want to send the serial port output to a printer? – Setaa Jul 9 '20 at 15:05
  • the latter, although to screen/monitor instead of prunter – jasper Jul 10 '20 at 17:03
  • If what you send is being echoed to the screen, then it sounds like it's working properly already. It's how minicom works for me. I'm still confused because it doesn't sound like there's an issue here at all. – Setaa Jul 13 '20 at 22:47
1

I found solution expect keyword with expected result needed after command:

start:
  send AT+CSQ
  expect "OK"
  sleep 2
  goto start

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.