write(): Operation would block

From: <haymanR_at_icefog.uacn.alaska.edu>
Date: Wed, 07 Jun 95 09:00:58 -0800

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_at_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 */
Received on Wed Jun 07 1995 - 19:50:07 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:45 NZDT