From fdeb2f3f0f6ca19cb93c36c0b11235a724e55b9a Mon Sep 17 00:00:00 2001 From: skarg Date: Tue, 20 Oct 2009 17:25:17 +0000 Subject: [PATCH] Changed RS485 interface to allow lower/upper case for Win32. --- bacnet-stack/ports/win32/rs485.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bacnet-stack/ports/win32/rs485.c b/bacnet-stack/ports/win32/rs485.c index 4a73636c..392fe262 100644 --- a/bacnet-stack/ports/win32/rs485.c +++ b/bacnet-stack/ports/win32/rs485.c @@ -47,9 +47,9 @@ #include #include #include +#include #include "mstp.h" #include "dlmstp.h" - #define WIN32_LEAN_AND_MEAN #define STRICT 1 #include @@ -83,6 +83,20 @@ static DWORD RS485_DTRControl = DTR_CONTROL_DISABLE; RTS_CONTROL_HANDSHAKE, RTS_CONTROL_TOGGLE */ static DWORD RS485_RTSControl = RTS_CONTROL_DISABLE; +/**************************************************************************** +* DESCRIPTION: Change the characters in a string to uppercase +* RETURN: nothing +* ALGORITHM: none +* NOTES: none +*****************************************************************************/ +void strupper(char *str) +{ + char *p; + for (p = str; *p != '\0'; ++p) { + *p = toupper(*p); + } +} + /**************************************************************************** * DESCRIPTION: Initializes the RS485 hardware and variables, and starts in * receive mode. @@ -97,6 +111,7 @@ void RS485_Set_Interface( for CreateFile. The syntax also works for COM ports 1-9. */ /* http://support.microsoft.com/kb/115831 */ if (ifname) { + strupper(ifname); if (strncmp("COM", ifname, 3) == 0) { if (strlen(ifname) > 3) { sprintf(RS485_Port_Name, "\\\\.\\COM%i", atoi(ifname + 3));