Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Chat scripts and modems
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
pa4wdh
Guru
Guru


Joined: 16 Dec 2005
Posts: 393

PostPosted: Mon Dec 13, 2010 2:12 pm    Post subject: [SOLVED] Chat scripts and modems Reply with quote

Hi All,

I'm trying to make chat talk to a modem (in this case a HSO based HSUPA module). I'm used to doing this via pppd, but in this case i don't need pppd so chat has to do it by itself :-)

I'm trying this command:
Code:

chat -s -V -f chatscript < /dev/ttyHS1 > /dev/ttyHS1

However, it doesn't do anything and waits forever.

Can anybody give me a hint on how to do this ?

Thanks.

Best regards,
pa4wdh
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

Free as in Freedom is not limited to software only:
Music: http://www.jamendo.com
Recipes: http://www.opensourcefood.com


Last edited by pa4wdh on Fri Dec 17, 2010 2:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 46275
Location: 56N 3W

PostPosted: Mon Dec 13, 2010 9:41 pm    Post subject: Reply with quote

pa4wdh,

At the risk of paraphraing Commander Powell from Dark Star, you go and talk to it first.

Fire up minicom and give AT commands. When you say AT, the modem should respond ok.
Normally, chat is used to authenticate and start PPP.

When you know what works, you can put it in your chat script.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pa4wdh
Guru
Guru


Joined: 16 Dec 2005
Posts: 393

PostPosted: Tue Dec 14, 2010 7:17 am    Post subject: Reply with quote

Thanks for your answer NeddySeagoon, but that isn't really the answer i was searching for :(

Maybe i should explain a bit more to clarify the question:
The device i'm using is a bit unusual, usually you give some AT commands and then the ppp session starts over that serial link. In this case it doesn't. I need to send some commands, but there will be no ppp. That's why i'm using chat itself instead of pppd+chat. I indeed verified using minicom that the modem is alive and responds to AT commands. But now the question: How can i make chat to talk to the modem device ? The script itself works ok on stdio (given that I type OK every now and then to "emulate" the modem).
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

Free as in Freedom is not limited to software only:
Music: http://www.jamendo.com
Recipes: http://www.opensourcefood.com
Back to top
View user's profile Send private message
dermund
Apprentice
Apprentice


Joined: 28 Aug 2007
Posts: 205
Location: Sprawl

PostPosted: Tue Dec 14, 2010 11:24 am    Post subject: Reply with quote

If you don't care for the answer of the modem, you can just tell it something like that.
Code:
echo -ne "AT+CFUN=1,1\r" > /dev/ttyHS1

You should however not spam the modem in this way. If you tell it many commands give it a moment to settle after each command.
At least that always worked for me.

If you need the answer of the modem, did you first try with a really simple chatscript:
Code:
"" "AT"
OK


Can you post your chatscript?
Also, does the chat produces any output if you invoke it with '-v' (verbose) ?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 46275
Location: 56N 3W

PostPosted: Tue Dec 14, 2010 7:32 pm    Post subject: Reply with quote

pa4wdh,

Explain how you will use the modem - whats it talking to.

Chat makes a log - whats in the log?
Warning: Passwords are logged in clear text, so you might want to address that before you post the log
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pa4wdh
Guru
Guru


Joined: 16 Dec 2005
Posts: 393

PostPosted: Wed Dec 15, 2010 12:58 pm    Post subject: Reply with quote

@dermund:
Thanks for the tip, but i do need to parse the output of the modem.

@NeddySeagoon:
The HSO devices are a bit different than normal modems, they need some special commands and will make a GPRS session. However, this is not done with a PPP link to the computer but it has a "hso0" interface which shows up with ifconfig.

The actual chat script is currently on a different PC which doesn't have internet connection, but it looks the same like this one:
Code:

ABORT   'BUSY'
ABORT   'NO CARRIER'
ABORT   'ERROR'
''      AT
OK      AT+CGDCONT=1,"IP","\T"
OK      ATDT*99***1#

