From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,a73ac6c5181bd69a,start X-Google-Attributes: gidfee84,public From: haymanR@icefog.uacn.alaska.edu (Randy M. Hayman) Subject: write(2): Operation would block Date: 1995/06/07 Message-ID: <3r4rkp$l77@news.alaska.edu>#1/1 X-Deja-AN: 104036418 distribution: world organization: University of Alaska Computer Network keywords: write(2) EAGAIN reply-to: haymanr@icefog.uacn.alaska.edu newsgroups: comp.unix.osf.osf1 Greetings - I am attempting to get sendpage4a functional under Digital UNIX v3.2a with a MultiTech MultiModemV32 attached to a DEC3000-300. After reading the man page(s) associated with write(2) and open(2), I believe I am correct in my porting attempts. 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 on and I see the modem DTR indicator go low then high as expected in the routine. Apparently I am doing something wrong. Any ideas? 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). (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 */ -- Randy M. Hayman haymanr@icefog.alaska.edu "Ethernet works in practice but not in theory" -- Bob Metcalfe