Directly accessing the modem using /dev/ttyS*

Directly accessing the modem using /dev/ttyS*

Post by Philip L » Sun, 01 Nov 1998 04:00:00



Perhaps this is a really dumb question, but, I'll ask anyway:

I'm trying to access my modem directly using the device file
/dev/ttyS1 (my modem is in com2).  I try:

        echo ATZ >/dev/ttyS1

or try to send some other command like ATDT5552424 or ATA instead
of ATZ.  After I type this from my shell, it just hangs there.  
Is there something I'm not getting?  Do you have to do something
else to be able to interact with /dev/ttyS1?  

The reason I'm interested in doing this is that I'm writing a
small script that looks like this (I'm trying to recognize
ring patterns on incoming calls):

        #!/bin/bash

        {

                stty 9600 -tostop
                chat '' ATZ OK          #same chat prog. used by pppd
                chat -f somechatfile
        } <> /dev/ttyS1

Running the above causes the script to hang also.  
Could it be that the modem is left in a "weird" state (I am able to
successfuly use the modem with PPP), or do I need to initialize certain
properties using stty, etc?  

Any help would be much appreciated.

Philip
--

---
Philip Enrique Lim

 
 
 

Directly accessing the modem using /dev/ttyS*

Post by Ondrej Lhot » Sun, 01 Nov 1998 04:00:00


If it's any help, it does the same thing on my machine. I've never had much
luck piping to/from the serial port devices.

If you haven't already, you may want to have a look at xringd. Among other
places, you can find it at
sunsite.unc.edu:/pub/Linux/system/network/daemons/xringd-1.20.tgz
It comes with Debian as well...


>Perhaps this is a really dumb question, but, I'll ask anyway:

>I'm trying to access my modem directly using the device file
>/dev/ttyS1 (my modem is in com2).  I try:

>    echo ATZ >/dev/ttyS1

>or try to send some other command like ATDT5552424 or ATA instead
>of ATZ.  After I type this from my shell, it just hangs there.  
>Is there something I'm not getting?  Do you have to do something
>else to be able to interact with /dev/ttyS1?  

>The reason I'm interested in doing this is that I'm writing a
>small script that looks like this (I'm trying to recognize
>ring patterns on incoming calls):

>    #!/bin/bash

>    {

>            stty 9600 -tostop
>            chat '' ATZ OK          #same chat prog. used by pppd
>            chat -f somechatfile
>    } <> /dev/ttyS1

>Running the above causes the script to hang also.  
>Could it be that the modem is left in a "weird" state (I am able to
>successfuly use the modem with PPP), or do I need to initialize certain
>properties using stty, etc?  

>Any help would be much appreciated.

>Philip
>--

>---
>Philip Enrique Lim



 
 
 

Directly accessing the modem using /dev/ttyS*

Post by Jeff Boso » Sun, 01 Nov 1998 04:00:00



> I'm trying to access my modem directly using the device file
> /dev/ttyS1 (my modem is in com2).  I try:

>    echo ATZ >/dev/ttyS1

> or try to send some other command like ATDT5552424 or ATA instead
> of ATZ.  After I type this from my shell, it just hangs there.  
> Is there something I'm not getting?  Do you have to do something
> else to be able to interact with /dev/ttyS1?  

A couple of years ago I used to do that sort of thing and it worked.
I could do something like "tail -f" on ttyS? (or was it cua?) an
get the respose too.

But when I tried it a few months later and ever since I can't get
it to work.  I don't know if it was a kernel or OS system upgrade
or what.  I suspect it has something to do with "locking".

When I want to do low-level diddling with the modem, I use seyon
or, lately, minicom.  

 
 
 

Directly accessing the modem using /dev/ttyS*

Post by Jeremy Mathe » Sun, 01 Nov 1998 04:00:00





>> I'm trying to access my modem directly using the device file
>> /dev/ttyS1 (my modem is in com2).  I try:

>>        echo ATZ >/dev/ttyS1

>> or try to send some other command like ATDT5552424 or ATA instead
>> of ATZ.  After I type this from my shell, it just hangs there.  
>> Is there something I'm not getting?  Do you have to do something
>> else to be able to interact with /dev/ttyS1?  

>A couple of years ago I used to do that sort of thing and it worked.
>I could do something like "tail -f" on ttyS? (or was it cua?) an
>get the respose too.

>But when I tried it a few months later and ever since I can't get
>it to work.  I don't know if it was a kernel or OS system upgrade
>or what.  I suspect it has something to do with "locking".

I think you need to somehow "activate" the port before you can access
it directly via simple I/O.  For what it is worth, I usually start by
setting the baud rate - something like: stty 38400 < /dev/ttyS0

Did you try that?  Does it help?

 
 
 

Directly accessing the modem using /dev/ttyS*

Post by Robert Nicho » Sun, 01 Nov 1998 04:00:00


Note: E-mailed *and* posted.


:
:Perhaps this is a really dumb question, but, I'll ask anyway:
:
:I'm trying to access my modem directly using the device file
:/dev/ttyS1 (my modem is in com2).  I try:
:
:       echo ATZ >/dev/ttyS1
:
:or try to send some other command like ATDT5552424 or ATA instead
:of ATZ.  After I type this from my shell, it just hangs there.  
:Is there something I'm not getting?  Do you have to do something
:else to be able to interact with /dev/ttyS1?  

It's not a dumb question at all.  The problem is that the open() call is
waiting for carrier.  The open() system call does have an option flag
(O_NONBLOCK or O_NDELAY) to tell it not to wait for carrier, but the
shell is not using that option, and thus the open() hangs.

The quick solution is to use /dev/cua1 in place of /dev/ttyS1.  It's the
same physical device, but the open() will proceed without waiting for
carrier.

Note that /dev/cua* devices are deprecated and may not be present in
really new installations.  In that case you will either have to pipe the
string through a program that uses O_NDELAY when it opens the port, or
else run a program that leaves /dev/ttyS1 in "clocal" mode so that the
driver will ignore modem control signals.

--


PGP public key 1024/9A9C7955
Key fingerprint = 2F E5 82 F8 5D 06 A2 59  20 65 44 68 87 EC A7 D7

 
 
 

Directly accessing the modem using /dev/ttyS*

Post by Vern Hox » Sat, 07 Nov 1998 04:00:00




>Perhaps this is a really dumb question, but, I'll ask anyway:

>I'm trying to access my modem directly using the device file
>/dev/ttyS1 (my modem is in com2).  I try:

>    echo ATZ >/dev/ttyS1

>or try to send some other command like ATDT5552424 or ATA instead
>of ATZ.  After I type this from my shell, it just hangs there.  
>Is there something I'm not getting?  Do you have to do something
>else to be able to interact with /dev/ttyS1?  

>The reason I'm interested in doing this is that I'm writing a
>small script that looks like this (I'm trying to recognize
>ring patterns on incoming calls):

>    #!/bin/bash

>    {

>            stty 9600 -tostop
>            chat '' ATZ OK          #same chat prog. used by pppd
>            chat -f somechatfile
>    } <> /dev/ttyS1

>Running the above causes the script to hang also.  
>Could it be that the modem is left in a "weird" state (I am able to
>successfuly use the modem with PPP), or do I need to initialize certain
>properties using stty, etc?  

>Any help would be much appreciated.

Read my 'serial_suite.tgz'.  This is a collection of blurbs about the
care and feed of the serial ports and some simple programs.  There is
a file demonstrating how the lock files should be programmed. There
is a simple getty, a dialer for ppp connections and some other misc
programs.

Via ftp:

ftp scicom.alphacdc.com

Login as "anonymous" then use your full e-mail address as the password.

cd pub/linux

or:

URL ftp://scicom.alphacdc.com/pub/linux

One of the misc programs is 'query_em'.  It provides an interactive
interface for programming modem registers.

vern
--

3975 W. 29th Ave.                                        uucp: 303-455-2670
Denver, Colo., 80212                                    voice: 303-477-1780
                          Every dog has his tree.

 
 
 

1. How can I tie a modem caller DIRECTLY to another tty Port?

Hi,

We will very soon have a port on our Sun/Unix system that will
be running a Waffle BBS.  Generally, NOBODY will be calling
the BBS and it will be ONLY as a bridge between our Sun and
Novel mail systems.  However, very rarely we do need a BBS so
someone can drop off a file or some such.  There is no way
to justify the expense of a phone line and another modem, but
I am wondering if that is needed at all.

What I would like is a program that can take the caller and
tie him/her directly to another tty port WITHOUT allowing access
to the Unix system at all.  What I see is a /etc/passwd entry
for "waffle" that has no password.  Instead of starting up a
shell, I want to drop the caller directly into the "port
program" and connect him to the Waffle system using the Sun
as nothing more than a forwarder.  I know how to "start" the
program ala the uucp entries I have, but I don't know of a
program that can tie stdin/stdout directly to a tty port
all by itself.  Does anyone out there know of such an animal?

Frank
--
===================================================================
= Frank Merrow                     (Home) (714) 455-3096          =
= Odetics Inc, Broadcast Division  (Work) (714) 772-1000 Ext 3860 =
= 1515 S. Manchester Avenue        (Fax)  (714) 535-8532          =

===================================================================

2. News client

3. accessing /dev/fd0 directly for sector reads/writes

4. Test

5. Can't access directly to /dev/hdd but i can mount it !

6. simple shell for a simplton

7. let users access /dev/modem or /dev/fd0

8. Can't start X server

9. Access Linux-Modem directly from Win95

10. access isp hardware directly using ppp in linux

11. Slow when using proxy compared to directly accessing the server

12. Accessing /dev/tty

13. expect could not access /dev/tty