home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / msk314.pkz / MODEMS / PPI.SCR < prev    next >
Text File  |  1995-06-17  |  7KB  |  194 lines

  1. ; FILE PPI.SCR (MSMPPI.SCR)
  2. ;
  3. ; MS-DOS Kermit script program for dialing Practical Peripherals from V.22bis
  4. ; to V.34, that have error correction and compression.  To be used with MS-DOS
  5. ; Kermit 3.12 or later.  The modem is set up for compression, error
  6. ; correction, all types of fallback.  RTS/CTS flow control, fixed interface
  7. ; speed of 115200, 57600, 38400, or 9600 bps depending on the modem model.
  8. ;
  9. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, June 1993
  10. ; Revised: December 1993 to accommodate the 9600bps models;
  11. ;   Acknowledgements to David Zakai of SUNY-Health Science Center
  12. ;   at Brooklyn for info about them and debugging help.
  13. ; Revised: June 1995 for V.22bis and V.FC models.
  14. ;
  15. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  16. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  17.  
  18. define chkerr if fail stop 1 \%1
  19. define chkok input 3 OK, if fail stop 1 \%1
  20.  
  21. ; Macro to try to get attention of modem's command processor
  22. ; at the given speed, or if no speed given, at the current speed.
  23. ;
  24. define atok -
  25.  if not def \%1 assign \%1 \v(speed), -
  26.  set speed \%1, -
  27.  echo Trying \%1..., -
  28.  output ATQ0V1\13, -
  29.  input 3 OK, -
  30.  end \v(status)
  31.  
  32. set input echo on        ; So we can watch what happens.
  33. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  34. set input case ignore        ; Use caseless string comparisons
  35.  
  36. set parity none            ; Avoid parity foulups
  37. set flow none            ; Avoid flow control deadlocks
  38. hangup                ; Begin by dropping DTR
  39. pause 1                ; for one second
  40.  
  41. atok 38400            ; Look for OK response at 38400 bps
  42. if fail atok 9600        ; Fall back to 9600 bps
  43. if fail stop 1 Can't get modem's attention
  44.  
  45. output AT E1 L0 W1 S95=47 &D2 X4\13 ; Set up echoing, result codes, etc.
  46. chkok {Can't initialize modem}      ; L0 soothes the raucous speaker.
  47.  
  48. ; Now see which Practical Peripherals model we have.
  49. ;
  50. output ATI3\13                ; Issue model query
  51. input 5 OK
  52. if fail stop 1 Can't get modem model info!
  53. reinput 0 PM14400            ; PM14400FXSA or PM14400FXMT
  54.   if success goto PP14400
  55. reinput 0 PM288MT            ; PM288MT II V.FC
  56.   if success goto PP288MT
  57. reinput 0 PM9600FXMT            ; PM9600FXMT
  58.   if success goto PP9600FX
  59. reinput 0 PM9600            ; PM9600 or PM9600SA
  60.   if success goto PP9600SA
  61. reinput 0 PM2400
  62.   if success goto PM2400
  63.  
  64. echo Unknown Practical Peripherals Modem model, trying anyway...
  65. ;
  66. ; NOTE: The following might actually be OK for all models.
  67. ;
  68. define _modcmd S37=0 N1
  69. goto config
  70.  
  71. ; Model-specific items...
  72.  
  73. :PP9600SA
  74. atok 38400            ; Highest interface speed is 38400
  75. if fail stop 1 No response at 38400 bps!
  76. echo Configuring PP9600 or PP9600SA...
  77. define _modcmd S37=9 N1        ; Highest modulation speed is V.32 = 9600
  78. goto config
  79.  
  80. :PP9600FX
  81. atok 57600            ; Highest interface speed is 57600
  82. if fail stop 1 No response at 57600 bps!
  83. echo Configuring PP9600FXMT...
  84. define _modcmd S37=9 N1        ; Highest modulation speed is V.32 = 9600
  85. goto config
  86.  
  87. :PP14400
  88. atok 57600            ; Highest interface speed is 57600
  89. if fail stop 1 No response at 57600 bps!
  90. echo Configuring PP14400FXMT or SA...
  91. define _modcmd S37=11 N1    ; Highest modulation speed is V.32bis = 14400
  92. goto config
  93.  
  94. :PM2400
  95. echo Configuring PM2400
  96. define _modcmd S37=6 N1        ; Highest modulation speed is V.22bis = 2400
  97. goto config
  98.  
  99. :PP288MT
  100. atok 115200                     ; Highest interface speed is 115200
  101. if fail atok 57600
  102. echo Configuring PP28800MT...
  103. define _modcmd S37=15 N1  ; Highest modulation speed is V.34/V.FC = 28800
  104.  
  105. :CONFIG
  106. echo Enabling modulation negotiation...
  107. output AT \m(_modcmd)\13    ; Issue the modulation setup command
  108. chkok {Can't enable modulation speed negotiation}
  109. define _modcmd
  110. echo Enabling hardware flow control...
  111. output AT &K3\13        ; Enable RTS/CTS hardware flow control
  112. chkok {Can't enable RTS/CTS}    ; On modem
  113. wait 5 cts
  114. if fail errfail {Modem is not asserting CTS!}
  115. set flow rts/cts        ; And in Kermit too, but only now
  116. echo Configuring modem to ignore BREAK...
  117. output AT S82=128\13        ; Make modem ignore BREAK
  118. chkok {Can't become transparent to BREAK}
  119. echo Enabling error correction and data compression...
  120. output AT &Q5 S36=7 S46=2\13    ; Enable error correction & compression
  121.                 ; with automatic speed buffering 
  122. chkok {Can't enable compression EC and fallback}
  123.  
  124. if def \%1 if not equal "\%1" "=" goto BEGIN
  125. echo Modem initialization complete, no number to dial
  126. end 0
  127.  
  128. :BEGIN                ; Now DIAL.
  129. clear                ; Clear INPUT buffer.
  130. set count 5                     ; Dialing retry counter, 5 tries allowed.
  131. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  132. echo
  133. pause 1
  134. goto dial                       ; 1st time, skip pause and Redialing message
  135.  
  136. :REDIAL
  137. set alarm 30
  138. pause 30            ; Wait 30 seconds before redialing.
  139. if not alarm errfail {Dialing canceled.}
  140. echo Redialing...               ; Message for redialing.
  141. pause 1
  142.  
  143. :DIAL
  144. output ATD\%1\13                ; Dial the number.
  145. set alarm 90            ; (For detecting keyboard interruptions.)
  146. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  147. if < VERSION 313 clear
  148. input 30 \10                    ; Wait for the linefeeds...
  149.  
  150. :GETMSG
  151. input 60 \10            ; ...that surround the response message.
  152. if success goto gotmsg        ; Got a message.
  153. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  154. hangup                ; User interrupted from keyboard,
  155. output \13            ; cancel dialing by sending carriage return,
  156. goto again            ; and go try again right away.
  157.  
  158. :GOTMSG
  159. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  160. if success goto done            ; If so, we're done.
  161. reinput 1 BUSY            ; Line is busy.
  162. if success goto busy        ; Go wait a while and then dial again.
  163. reinput 1 ERROR            ; Command syntax error.
  164. if success errfail {Dialing command error}
  165. reinput 1 NO CARRIER        ; Phone didn't answer or no carrier.
  166. if success errfail {No answer or no carrier}
  167. reinput 1 NO DIALTONE        ; No dialtone when phone taken off hook.
  168. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  169. goto getmsg            ; None of the above, get another message.
  170.  
  171. :BUSY
  172. if < \v(count) 2 goto quit    ; Don't wait 30 seconds if tries are used up.
  173. Echo Line is busy, will dial again in 30 seconds
  174. echo Press any key to cancel...
  175. output \13            ; CR cancels dialing
  176. hangup                          ; Hang up.
  177. :AGAIN
  178. if count goto redial            ; Then go redial.
  179. :QUIT
  180. errfail {It never answers!  I give up.} ; Too many tries.
  181.  
  182. :DONE                           ; Connected.
  183. echo \7                         ; Celebrate with a beep.
  184. define errfail            ; Erase local macro definitions...
  185. define _modcmd
  186. end 0                ; Finished, return success code.
  187.  
  188. :FAIL                ; Dialing failed, no beep.
  189. define errfail            ; Erase local macro definitions...
  190. define _modcmd
  191. end 1                ; Return failure code.
  192.  
  193. ; End of PPI.SCR
  194.