diff --git a/apps/whois/main.c b/apps/whois/main.c index c25b2d6e..fb0dd9af 100644 --- a/apps/whois/main.c +++ b/apps/whois/main.c @@ -365,7 +365,6 @@ int main(int argc, char *argv[]) if (getenv("BACNET_DEBUG")) { BACnet_Debug_Enabled = true; } - timeout_milliseconds = apdu_timeout(); /* decode any command line parameters */ filename = filename_remove_path(argv[0]); for (argi = 1; argi < argc; argi++) { @@ -481,6 +480,9 @@ int main(int argc, char *argv[]) address_init(); dlenv_init(); atexit(datalink_cleanup); + if (timeout_milliseconds == 0) { + timeout_milliseconds = apdu_timeout() * apdu_retries(); + } mstimer_set(&apdu_timer, timeout_milliseconds); mstimer_set(&datalink_timer, 1000); /* send the request */ diff --git a/ports/linux/dlmstp.c b/ports/linux/dlmstp.c index 4cfd5c0e..59ed895a 100644 --- a/ports/linux/dlmstp.c +++ b/ports/linux/dlmstp.c @@ -773,6 +773,7 @@ bool dlmstp_init(char *ifname) fprintf(stderr, "MS/TP MAC: %02X\n", MSTP_Port.This_Station); fprintf(stderr, "MS/TP Max_Master: %02X\n", MSTP_Port.Nmax_master); fprintf(stderr, "MS/TP Max_Info_Frames: %u\n", MSTP_Port.Nmax_info_frames); + fflush(stderr); #endif /* start the threads */ /* rv = pthread_create(&hThread, NULL, dlmstp_receive_fsm_task, NULL); */ diff --git a/ports/linux/rs485.c b/ports/linux/rs485.c index 858c7801..8620ed0e 100644 --- a/ports/linux/rs485.c +++ b/ports/linux/rs485.c @@ -547,7 +547,9 @@ void RS485_Initialize(void) struct serial_struct newserial; float baud_error = 0.0; - printf("RS485: Initializing %s", RS485_Port_Name); +#if PRINT_ENABLED + fprintf(stdout, "RS485 Interface: %s\n", RS485_Port_Name); +#endif /* Open device for reading and writing. Blocking mode - more CPU effecient @@ -600,14 +602,17 @@ void RS485_Initialize(void) 76800); if ((newserial.custom_divisor == 0) || (baud_error > 0.02)) { /* bad divisor */ - fprintf(stderr, "bad custom divisor %d, base baud %d\n", + fprintf(stderr, "RS485 bad custom divisor %d, base baud %d\n", newserial.custom_divisor, newserial.baud_base); exit(EXIT_FAILURE); } /* if all goes well, set new divisor */ ioctl(RS485_Handle, TIOCSSERIAL, &newserial); } - printf(" at Baud Rate %u", RS485_Get_Baud_Rate()); +#if PRINT_ENABLED + fprintf(stdout, "RS485 Baud Rate %u\n", RS485_Get_Baud_Rate()); + fflush(stdout); +#endif /* destructor */ atexit(RS485_Cleanup); /* flush any data waiting */ @@ -615,7 +620,6 @@ void RS485_Initialize(void) tcflush(RS485_Handle, TCIOFLUSH); /* ringbuffer */ FIFO_Init(&Rx_FIFO, Rx_Buffer, sizeof(Rx_Buffer)); - printf("=success!\n"); } /* Print in a format for Wireshark ExtCap */ @@ -632,7 +636,7 @@ void RS485_Print_Ports(void) bool valid_port = false; struct serial_struct serinfo; - /* Scan through /sys/class/tty - + /* Scan through /sys/class/tty - it contains all tty-devices in the system */ n = scandir(sysdir, &namelist, NULL, NULL); if (n < 0) { diff --git a/ports/win32/rs485.c b/ports/win32/rs485.c index 01fc1774..abb51ba0 100644 --- a/ports/win32/rs485.c +++ b/ports/win32/rs485.c @@ -266,7 +266,7 @@ void RS485_Initialize(void) 0, OPEN_EXISTING, /*FILE_FLAG_OVERLAPPED */ 0, 0); if (RS485_Handle == INVALID_HANDLE_VALUE) { - fprintf(stderr, "Unable to open %s\n", RS485_Port_Name); + fprintf(stderr, "RS485 unable to open %s\n", RS485_Port_Name); RS485_Print_Error(); exit(1); } @@ -276,6 +276,8 @@ void RS485_Initialize(void) RS485_Configure_Status(); #if PRINT_ENABLED fprintf(stdout, "RS485 Interface: %s\n", RS485_Port_Name); + fprintf(stdout, "RS485 Baud Rate %u\n", RS485_Get_Baud_Rate()); + fflush(stdout); #endif atexit(RS485_Cleanup);