I'm still very new to Linux, and am writing a script that needs to connect to possibly several different modem models.
I want to disable 4g on modems that support that mode. As such, I would have a set of lines like this:
'OK' 'AT+4GMODE=0' #disable the 4g mode, where supported
So since not all modems will support that command, the next line would be use a subexpect clause:
'OK-AT-OK' 'ATDT#12345678" #dummy phone number of course
My expectation is that the 4g disable would return 'OK' where supported, otherwise would return 'ERROR'. To handle that 'ERROR' the chat would send 'AT' and expect 'OK'.
This works for connecting a modem that supports the 4g command. However, for a 3g-only modem, it breaks. I've got a tool that allows me to send commands manually to the modem and check the response. For both modems, AT does return OK.
Do the subexpect/subsend pairs not work to handle a returned ERROR, then?
I apologize if this is in the wrong forum...I thought about the networking forum, but since I'm still very new I thought maybe I'm missing something that would be obvious to experienced users. I've looked at the man page for chat, but did not see anything that sheds light on this. I searched this forum and found one other old thread with a similar problem, but I still can't figure out where mine is going wrong.
Thanks and have a great day!