Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!GRINNELL.MAILNET!McGuire_Ed From: McGuire_Ed@GRINNELL.MAILNET Newsgroups: mod.computers.vax Subject: Raising DTR Message-ID: <8701090614.AA23779@ucbvax.Berkeley.EDU> Date: Thu, 8-Jan-87 14:37:00 EST Article-I.D.: ucbvax.8701090614.AA23779 Posted: Thu Jan 8 14:37:00 1987 Date-Received: Fri, 9-Jan-87 06:16:22 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 191 Approved: info-vax@sri-kl.arpa You're right, the documentation on modem control is lousy. I went through what you are going through last year. CSC was some help, and they eventually submitted an SPR on my behalf suggesting changes and improvements to the documentation. Rather than try to explain the whole process (and probably get some of it wrong because it's been awhile), I'm including an example of code that toggles DTE modem control signals on a DMZ-32, and then tests the modem's DCE signals in order to determine whether the right thing happened. I'm assuming that if you were This code is extracted from a program I developed in BASIC (permission granted to stare in disbelief) which supports autodial from a VAX/VMS system, including security features such as restricted access to specific remote services by username. Cooincidentally, I have just been asked to make some enhancements to the program. This means that I will be refamiliarizing myself with the operation of all this stuff, and you're welcome to ask specific questions if you think there is a chance I might be of some help. Ed McGuire McGuire_Ed%GRINNELL.MAILNET@MULTICS.MIT.EDU (MIT-MULTICS.ARPA) ******************************************************************************** Code fragment which declares some structures necessary for example ******************************************************************************** option type=explicit record quad variant case byte byte0, byte1, byte2, byte3, byte4, byte5, byte6, byte7 case word word0, word2, word4, word6 case long long0, long4 end variant end record quad external long constant & dia_notidle external long constant & tt$m_ds_carrier, & tt$m_ds_cts, & tt$m_ds_dsr, & tt$m_ds_dtr, & tt$m_ds_ring, & tt$m_ds_rts, & tt$m_ds_secrec, & tt$m_ds_sectx external sub & lib$signal common & quad sensemode_block, & setmode_block ******************************************************************************** Fragment of code which clears RTS, DTR, and SECTX, then tests DSR, RING, CARRIER, and SECREC. ******************************************************************************** idle_modem: ! DROP ALL MODEM SIGNALS setmode_block::word0 = 0% setmode_block::byte2 = 0% setmode_block::byte3 = tt$m_ds_rts or tt$m_ds_dtr or tt$m_ds_sectx setmode_block::long4 = 0% call set_modem ! WAIT FOR A MOMENT call timed_wait ("0 0:00:00.10") ! READ MODEM SIGNALS TO BE SURE IT'S IDLE call sense_modem call lib$signal by value (dia_notidle) if sensemode_block::byte2 and & (tt$m_ds_dsr or tt$m_ds_ring or tt$m_ds_carrier or tt$m_ds_secrec) return ******************************************************************************** Fragment of code which raises DTR and RTS. ******************************************************************************** dial_remote: ! RAISE DTR AND RTS setmode_block::word0 = 0% setmode_block::byte2 = tt$m_ds_rts or tt$m_ds_dtr setmode_block::byte3 = 0% setmode_block::long4 = 0% call set_modem ******************************************************************************** Subroutines SET_MODEM and SENSE_MODEM, which set signals according to the values stored in SETMODE_BLOCK ******************************************************************************** sub set_modem !---------------------------------------------------------------------- ! DECLARATIONS !---------------------------------------------------------------------- %include 'common' ! LOCAL STORAGE declare & long & s !---------------------------------------------------------------------- ! MAIN CODE !---------------------------------------------------------------------- s = sys$qiow (!efn!, modem_chan, io$_setmode or io$m_set_modem or & io$m_maint, x_iosb, !astadr!, !astprm!, loc (setmode_block), !p2!, & !p3!, !p4!, !p5!, !p6!) call lib$signal by value (dia_bugcheck, 1%, "Set_Modem" by desc, & dia_bugsta, 1%, "$QIOW" by desc, s) unless s and 1% call lib$signal by value (dia_bugcheck, 1%, "Set_Modem" by desc, & dia_bugsta, 1%, "$QIOW" by desc, x_iosb::s) unless x_iosb::s and 1% end sub 1 !---------------------------------------------------------------------- ! SENSE_MODEM.BAS SENSE MODEM CONTROL SIGNALS 26-FEB-1986 ! ! Edward K. McGuire ! Grinnell College ! Grinnell, IA 50112 ! ! DESCRIPTION ! This routine senses the state of the modem control signals. ! ! IMPLICIT INPUTS ! modem_chan Channel assigned to modem ! SIDE EFFECTS ! sensemode_block Overwritten by new modem control signal states ! !---------------------------------------------------------------------- sub sense_modem !---------------------------------------------------------------------- ! DECLARATIONS !---------------------------------------------------------------------- %include 'common' ! LOCAL STORAGE declare & long & s, & iosb & sense_iosb !---------------------------------------------------------------------- ! CODE SECTION !---------------------------------------------------------------------- s = sys$qiow (!efn!, modem_chan, io$_sensemode or io$m_rd_modem, & sense_iosb, !astadr!, !astprm!, loc (sensemode_block), !p2!, & !p3!, !p4!, !p5!, !p6!) call lib$signal by value (dia_bugcheck, 1%, "SENSE_MODEM" by desc, & dia_bugsta, 1%, "$QIOW" by desc, s) unless s and 1% call lib$signal by value (dia_bugcheck, 1%, "SENSE_MODEM" by desc, & dia_bugsta, 1%, "$QIOW" by desc, sense_iosb::s) unless sense_iosb::s & and 1% %if %debug %then print "[Modem signals:"; print " DSR"; if sensemode_block::byte2 and tt$m_ds_dsr print " RING"; if sensemode_block::byte2 and tt$m_ds_ring print " CARRIER"; if sensemode_block::byte2 and tt$m_ds_carrier print " CTS"; if sensemode_block::byte2 and tt$m_ds_cts print " SECREC"; if sensemode_block::byte2 and tt$m_ds_secrec print "]" %end %if end sub ******************************************************************************** End of example ********************************************************************************