Of ocurse the AT command's are different in the actual chat script i'm using, but if i start chat with the command listed in my first post in this topic it just waits forever ( i guess it's waiting for an OK from the modem).
I'm not aware of any log file for chat other than what's send to stdout and stderr, and both give no output at all. Is there any other log ?

I don't really think we should try to troubleshoot the chat script itself, but i'm searching for the way to make chat send it's output to a modem and receive it's input from the modem to get interaction. This functionality is usually provided by pppd, but how should i do that without pppd ? Or, of course, is there a better tool for this job ?
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

Free as in Freedom is not limited to software only:
Music: http://www.jamendo.com
Recipes: http://www.opensourcefood.com
Back to top
View user's profile Send private message
dermund
Apprentice
Apprentice


Joined: 28 Aug 2007
Posts: 205
Location: Sprawl

PostPosted: Wed Dec 15, 2010 2:28 pm    Post subject: Reply with quote

pa4wdh wrote:
I'm not aware of any log file for chat other than what's send to stdout and stderr, and both give no output at all. Is there any other log ?

When chat is invoked like "chat -s -V -v -f ...< /dev/device > /dev/device" all the communication is printed on the console - if there actually is something.

With the above syntax I can talk to my modem flawlessly, but I have a quite common HSDPA modem - I guess your device uses the hso.ko driver, so maybe these links I stumbled upon may apply to you (altough I wonder how you can talk the modem with a mini-/microcom, if the below is true, nah ) :

http://www.xs4all.nl/~ernstagn/GPRS-HOWTO/GPRS-HOWTO-3.html#ss3.12 wrote:
...
Because of this new method, the regular AT commands found in this HOWTO do not work. Along with the hso driver you also received a shell script called connect.sh. Edit it to contain your information in the APN, USR, PAS and PIN variables. After then use ./connect.sh to initialize your card, ./connect.sh up make a connection and ./connect.sh down to disconnect again.
...

http://www.gentoo-wiki.info/Telstra_and_Bigpond_Modems wrote:
...
This modem comes from Telstra/Bigpond as a 3 series modem capable of 3.2Mbps. There are other documents on the web that describe how to connect with the original firmware models (see the Quozl BP3 guide) . As I understand it, the firmware update to enable the 7 series speeds of 7.2Mbps disables the standard AT modem interface so using the usual ppp and chat scripts is not possible anymore. The solution is to use the custom "Connect.sh" scripts along with the hso.ko kernel module available in the driver download from Pharscape. Please make sure you run "lsusb" (part of sys-apps/usbutils) and check the device ID is the same as mine (0af0:6711). If it's not you may be able to make it work with usbserial/airprime/sierra as per Quozl's guide instead.
...


If that rings a bell somehow, you may look if you find something useful from this pharscape site or look here - it's from the openwrt project, but it's quite a collection of scripts, which maybe are helpful for you.
That's all I have, hope it helps.
Back to top
View user's profile Send private message
pa4wdh
Guru
Guru


Joined: 16 Dec 2005
Posts: 393

PostPosted: Wed Dec 15, 2010 7:55 pm    Post subject: Reply with quote

Thanks for the hints on chat. I tried it with a modem I know that works an see all the logging, this should be useful. Tomorrow i'm able to try to the HSO modem again and see what i can get. I also just thought: Maybe it's just the "serial port" settings ? Like waiting for hardware flow control while there isn't one ? I'll have to find out how to change that, i thought stty was the tool for that, right ?

Also thanks for quoting my own HOWTO :-) I found the connect.sh script and they seem to use the same way to use chat as i am (with in- and output redirection), there no other neat trick there :-(
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

Free as in Freedom is not limited to software only:
Music: http://www.jamendo.com
Recipes: http://www.opensourcefood.com
Back to top
View user's profile Send private message
dermund
Apprentice
Apprentice


Joined: 28 Aug 2007
Posts: 205
Location: Sprawl

PostPosted: Wed Dec 15, 2010 9:41 pm    Post subject: Reply with quote

pa4wdh wrote:
Also thanks for quoting my own HOWTO :-)

lol
This is going off my competence.
I hope Neddy can help you more ;)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 46275
Location: 56N 3W

PostPosted: Wed Dec 15, 2010 9:42 pm    Post subject: Reply with quote

pa4wdh,

Chat does not use PPP to talk to a modem, it does it all itself. Taking your script
Code:
ABORT   'BUSY'
ABORT   'NO CARRIER'
ABORT   'ERROR'
''     AT
OK      AT+CGDCONT=1,"IP","\T"
OK      ATDT*99***1#

Chat sets up some conditions on which it will abort, the next line means listen for nothing from the modem, then send AT.
The next line is listen for OK from the modem then send AT+CGDCONT=1,"IP","\T"
Then it listens for OK before sending ATDT*99***1#
I would have expected the line
Code:
''      AT
to be
Code:
''      ATZ

as ATZ is a command to reset the modem.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pa4wdh
Guru
Guru


Joined: 16 Dec 2005
Posts: 393

PostPosted: Thu Dec 16, 2010 6:47 am    Post subject: Reply with quote

Aarrgghh, sometimes for the simplest problems it's way to hard to find out what causes it :-(

There's nothing wrong with chat, with the script ...
The real problem was that i was using, or at least intended to use, the -V option ... but i forgot the -. Now chat doesn't see that as an illegal option but interprets it as a script, so it patiently waited until it found a V, which it doesn't find because the modem won't say anything :-)
Now i corrected it and it works ok :-)

As for the AT versus ATZ: Since this is not a regular modem the ATZ doesn't really add anything useful, the line is there just to get the conversation going.

Thanks for your help NeddySeagoon and Dermund
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

Free as in Freedom is not limited to software only:
Music: http://www.jamendo.com
Recipes: http://www.opensourcefood.com
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum