tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: haymanR () icefog ! uacn ! alaska ! edu
To: tru64-unix-managers
Subject: write(): Operation would block
Date: Wed, 07 Jun 1995 17:00:58 +0000	[thread overview]
Message-ID: <96075320706442.tru64-unix-managers.marc@archive.invalid> (raw)

Greetings - 

After reading the man page(s) associated with write(2) and open(2), I believe
I am correct in my porting attempts of an implementation.  I am doing the 
following (and getting the following):

opening modem
opened /dev/ttyd0 as O_RDWR | O_NDELAY
Toggle DTR enter
Get current Modem Control lines
Tell Modem to Turn Off DTR
Setting current Modem Control lines
Tell Modem to Turn On DTR
Toggle DTR exit
Send Modem init sequence
SendBytes (24 bytes) -  a t 26 F 26 C 1 26 D 1 E M 1 Q V X 4 H 24 M B 3 0 0 
write(): Operation would block
bye-bye

Now, I also tried the following and I just hung (as I can expect from my 
interpretation of the man pages):

opening modem
opened /dev/ttyd0 as O_RDWR | O_NOCTTY
Toggle DTR enter
Get current Modem Control lines
Tell Modem to Turn Off DTR
Setting current Modem Control lines
Tell Modem to Turn On DTR
Toggle DTR exit
Send Modem init sequence
SendBytes (24 bytes) -  a t 26 F 26 C 1 26 D 1 E M 1 Q V X 4 H 24 M B 3 0 0 


and same hang if I open as O_RDWR only:

opening modem
opened /dev/ttyd0 as O_RDWR
Toggle DTR enter
Get current Modem Control lines
Tell Modem to Turn Off DTR
Setting current Modem Control lines
Tell Modem to Turn On DTR
Toggle DTR exit
Send Modem init sequence
SendBytes (24 bytes) -  a t 26 F 26 C 1 26 D 1 E M 1 Q V X 4 H 24 M B 3 0 0 

$ file /dev/ttyd0 
/dev/ttyd0:     character special (24/2) VS_SLU #0 terminal #2 modem_control off

modem control goes high and I see the modem DTR indicator go low then high as
expected in my routine.

Apparently I am doing something wrong.  Any ideas?  I am running a DEC3000-300 
(not X, LX, etc...) with Digital UNIX v3.2a, and use a MultiTech MultiModemV32.

I have used this modem to dial into my machine.  I have used tip to manually
dial out, but I'm having problems with write(2)s to /dev/ttyd0.

I'll summarize if I get any responses (as always).


Randy M. Hayman
haymanr@icefog.alaska.edu



(code snippets):
...
        if (debug > 90)
                report (LOG_INFO, "opened %s as O_RDWR | O_NDELAY", 
pcinfo->modemdev);
        if ((*fd = open (pcinfo->modemdev, O_RDWR | O_NDELAY, 0)) == -1) {
                report(LOG_ERR, "open (%.512s): %s", pcinfo->modemdev, 
strerror(errno));
                return 1; /* bad */
        }

...

        if (debug >90)
                report (LOG_INFO, "Send Modem init sequence");

        if (SendString(fd, pcinfo->modeminit))
                return 1;
 


SendString (fd, string)
int fd;
char *string;
{
        return SendBytes (fd, string, strlen(string));

} /* SendString */



SendBytes (fd, bytes, len)
int fd;
char *bytes;
int len;
{

        extern int errno, debug;

#ifdef DEBUG
        if (debug > 2)
                report (LOG_INFO, "SendBytes (%d bytes) -  %.512s", len,
                        PrintBytes (bytes, len));
#endif /* DEBUG */

        if (write (fd, bytes, len) == -1) {
                report(LOG_ERR, "write(): %s", strerror(errno));
                return 1; /* bad */
        }

        return 0; /* good */
} /* SendBytes */

                 reply	other threads:[~1995-06-07 17:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox