[Com0com-cvs] com0com/setup params.cpp, 1.20, 1.21 params.h, 1.11, 1.12 setup.cpp, 1.50, 1.51
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
From: Vyacheslav F. <vf...@us...> - 2011-12-27 11:38:15
|
Update of /cvsroot/com0com/com0com/setup In directory vz-cvs-4.sog:/tmp/cvs-serv22310 Modified Files: params.cpp params.h setup.cpp Log Message: Superseded incorrect PortParameters::ClassChanged() Index: params.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** params.h 15 Dec 2011 15:51:48 -0000 1.11 --- params.h 27 Dec 2011 11:38:13 -0000 1.12 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.12 2011/12/27 11:38:13 vfrolov + * Superseded incorrect PortParameters::ClassChanged() + * * Revision 1.11 2011/12/15 15:51:48 vfrolov * Fixed types *************** *** 72,76 **** bool FillPortName(char *pPortName, int size); bool Changed() const { return maskChanged != 0; } - bool ClassChanged() const { return classChanged; } bool DialogRequested() const { return dialogRequested; } --- 75,78 ---- *************** *** 90,94 **** bool SetBit(const char *pVal, const Bit &bit); - bool classChanged; bool dialogRequested; DWORD maskChanged; --- 92,95 ---- Index: params.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** params.cpp 15 Dec 2011 15:51:48 -0000 1.20 --- params.cpp 27 Dec 2011 11:38:13 -0000 1.21 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.21 2011/12/27 11:38:13 vfrolov + * Superseded incorrect PortParameters::ClassChanged() + * * Revision 1.20 2011/12/15 15:51:48 vfrolov * Fixed types *************** *** 164,168 **** addRITO = 0; - classChanged = FALSE; dialogRequested = FALSE; maskChanged = 0; --- 167,170 ---- *************** *** 177,182 **** else if (lstrcmpi(portName, pNewPortName) != 0) { - classChanged = ((lstrcmpi(C0C_PORT_NAME_COMCLASS, portName) == 0) != - (lstrcmpi(C0C_PORT_NAME_COMCLASS, pNewPortName) == 0)); maskChanged |= m_portName; SNPRINTF(portName, sizeof(portName)/sizeof(portName[0]), "%s", pNewPortName); --- 179,182 ---- *************** *** 918,927 **** "used to invert the value.\n" "\n" - "If <portname> above is '" C0C_PORT_NAME_COMCLASS "' then the Ports class installer will be used to\n" - "manage port name. The Ports class installer selects the COM port number and\n" - "sets the port name to COM<n>, where <n> is the selected port number.\n" - "Use 'PortName=?' to invoke the system-supplied advanced settings dialog box to\n" - "change the port number.\n" - "\n" "Special values:\n" " - - use driver's default value\n" --- 918,921 ---- Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** setup.cpp 23 Dec 2011 05:37:21 -0000 1.50 --- setup.cpp 27 Dec 2011 11:38:13 -0000 1.51 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.51 2011/12/27 11:38:13 vfrolov + * Superseded incorrect PortParameters::ClassChanged() + * * Revision 1.50 2011/12/23 05:37:21 vfrolov * Implemented setting friendly names for ports *************** *** 286,289 **** --- 289,297 ---- static bool show_fnames = FALSE; /////////////////////////////////////////////////////////////// + bool IsComClass(const char *pPortName) + { + return lstrcmpi(pPortName, C0C_PORT_NAME_COMCLASS) == 0; + } + /////////////////////////////////////////////////////////////// static CNC_ENUM_FILTER EnumFilter; static bool EnumFilter(const char *pHardwareId) *************** *** 497,501 **** Trace(" %s FriendlyName=\"%s\"\n", phPortName, friendlyNameOld); ! if (lstrcmpi(C0C_PORT_NAME_COMCLASS, portName) == 0) return; --- 505,509 ---- Trace(" %s FriendlyName=\"%s\"\n", phPortName, friendlyNameOld); ! if (IsComClass(portName)) return; *************** *** 581,630 **** } /////////////////////////////////////////////////////////////// - /* - static int SleepTillPortNotFound( - const char *pPortName, - int timeLimit) - { - if (lstrcmpi(C0C_PORT_NAME_COMCLASS, pPortName) == 0) - return 0; - - if (int(DWORD(timeLimit * 1000)/1000) != timeLimit) - timeLimit = -1; - - DWORD startTime = GetTickCount(); - char path[40]; - - SNPRINTF(path, sizeof(path)/sizeof(path[0]), "\\\\.\\%s", pPortName); - - Trace("Wating for %s ", path); - - for (;;) { - HANDLE handle = CreateFile(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, - OPEN_EXISTING, 0, NULL); - - if (handle == INVALID_HANDLE_VALUE) { - if (GetLastError() != ERROR_FILE_NOT_FOUND) - break; - } else { - CloseHandle(handle); - break; - } - - Trace("."); - - if (timeLimit != -1 && GetTickCount() - startTime >= DWORD(timeLimit * 1000)) { - Trace(" timeout\n"); - return -1; - } - - Sleep(1000); - } - - Trace(". OK\n"); - - return int((GetTickCount() - startTime) / 1000); - } - */ - /////////////////////////////////////////////////////////////// static VOID CleanDevPropertiesStack( Stack &stack, --- 589,592 ---- *************** *** 724,729 **** if (!Silent() && portParameters.DialogRequested()) { ! if (lstrcmpi(C0C_PORT_NAME_COMCLASS, portName) == 0) { ! if (!portParameters.ClassChanged()) { DevProperties devProperties; if (!devProperties.DevId(C0C_PORT_DEVICE_ID)) --- 686,691 ---- if (!Silent() && portParameters.DialogRequested()) { ! if (IsComClass(portName)) { ! if (IsComClass(portNameOld)) { DevProperties devProperties; if (!devProperties.DevId(C0C_PORT_DEVICE_ID)) *************** *** 761,766 **** return FALSE; ! if (portParameters.ClassChanged()) { ! Trace("Changed port class for %s (%s -> %s)\n", phPortName, portNameOld, portName); DisableDevices(EnumFilter, &devProperties, pRebootRequired, NULL); // show msg if in use RemoveDevices(EnumFilter, &devProperties, pRebootRequired); --- 723,728 ---- return FALSE; ! if (IsComClass(portName) != IsComClass(portNameOld)) { ! Trace("Changed port class for %s (renamed %s to %s)\n", phPortName, portNameOld, portName); DisableDevices(EnumFilter, &devProperties, pRebootRequired, NULL); // show msg if in use RemoveDevices(EnumFilter, &devProperties, pRebootRequired); *************** *** 1256,1261 **** } ! if (lstrcmpi(portName[0], portName[1]) == 0 && ! lstrcmpi(portName[0], C0C_PORT_NAME_COMCLASS) != 0 && ShowMsg(MB_OKCANCEL|MB_ICONWARNING, "The same port name %s is used for both ports.\n", --- 1218,1222 ---- } ! if (lstrcmpi(portName[0], portName[1]) == 0 && !IsComClass(portName[0]) && ShowMsg(MB_OKCANCEL|MB_ICONWARNING, "The same port name %s is used for both ports.\n", *************** *** 1270,1292 **** ComDbSync(EnumFilter); - /* - if (timeout > 0 && !no_update) { - if (WaitNoPendingInstallEvents(timeout)) { - timeout = 0; - } else { - for (int j = 0 ; j < 2 ; j++) { - int timeElapsed = SleepTillPortNotFound(portName[j], timeout); - - if (timeElapsed < 0 || timeout < timeElapsed) { - timeout = 0; - break; - } - - timeout -= timeElapsed; - } - } - } - */ - return TRUE; --- 1231,1234 ---- *************** *** 1833,1836 **** --- 1775,1787 ---- ConsoleWrite( "\n" + "If parameter 'PortName=" C0C_PORT_NAME_COMCLASS "' is used then the Ports class installer will be\n" + "invoked to set the real port name. The Ports class installer selects the COM\n" + "port number and sets the real port name to COM<n>, where <n> is the selected\n" + "port number. Use parameter 'PortName=?' to invoke the system-supplied advanced\n" + "settings dialog box to change the real port name.\n" + ); + + ConsoleWrite( + "\n" "Examples:\n" ); *************** *** 1854,1857 **** --- 1805,1814 ---- , pProgName, (pProgName && *pProgName) ? " " : ""); ConsoleWrite( + " %s%schange " C0C_PREF_PORT_NAME_A "0 PortName=-\n" + , pProgName, (pProgName && *pProgName) ? " " : ""); + ConsoleWrite( + " %s%schange " C0C_PREF_PORT_NAME_A "0 PortName=?\n" + , pProgName, (pProgName && *pProgName) ? " " : ""); + ConsoleWrite( " %s%slist\n" , pProgName, (pProgName && *pProgName) ? " " : ""); |