@@ -697,10 +697,10 @@ if (lp->loopback)
697
697
return loop_write (lp , & (lp -> txb [i ]), length );
698
698
699
699
if (lp -> serport ) { /* serial port connection? */
700
- if (sim_gtime () < lp -> txnexttime )
700
+ if (( sim_gtime () < lp -> txnexttime ) && ( sim_is_running ) )
701
701
return 0 ;
702
702
written = sim_write_serial (lp -> serport , & (lp -> txb [i ]), length );
703
- if (written > 0 )
703
+ if (( written > 0 ) && ( sim_is_running ) )
704
704
lp -> txnexttime = floor (sim_gtime () + (written * lp -> txdelta * sim_timer_inst_per_sec ()));
705
705
return written ;
706
706
}
@@ -2724,7 +2724,9 @@ while (*tptr) {
2724
2724
sim_control_serial (lp -> serport , TMXR_MDM_DTR |TMXR_MDM_RTS , 0 , NULL );
2725
2725
lp -> cnms = sim_os_msec (); /* record time of connection */
2726
2726
if (sim_switches & SWMASK ('V' )) { /* -V flag reports connection on port */
2727
- sim_os_ms_sleep (TMXR_DTR_DROP_TIME );
2727
+ sim_os_ms_sleep (TMXR_DTR_DROP_TIME ); /* Wait for DTR to be noticed */
2728
+ lp -> ser_connect_pending = FALSE; /* Mark line as ready for action */
2729
+ lp -> conn = TRUE;
2728
2730
tmxr_report_connection (mp , lp ); /* report the connection to the line */
2729
2731
}
2730
2732
}
@@ -2833,7 +2835,9 @@ while (*tptr) {
2833
2835
sim_control_serial (lp -> serport , TMXR_MDM_DTR |TMXR_MDM_RTS , 0 , NULL );
2834
2836
lp -> cnms = sim_os_msec (); /* record time of connection */
2835
2837
if (sim_switches & SWMASK ('V' )) { /* -V flag reports connection on port */
2836
- sim_os_ms_sleep (TMXR_DTR_DROP_TIME );
2838
+ sim_os_ms_sleep (TMXR_DTR_DROP_TIME ); /* Wait for DTR to be noticed */
2839
+ lp -> ser_connect_pending = FALSE; /* Mark line as ready for action */
2840
+ lp -> conn = TRUE;
2837
2841
tmxr_report_connection (mp , lp ); /* report the connection to the line */
2838
2842
}
2839
2843
}
@@ -3661,6 +3665,9 @@ t_stat tmxr_attach_ex (TMXR *mp, UNIT *uptr, CONST char *cptr, t_bool async)
3661
3665
t_stat r ;
3662
3666
int32 i ;
3663
3667
3668
+ if (mp -> dptr == NULL ) /* has device been set? */
3669
+ mp -> dptr = find_dev_from_unit (uptr ); /* no, so set device now */
3670
+
3664
3671
r = tmxr_open_master (mp , cptr ); /* open master socket */
3665
3672
if (r != SCPE_OK ) /* error? */
3666
3673
return r ;
@@ -3681,9 +3688,6 @@ if (!async || (uptr->flags & TMUF_NOASYNCH)) /* if asynch disabled */
3681
3688
uptr -> dynflags |= TMUF_NOASYNCH ; /* tag as no asynch */
3682
3689
#endif
3683
3690
3684
- if (mp -> dptr == NULL ) /* has device been set? */
3685
- mp -> dptr = find_dev_from_unit (uptr ); /* no, so set device now */
3686
-
3687
3691
if (mp -> dptr ) {
3688
3692
for (i = 0 ; i < mp -> lines ; i ++ ) {
3689
3693
mp -> ldsc [i ].expect .dptr = mp -> dptr ;
0 commit comments