[Com0com-cvs] hub4com/plugins/serial comio.cpp, 1.7, 1.8 comport.cpp, 1.10, 1.11
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
From: Vyacheslav F. <vf...@us...> - 2008-08-29 13:02:43
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27988/serial Modified Files: comio.cpp comport.cpp Log Message: Added ESC_OPTS_MAP_EO2GO() and ESC_OPTS_MAP_GO2EO() Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** comport.cpp 28 Aug 2008 16:07:09 -0000 1.10 --- comport.cpp 29 Aug 2008 13:02:37 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2008/08/29 13:02:37 vfrolov + * Added ESC_OPTS_MAP_EO2GO() and ESC_OPTS_MAP_GO2EO() + * * Revision 1.10 2008/08/28 16:07:09 vfrolov * Tracing of HUB_MSG_TYPE_SET_PIN_STATE moved to the trace filter *************** *** 182,208 **** }; static void WarnIgnoredInOptions( const char *pHead, const char *pTail, ! DWORD options, ! BYTE optsMst, ! BYTE optsLsr) { ! if (optsMst) { ! cerr << pHead << " WARNING: Changing of MODEM STATUS bit(s) 0x" ! << hex << (unsigned)optsMst << dec << " [" ! << FieldToName(codeNameTableModemStatus, optsMst) << "] will be ignored by driver" << pTail << endl; } ! if (optsLsr) { ! cerr << pHead << " WARNING: Changing of LINE STATUS bit(s) 0x" ! << hex << (unsigned)optsLsr << dec << " [" ! << FieldToName(codeNameTableLineStatus, optsLsr) << "] will be ignored by driver" << pTail << endl; } ! cerr << pHead << " WARNING: Requested option(s) 0x" ! << hex << options << dec << " will be ignored by driver" << pTail << endl; } --- 185,227 ---- }; + static FIELD2NAME codeNameTableGoOptions[] = { + TOFIELD2NAME2(GO_, RBR_STATUS), + TOFIELD2NAME2(GO_, RLC_STATUS), + TOFIELD2NAME2(GO_, BREAK_STATUS), + TOFIELD2NAME2(GO_, ESCAPE_MODE), + {0, 0, NULL} + }; + static void WarnIgnoredInOptions( const char *pHead, const char *pTail, ! DWORD goOptions, ! DWORD otherOptions) { ! if (GO_O2V_MODEM_STATUS(goOptions)) { ! cerr << pHead << " WARNING: Changing of MODEM STATUS bit(s) [" ! << FieldToName(codeNameTableModemStatus, GO_O2V_MODEM_STATUS(goOptions)) << "] will be ignored by driver" << pTail << endl; } ! if (GO_O2V_LINE_STATUS(goOptions)) { ! cerr << pHead << " WARNING: Changing of LINE STATUS bit(s) [" ! << FieldToName(codeNameTableLineStatus, GO_O2V_LINE_STATUS(goOptions)) << "] will be ignored by driver" << pTail << endl; } ! goOptions &= ~(GO_V2O_MODEM_STATUS(-1) | GO_V2O_LINE_STATUS(-1)); ! ! if (goOptions) { ! cerr << pHead << " WARNING: Requested option(s) [" ! << FieldToName(codeNameTableGoOptions, goOptions) ! << "] will be ignored by driver" << pTail << endl; ! } ! ! if (otherOptions) { ! cerr << pHead << " WARNING: Requested option(s) [0x" ! << hex << otherOptions << dec ! << "] will be ignored by driver" << pTail << endl; ! } } *************** *** 233,253 **** msg.type = HUB_MSG_TYPE_GET_ESC_OPTS; msg.u.pv.pVal = &escapeOptions; pOnRead(hHub, hMasterPort, &msg); escapeOptions = SetEscMode(handle, escapeOptions, &pBuf, &done); if ((escapeOptions & ESC_OPTS_V2O_ESCCHAR(-1)) == 0) { InOptionsAdd(GO_ESCAPE_MODE); ! if (escapeOptions) { ! WarnIgnoredInOptions(name.c_str(), " (escape mode)", ! escapeOptions, ! ESC_OPTS_O2V_MST(escapeOptions), ! ESC_OPTS_O2V_LSR(escapeOptions)); ! ! msg.type = HUB_MSG_TYPE_FAIL_ESC_OPTS; ! msg.u.val = escapeOptions; ! pOnRead(hHub, hMasterPort, &msg); ! } } } --- 252,272 ---- msg.type = HUB_MSG_TYPE_GET_ESC_OPTS; msg.u.pv.pVal = &escapeOptions; + msg.u.pv.val = 0; pOnRead(hHub, hMasterPort, &msg); escapeOptions = SetEscMode(handle, escapeOptions, &pBuf, &done); + if (escapeOptions & ~ESC_OPTS_V2O_ESCCHAR(-1)) { + WarnIgnoredInOptions(name.c_str(), " (requested for escape mode)", + ESC_OPTS_MAP_EO2GO(escapeOptions), + escapeOptions & ~(ESC_OPTS_MAP_GO2EO(-1) | ESC_OPTS_V2O_ESCCHAR(-1))); + } + if ((escapeOptions & ESC_OPTS_V2O_ESCCHAR(-1)) == 0) { InOptionsAdd(GO_ESCAPE_MODE); ! msg.type = HUB_MSG_TYPE_FAIL_ESC_OPTS; ! msg.u.val = escapeOptions; ! pOnRead(hHub, hMasterPort, &msg); } } *************** *** 275,284 **** DWORD fail_options = (intercepted_options & ~InOptions()); ! if (fail_options) { ! WarnIgnoredInOptions(name.c_str(), "", ! fail_options, ! GO_O2V_MODEM_STATUS(fail_options), ! GO_O2V_LINE_STATUS(fail_options)); ! } msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; --- 294,299 ---- DWORD fail_options = (intercepted_options & ~InOptions()); ! if (fail_options) ! WarnIgnoredInOptions(name.c_str(), "", fail_options, 0); msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; *************** *** 592,602 **** if (::GetCommModemStatus(handle, &stat)) { - /* - cout << name << " MODEM STATUS bit(s): 0x" - << hex << stat << dec << " [" - << FieldToName(codeNameTableModemStatus, stat) - << "]" << endl; - */ - HUB_MSG msg; --- 607,610 ---- Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** comio.cpp 26 Aug 2008 14:23:31 -0000 1.7 --- comio.cpp 29 Aug 2008 13:02:37 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2008/08/29 13:02:37 vfrolov + * Added ESC_OPTS_MAP_EO2GO() and ESC_OPTS_MAP_GO2EO() + * * Revision 1.7 2008/08/26 14:23:31 vfrolov * Added ability to SetEscMode() return LSR and MST for non com0com ports *************** *** 329,345 **** #define LINE_STATUS_BITS (LINE_STATUS_OE|LINE_STATUS_PE|LINE_STATUS_FE|LINE_STATUS_BI|LINE_STATUS_FIFOERR) ! if (escOptions & ESC_OPTS_V2O_MST(MODEM_STATUS_BITS)) opts |= C0CE_INSERT_ENABLE_MST; ! if (escOptions & ESC_OPTS_BREAK_STATUS) opts |= C0CE_INSERT_ENABLE_LSR_BI; ! if (escOptions & ESC_OPTS_V2O_LSR(LINE_STATUS_BITS)) opts |= C0CE_INSERT_ENABLE_LSR; ! if (escOptions & ESC_OPTS_RBR_STATUS) opts |= C0CE_INSERT_ENABLE_RBR; ! if (escOptions & ESC_OPTS_RLC_STATUS) opts |= C0CE_INSERT_ENABLE_RLC; --- 332,348 ---- #define LINE_STATUS_BITS (LINE_STATUS_OE|LINE_STATUS_PE|LINE_STATUS_FE|LINE_STATUS_BI|LINE_STATUS_FIFOERR) ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_V2O_MODEM_STATUS(MODEM_STATUS_BITS))) opts |= C0CE_INSERT_ENABLE_MST; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_BREAK_STATUS)) opts |= C0CE_INSERT_ENABLE_LSR_BI; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_V2O_LINE_STATUS(LINE_STATUS_BITS))) opts |= C0CE_INSERT_ENABLE_LSR; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_RBR_STATUS)) opts |= C0CE_INSERT_ENABLE_RBR; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_RLC_STATUS)) opts |= C0CE_INSERT_ENABLE_RLC; *************** *** 410,426 **** if (opts & C0CE_INSERT_ENABLE_MST) ! escOptions &= ~ESC_OPTS_V2O_MST(MODEM_STATUS_BITS); if (opts & C0CE_INSERT_ENABLE_LSR_BI) ! escOptions &= ~ESC_OPTS_BREAK_STATUS; if (opts & C0CE_INSERT_ENABLE_LSR) ! escOptions &= ~ESC_OPTS_V2O_LSR(LINE_STATUS_BITS & ~LINE_STATUS_BI); if (opts & C0CE_INSERT_ENABLE_RBR) ! escOptions &= ~ESC_OPTS_RBR_STATUS; if (opts & C0CE_INSERT_ENABLE_RLC) ! escOptions &= ~ESC_OPTS_RLC_STATUS; return escOptions & ~ESC_OPTS_V2O_ESCCHAR(-1); --- 413,429 ---- if (opts & C0CE_INSERT_ENABLE_MST) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_V2O_MODEM_STATUS(MODEM_STATUS_BITS)); if (opts & C0CE_INSERT_ENABLE_LSR_BI) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_BREAK_STATUS); if (opts & C0CE_INSERT_ENABLE_LSR) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_V2O_LINE_STATUS(LINE_STATUS_BITS & ~LINE_STATUS_BI)); if (opts & C0CE_INSERT_ENABLE_RBR) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_RBR_STATUS); if (opts & C0CE_INSERT_ENABLE_RLC) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_RLC_STATUS); return escOptions & ~ESC_OPTS_V2O_ESCCHAR(-1); |