com0com-cvs Mailing List for Null-modem emulator (Page 20)
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
You can subscribe to this list here.
2005 |
Jan
|
Feb
(7) |
Mar
|
Apr
|
May
(13) |
Jun
(18) |
Jul
(9) |
Aug
(10) |
Sep
(15) |
Oct
(6) |
Nov
(9) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(4) |
Mar
(4) |
Apr
(2) |
May
(7) |
Jun
(11) |
Jul
(6) |
Aug
(9) |
Sep
(1) |
Oct
(27) |
Nov
(22) |
Dec
(3) |
2007 |
Jan
(13) |
Feb
(16) |
Mar
(2) |
Apr
(3) |
May
(7) |
Jun
(17) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(20) |
Nov
(18) |
Dec
(1) |
2008 |
Jan
|
Feb
(3) |
Mar
(46) |
Apr
(40) |
May
(4) |
Jun
(9) |
Jul
(7) |
Aug
(62) |
Sep
(25) |
Oct
(51) |
Nov
(67) |
Dec
(81) |
2009 |
Jan
(13) |
Feb
(31) |
Mar
(12) |
Apr
|
May
(10) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(10) |
Oct
|
Nov
(3) |
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
|
May
(12) |
Jun
(9) |
Jul
(12) |
Aug
(7) |
Sep
(6) |
Oct
|
Nov
|
Dec
(1) |
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(11) |
Jun
|
Jul
(26) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(23) |
2012 |
Jan
(7) |
Feb
(3) |
Mar
|
Apr
|
May
(2) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Vyacheslav F. <vf...@us...> - 2008-08-20 14:57:18
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29647/plugins/serial Modified Files: comio.cpp comio.h comport.cpp comport.h port.cpp Log Message: Redesigned serial port options Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** comport.cpp 15 Aug 2008 12:44:59 -0000 1.6 --- comport.cpp 20 Aug 2008 14:30:19 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/08/20 14:30:19 vfrolov + * Redesigned serial port options + * * Revision 1.6 2008/08/15 12:44:59 vfrolov * Added fake read filter method to ports *************** *** 77,81 **** countXoff(0), filterX(FALSE), - events(0), maskOutPins(0), options(0), --- 80,83 ---- *************** *** 182,236 **** _ASSERTE(handle != INVALID_HANDLE_VALUE); ! BYTE optsLsr = GO_O2V_LINE_STATUS(options); ! BYTE optsMst = GO_O2V_MODEM_STATUS(options); ! if (optsLsr || optsMst) { ! if ((optsMst & MODEM_STATUS_CTS) != 0) events |= EV_CTS; ! if ((optsMst & MODEM_STATUS_DSR) != 0) events |= EV_DSR; ! if ((optsMst & MODEM_STATUS_DCD) != 0) events |= EV_RLSD; ! if ((optsMst & MODEM_STATUS_RI) != 0) events |= EV_RING; ! optsMst &= ~(MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI); ! if (optsMst) { ! cout << name << " WARNING: Changing of MODEM STATUS bit(s) 0x" ! << hex << (unsigned)optsMst << dec << " [" ! << FieldToName(codeNameTableModemStatus, optsMst) ! << "] will be ignored" << endl; ! } ! if (optsLsr) { ! cout << name << " WARNING: Changing of LINE STATUS bit(s) 0x" ! << hex << (unsigned)optsLsr << dec << " [" ! << FieldToName(codeNameTableLineStatus, optsLsr) ! << "] will be ignored" << endl; ! } } ! if (events) { ! if (!SetComEvents(handle, &events)) ! return FALSE; ! if (!StartWaitCommEvent()) return FALSE; cout << name << " Event(s) 0x" << hex << events << dec << " [" ! << FieldToName(codeNameTableComEvents, events) ! << "] will be monitired" << endl; } CheckComEvents(DWORD(-1)); ! if (!StartRead()) return FALSE; ! ! HUB_MSG msg; msg.type = HUB_MSG_TYPE_CONNECT; --- 184,256 ---- _ASSERTE(handle != INVALID_HANDLE_VALUE); ! DWORD events = 0; ! BYTE *pBuf = NULL; ! DWORD done = 0; ! if (options & GO_ESCAPE_MODE) { ! options = SetEscMode(handle, options, 'a'/*0xFF*/, &pBuf, &done); ! } else { ! if ((options & GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)) != 0) events |= EV_CTS; ! if ((options & GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)) != 0) events |= EV_DSR; ! if ((options & GO_V2O_MODEM_STATUS(MODEM_STATUS_DCD)) != 0) events |= EV_RLSD; ! if ((options & GO_V2O_MODEM_STATUS(MODEM_STATUS_RI)) != 0) events |= EV_RING; ! options &= ~GO_V2O_MODEM_STATUS( ! MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI); ! } ! BYTE optsMst = GO_O2V_MODEM_STATUS(options); ! if (optsMst) { ! cerr << name << " WARNING: Changing of MODEM STATUS bit(s) 0x" ! << hex << (unsigned)optsMst << dec << " [" ! << FieldToName(codeNameTableModemStatus, optsMst) ! << "] will be ignored" << endl; } ! BYTE optsLsr = GO_O2V_LINE_STATUS(options); ! if (optsLsr) { ! cerr << name << " WARNING: Changing of LINE STATUS bit(s) 0x" ! << hex << (unsigned)optsLsr << dec << " [" ! << FieldToName(codeNameTableLineStatus, optsLsr) ! << "] will be ignored" << endl; ! } ! ! HUB_MSG msg; ! ! if (options) { ! cerr << name << " WARNING: Requested option(s) 0x" ! << hex << options << dec << " will be ignored" << endl; ! ! msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; ! msg.u.val = options; ! pOnRead(hHub, hMasterPort, &msg); ! } ! ! if (events) { ! if (!SetComEvents(handle, &events) || !StartWaitCommEvent()) { ! pBufFree(pBuf); return FALSE; + } cout << name << " Event(s) 0x" << hex << events << dec << " [" ! << FieldToName(codeNameTableComEvents, events) ! << "] will be monitired" << endl; } CheckComEvents(DWORD(-1)); ! if (!StartRead()) { ! pBufFree(pBuf); return FALSE; ! } msg.type = HUB_MSG_TYPE_CONNECT; *************** *** 238,241 **** --- 258,269 ---- pOnRead(hHub, hMasterPort, &msg); + if (pBuf) { + msg.type = HUB_MSG_TYPE_LINE_DATA; + msg.u.buf.pBuf = pBuf; + msg.u.buf.size = done; + + pOnRead(hHub, hMasterPort, &msg); + } + return TRUE; } *************** *** 272,284 **** _ASSERTE(pInMsg != NULL); ! if (pInMsg->type == HUB_MSG_TYPE_GET_OPTIONS) { ! pInMsg->u.pv.val &= ~(GO_V2O_MODEM_STATUS(-1) | GO_V2O_LINE_STATUS(-1)); pInMsg = pMsgInsertNone(pInMsg, HUB_MSG_TYPE_EMPTY); if (pInMsg) { ! pInMsg->type = HUB_MSG_TYPE_GET_OPTIONS; pInMsg->u.pv.pVal = &options; ! pInMsg->u.pv.val = GO_V2O_MODEM_STATUS(-1) | GO_V2O_LINE_STATUS(-1); } } --- 300,321 ---- _ASSERTE(pInMsg != NULL); ! if (pInMsg->type == HUB_MSG_TYPE_GET_IN_OPTS) { ! // get supported options from subsequent filters separately ! ! DWORD supported_options = pInMsg->u.pv.val & ( ! GO_ESCAPE_MODE | ! GO_RBR_STATUS | ! GO_RLC_STATUS | ! GO_V2O_MODEM_STATUS(-1) | ! GO_V2O_LINE_STATUS(-1)); ! ! pInMsg->u.pv.val &= ~supported_options; pInMsg = pMsgInsertNone(pInMsg, HUB_MSG_TYPE_EMPTY); if (pInMsg) { ! pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; pInMsg->u.pv.pVal = &options; ! pInMsg->u.pv.val = supported_options; } } *************** *** 396,400 **** } else ! if (pMsg->type == HUB_MSG_TYPE_SET_OPTIONS) { if (handle == INVALID_HANDLE_VALUE) return FALSE; --- 433,437 ---- } else ! if (pMsg->type == HUB_MSG_TYPE_SET_OUT_OPTS) { if (handle == INVALID_HANDLE_VALUE) return FALSE; *************** *** 508,512 **** CheckComEvents(eMask); ! if (!events || !pOverlapped->StartWaitCommEvent()) { delete pOverlapped; countWaitCommEventOverlapped--; --- 545,549 ---- CheckComEvents(eMask); ! if (!pOverlapped->StartWaitCommEvent()) { delete pOverlapped; countWaitCommEventOverlapped--; Index: comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** comport.h 15 Aug 2008 12:44:59 -0000 1.6 --- comport.h 20 Aug 2008 14:30:19 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/08/20 14:30:19 vfrolov + * Redesigned serial port options + * * Revision 1.6 2008/08/15 12:44:59 vfrolov * Added fake read filter method to ports *************** *** 103,107 **** int countXoff; BOOL filterX; - DWORD events; BYTE maskOutPins; DWORD options; --- 106,109 ---- Index: comio.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** comio.h 14 Aug 2008 15:19:07 -0000 1.4 --- comio.h 20 Aug 2008 14:30:19 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/08/20 14:30:19 vfrolov + * Redesigned serial port options + * * Revision 1.4 2008/08/14 15:19:07 vfrolov * Execute OnCommEvent() in main thread context *************** *** 63,66 **** --- 66,70 ---- extern BOOL SetComEvents(HANDLE handle, DWORD *events); extern BOOL CommFunction(HANDLE handle, DWORD func); + extern DWORD SetEscMode(HANDLE handle, DWORD options, BYTE escapeChar, BYTE **ppBuf, DWORD *pDone); /////////////////////////////////////////////////////////////// class ReadOverlapped : private OVERLAPPED Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/port.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** port.cpp 15 Aug 2008 12:44:59 -0000 1.6 --- port.cpp 20 Aug 2008 14:30:19 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/08/20 14:30:19 vfrolov + * Redesigned serial port options + * * Revision 1.6 2008/08/15 12:44:59 vfrolov * Added fake read filter method to ports *************** *** 105,109 **** << endl << "Output data stream description:" << endl ! << " SET_OPTIONS(<opts>) - or'e <opts> with the output data stream options." << endl << " LINE_DATA(<data>) - write <data> to serial port." << endl << " SET_PIN_STATE(<state>) - set serial port pins to required state." << endl --- 108,112 ---- << endl << "Output data stream description:" << endl ! << " SET_OUT_OPTS(<opts>) - or'e <opts> with the output data stream options." << endl << " LINE_DATA(<data>) - write <data> to serial port." << endl << " SET_PIN_STATE(<state>) - set serial port pins to required state." << endl *************** *** 116,127 **** << endl << "Fake read filter input data stream description:" << endl ! << " GET_OPTIONS(<pOpts>,<mask>)" << endl << " - the port removes bits from <mask> in this message" << endl << " for locally supported input data stream options." << endl << endl << "Fake read filter output data stream description:" << endl ! << " GET_OPTIONS(<pOpts>,<mask>)" << endl << " - the port adds this message at detecting the" << endl ! << " GET_OPTIONS message in the stream to get the" << endl << " required input data stream options." << endl << endl --- 119,130 ---- << endl << "Fake read filter input data stream description:" << endl ! << " GET_IN_OPTS(<pOpts>,<mask>)" << endl << " - the port removes bits from <mask> in this message" << endl << " for locally supported input data stream options." << endl << endl << "Fake read filter output data stream description:" << endl ! << " GET_IN_OPTS(<pOpts>,<mask>)" << endl << " - the port adds this message at detecting the" << endl ! << " GET_IN_OPTS message in the stream to get the" << endl << " required input data stream options." << endl << endl Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** comio.cpp 14 Aug 2008 15:19:07 -0000 1.4 --- comio.cpp 20 Aug 2008 14:30:19 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/08/20 14:30:19 vfrolov + * Redesigned serial port options + * * Revision 1.4 2008/08/14 15:19:07 vfrolov * Execute OnCommEvent() in main thread context *************** *** 62,65 **** --- 65,69 ---- #include "comparams.h" #include "import.h" + #include "..\cncext.h" /////////////////////////////////////////////////////////////// *************** *** 269,272 **** --- 273,392 ---- } /////////////////////////////////////////////////////////////// + static ULONG GetEscCaps(HANDLE handle) + { + BYTE inBufIoctl[sizeof(UCHAR) + C0CE_SIGNATURE_SIZE + sizeof(ULONG)]; + inBufIoctl[0] = 0; // disable inserting + memcpy(inBufIoctl + sizeof(UCHAR), C0CE_SIGNATURE, C0CE_SIGNATURE_SIZE); + *(ULONG *)(inBufIoctl + sizeof(UCHAR) + C0CE_SIGNATURE_SIZE) = C0CE_INSERT_IOCTL_CAPS; + + BYTE outBuf[C0CE_SIGNATURE_SIZE + sizeof(ULONG)]; + + DWORD returned; + + if (!DeviceIoControl(handle, + IOCTL_SERIAL_LSRMST_INSERT, + inBufIoctl, sizeof(inBufIoctl), + outBuf, sizeof(outBuf), &returned, + NULL)) + { + TraceError(GetLastError(), "IOCTL_SERIAL_LSRMST_INSERT"); + return 0; + } + + if (returned < (C0CE_SIGNATURE_SIZE + sizeof(ULONG)) || + memcmp(outBuf, C0CE_SIGNATURE, C0CE_SIGNATURE_SIZE) != 0) + { + return C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_MST; // standard functionality + } + + return *(ULONG *)(outBuf + C0CE_SIGNATURE_SIZE); + } + + DWORD SetEscMode(HANDLE handle, DWORD options, BYTE escapeChar, BYTE **ppBuf, DWORD *pDone) + { + _ASSERTE(ppBuf != NULL); + _ASSERTE(*ppBuf == NULL); + _ASSERTE(pDone != NULL); + _ASSERTE(*pDone == 0); + + if (!escapeChar) + return options; + + ULONG opts = (C0CE_INSERT_IOCTL_GET|C0CE_INSERT_IOCTL_RXCLEAR); + + if (options & GO_V2O_MODEM_STATUS(-1)) + opts |= C0CE_INSERT_ENABLE_MST; + + if (options & GO_V2O_LINE_STATUS(LINE_STATUS_BI)) + opts |= C0CE_INSERT_ENABLE_LSR_BI; + + if (options & GO_RBR_STATUS) + opts |= C0CE_INSERT_ENABLE_RBR; + + if (options & GO_RLC_STATUS) + opts |= C0CE_INSERT_ENABLE_RLC; + + opts &= GetEscCaps(handle); + + if (!opts) + return options; + + BYTE inBufIoctl[sizeof(UCHAR) + C0CE_SIGNATURE_SIZE + sizeof(ULONG)]; + inBufIoctl[0] = escapeChar; + memcpy(inBufIoctl + sizeof(UCHAR), C0CE_SIGNATURE, C0CE_SIGNATURE_SIZE); + *(ULONG *)(inBufIoctl + sizeof(UCHAR) + C0CE_SIGNATURE_SIZE) = opts; + + DWORD lenOutBufIoctl = 0; + + if (opts & C0CE_INSERT_IOCTL_GET) { + if (opts & (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_LSR_BI)) + lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(UCHAR); + + if (opts & C0CE_INSERT_ENABLE_MST) + lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(UCHAR); + + if (opts & C0CE_INSERT_ENABLE_RBR) + lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(ULONG); + + if (opts & C0CE_INSERT_ENABLE_RLC) + lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(UCHAR)*3; + + if (lenOutBufIoctl) { + *ppBuf = pBufAlloc(lenOutBufIoctl); + + if (!*ppBuf) + lenOutBufIoctl = 0; + } + } + + if (!DeviceIoControl(handle, + IOCTL_SERIAL_LSRMST_INSERT, + inBufIoctl, sizeof(inBufIoctl), + *ppBuf, lenOutBufIoctl, pDone, + NULL)) + { + TraceError(GetLastError(), "IOCTL_SERIAL_LSRMST_INSERT"); + + *pDone = 0; + return options; + } + + options &= ~GO_ESCAPE_MODE; + + if (opts & C0CE_INSERT_ENABLE_MST) + options &= ~GO_V2O_MODEM_STATUS(-1); + + if (opts & C0CE_INSERT_ENABLE_LSR_BI) + options &= ~GO_V2O_LINE_STATUS(LINE_STATUS_BI); + + if (opts & C0CE_INSERT_ENABLE_RBR) + options &= ~GO_RBR_STATUS; + + if (opts & C0CE_INSERT_ENABLE_RLC) + options &= ~GO_RLC_STATUS; + + return options; + } + /////////////////////////////////////////////////////////////// WriteOverlapped::WriteOverlapped(ComPort &_port, BYTE *_pBuf, DWORD _len) : port(_port), *************** *** 360,363 **** --- 480,493 ---- hWait(INVALID_HANDLE_VALUE) { + #ifdef _DEBUG + static DWORD idThread; + + if (hThread == INVALID_HANDLE_VALUE) { + idThread = ::GetCurrentThreadId(); + } else { + _ASSERTE(idThread == ::GetCurrentThreadId()); + } + #endif /* _DEBUG */ + if (hThread == INVALID_HANDLE_VALUE) { if (!::DuplicateHandle(::GetCurrentProcess(), |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 14:57:17
|
Update of /cvsroot/com0com/hub4com/plugins/pin2con In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29647/plugins/pin2con Modified Files: filter.cpp Log Message: Redesigned serial port options Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pin2con/filter.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** filter.cpp 11 Aug 2008 07:15:33 -0000 1.5 --- filter.cpp 20 Aug 2008 14:30:19 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/08/20 14:30:19 vfrolov + * Redesigned serial port options + * * Revision 1.5 2008/08/11 07:15:33 vfrolov * Replaced *************** *** 51,54 **** --- 54,59 ---- static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal = NULL; static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; + static ROUTINE_PORT_NAME_A *pPortName = NULL; + static ROUTINE_FILTER_NAME_A *pFilterName = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) *************** *** 69,79 **** }; /////////////////////////////////////////////////////////////// - typedef map<int, State*> PortsMap; - typedef pair<int, State*> PortPair; - class Filter { public: Filter(int argc, const char *const argv[]); State *GetState(int nPort); DWORD pin; --- 74,84 ---- }; /////////////////////////////////////////////////////////////// class Filter { public: Filter(int argc, const char *const argv[]); + void SetHub(HHUB _hHub) { hHub = _hHub; } State *GetState(int nPort); + const char *PortName(int nPort) const { return pPortName(hHub, nPort); } + const char *FilterName() const { return pFilterName(hHub, (HFILTER)this); } DWORD pin; *************** *** 81,84 **** --- 86,94 ---- private: + HHUB hHub; + + typedef map<int, State*> PortsMap; + typedef pair<int, State*> PortPair; + PortsMap portsMap; }; *************** *** 97,101 **** Filter::Filter(int argc, const char *const argv[]) : pin(GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)), ! negative(FALSE) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { --- 107,112 ---- Filter::Filter(int argc, const char *const argv[]) : pin(GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)), ! negative(FALSE), ! hHub(NULL) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { *************** *** 180,190 **** << endl << "IN method input data stream description:" << endl ! << " HUB_MSG_TYPE_GET_OPTIONS(<pOptions>)" << endl ! << " - the value pointed by <pOptions> will be or'ed with" << endl << " the required mask to get line status and modem" << endl << " status." << endl << " CONNECT(TRUE/FALSE) - will be discarded from stream." << endl ! << " LINE_STATUS(<val>) - current state of line" << endl ! << " MODEM_STATUS(<val>) - current state of modem" << endl << endl << "IN method output data stream description:" << endl --- 191,200 ---- << endl << "IN method input data stream description:" << endl ! << " GET_IN_OPTS(<pOpts>) - the value pointed by <pOpts> will be or'ed with" << endl << " the required mask to get line status and modem" << endl << " status." << endl << " CONNECT(TRUE/FALSE) - will be discarded from stream." << endl ! << " LINE_STATUS(<val>) - current state of line." << endl ! << " MODEM_STATUS(<val>) - current state of modem." << endl << endl << "IN method output data stream description:" << endl *************** *** 206,209 **** --- 216,231 ---- } /////////////////////////////////////////////////////////////// + static BOOL CALLBACK Init( + HFILTER hFilter, + HHUB hHub) + { + _ASSERTE(hFilter != NULL); + _ASSERTE(hHub != NULL); + + ((Filter *)hFilter)->SetHub(hHub); + + return TRUE; + } + /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( HFILTER hFilter, *************** *** 217,225 **** _ASSERTE(*ppEchoMsg == NULL); ! if (pInMsg->type == HUB_MSG_TYPE_GET_OPTIONS) { _ASSERTE(pInMsg->u.pv.pVal != NULL); *pInMsg->u.pv.pVal |= (((Filter *)hFilter)->pin & pInMsg->u.pv.val); } else if (pInMsg->type == HUB_MSG_TYPE_CONNECT) { // discard any CONNECT messages from the input stream --- 239,259 ---- _ASSERTE(*ppEchoMsg == NULL); ! if (pInMsg->type == HUB_MSG_TYPE_GET_IN_OPTS) { _ASSERTE(pInMsg->u.pv.pVal != NULL); + // or'e with the required mask to get line status and modem status *pInMsg->u.pv.pVal |= (((Filter *)hFilter)->pin & pInMsg->u.pv.val); } else + if (pInMsg->type == HUB_MSG_TYPE_FAIL_IN_OPTS) { + DWORD fail_options = (pInMsg->u.val & ((Filter *)hFilter)->pin); + + if (fail_options) { + cerr << ((Filter *)hFilter)->PortName(nFromPort) + << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() + << " option(s) 0x" << hex << fail_options << dec + << " not accepted" << endl; + } + } + else if (pInMsg->type == HUB_MSG_TYPE_CONNECT) { // discard any CONNECT messages from the input stream *************** *** 268,272 **** NULL, // ConfigStop Create, ! NULL, // Init InMethod, NULL, // OutMethod --- 302,306 ---- NULL, // ConfigStop Create, ! Init, InMethod, NULL, // OutMethod *************** *** 283,287 **** { if (!ROUTINE_IS_VALID(pHubRoutines, pMsgInsertVal) || ! !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceNone)) { return NULL; --- 317,323 ---- { if (!ROUTINE_IS_VALID(pHubRoutines, pMsgInsertVal) || ! !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceNone) || ! !ROUTINE_IS_VALID(pHubRoutines, pPortName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterName)) { return NULL; *************** *** 290,293 **** --- 326,331 ---- pMsgInsertVal = pHubRoutines->pMsgInsertVal; pMsgReplaceNone = pHubRoutines->pMsgReplaceNone; + pPortName = pHubRoutines->pPortName; + pFilterName = pHubRoutines->pFilterName; return plugins; |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 14:57:17
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29647 Modified Files: comhub.cpp Log Message: Redesigned serial port options Index: comhub.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/comhub.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** comhub.cpp 20 Aug 2008 08:46:06 -0000 1.8 --- comhub.cpp 20 Aug 2008 14:30:18 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2008/08/20 14:30:18 vfrolov + * Redesigned serial port options + * * Revision 1.8 2008/08/20 08:46:06 vfrolov * Implemented ComHub::FilterName() *************** *** 101,105 **** HubMsg msg; ! msg.type = HUB_MSG_TYPE_SET_OPTIONS; if (!OnFakeRead(*i, &msg)) --- 104,108 ---- HubMsg msg; ! msg.type = HUB_MSG_TYPE_SET_OUT_OPTS; if (!OnFakeRead(*i, &msg)) *************** *** 108,124 **** for (Ports::const_iterator i = ports.begin() ; i != ports.end() ; i++) { ! HubMsg msg; ! DWORD options = 0; ! msg.type = HUB_MSG_TYPE_GET_OPTIONS; ! msg.u.pv.pVal = &options; ! msg.u.pv.val = DWORD(-1); ! if (!OnFakeRead(*i, &msg)) ! return FALSE; ! if (options) { ! cout << (*i)->Name() << " WARNING: Requested option(s) 0x" ! << hex << options << dec << " not supported" << endl; } } --- 111,152 ---- for (Ports::const_iterator i = ports.begin() ; i != ports.end() ; i++) { ! DWORD fail_options = 0; ! DWORD repeats = 0; ! { ! HubMsg msg; ! msg.type = HUB_MSG_TYPE_COUNT_REPEATS; ! msg.u.pv.pVal = &repeats; ! msg.u.pv.val = HUB_MSG_TYPE_GET_IN_OPTS; ! if (!OnFakeRead(*i, &msg)) ! return FALSE; ! } ! ! do { ! HubMsg msg; ! ! msg.type = HUB_MSG_TYPE_GET_IN_OPTS; ! msg.u.pv.pVal = &fail_options; ! msg.u.pv.val = DWORD(-1); ! ! if (!OnFakeRead(*i, &msg)) ! return FALSE; ! } while (repeats--); ! ! if (fail_options) { ! cerr << (*i)->Name() << " WARNING: Requested option(s) 0x" ! << hex << fail_options << dec << " not supported" << endl; ! } ! ! { ! HubMsg msg; ! ! msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; ! msg.u.val = fail_options; ! ! if (!OnFakeRead(*i, &msg)) ! return FALSE; } } |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 14:57:16
|
Update of /cvsroot/com0com/hub4com/plugins/pinmap In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29647/plugins/pinmap Modified Files: filter.cpp Log Message: Redesigned serial port options Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pinmap/filter.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filter.cpp 14 Aug 2008 09:49:45 -0000 1.3 --- filter.cpp 20 Aug 2008 14:30:19 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/08/20 14:30:19 vfrolov + * Redesigned serial port options + * * Revision 1.3 2008/08/14 09:49:45 vfrolov * Fixed output pins masking *************** *** 36,39 **** --- 39,44 ---- /////////////////////////////////////////////////////////////// static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal = NULL; + static ROUTINE_PORT_NAME_A *pPortName = NULL; + static ROUTINE_FILTER_NAME_A *pFilterName = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) *************** *** 58,86 **** static struct { const char *pName; ! DWORD val; } pinOut_names[] = { ! {"rts=", SO_V2O_PIN_STATE(PIN_STATE_RTS)}, ! {"dtr=", SO_V2O_PIN_STATE(PIN_STATE_DTR)}, ! {"out1=", SO_V2O_PIN_STATE(PIN_STATE_OUT1)}, ! {"out2=", SO_V2O_PIN_STATE(PIN_STATE_OUT2)}, ! {"break=", SO_V2O_PIN_STATE(PIN_STATE_BREAK)}, }; /////////////////////////////////////////////////////////////// static struct { const char *pName; ! DWORD val; } pinIn_names[] = { ! {"cts", GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)}, ! {"dsr", GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)}, ! {"dcd", GO_V2O_MODEM_STATUS(MODEM_STATUS_DCD)}, ! {"ring", GO_V2O_MODEM_STATUS(MODEM_STATUS_RI)}, ! {"break", GO_V2O_LINE_STATUS(LINE_STATUS_BI)}, }; /////////////////////////////////////////////////////////////// class State { public: ! State() : inVal(0) {} ! WORD inVal; }; /////////////////////////////////////////////////////////////// --- 63,97 ---- static struct { const char *pName; ! WORD val; } pinOut_names[] = { ! {"rts=", PIN_STATE_RTS}, ! {"dtr=", PIN_STATE_DTR}, ! {"out1=", PIN_STATE_OUT1}, ! {"out2=", PIN_STATE_OUT2}, ! {"break=", PIN_STATE_BREAK}, }; /////////////////////////////////////////////////////////////// + #define MST2LSRMST(m) ((WORD)((BYTE)(m))) + #define LSR2LSRMST(l) ((WORD)(((WORD)(BYTE)(l)) << 8)) + #define LSRMST2MST(lm) ((BYTE)(lm)) + #define LSRMST2LSR(lm) ((BYTE)((lm) >> 8)) + #define LSRMST2GO(lm) (GO_V2O_MODEM_STATUS(LSRMST2MST(lm)) | GO_V2O_LINE_STATUS(LSRMST2LSR(lm))) + static struct { const char *pName; ! WORD lmVal; } pinIn_names[] = { ! {"cts", MST2LSRMST(MODEM_STATUS_CTS)}, ! {"dsr", MST2LSRMST(MODEM_STATUS_DSR)}, ! {"dcd", MST2LSRMST(MODEM_STATUS_DCD)}, ! {"ring", MST2LSRMST(MODEM_STATUS_RI)}, ! {"break", LSR2LSRMST(LINE_STATUS_BI)}, }; /////////////////////////////////////////////////////////////// class State { public: ! State() : lmInVal(0) {} ! WORD lmInVal; }; /////////////////////////////////////////////////////////////// *************** *** 88,92 **** --- 99,106 ---- public: Filter(int argc, const char *const argv[]); + void SetHub(HHUB _hHub) { hHub = _hHub; } State *GetState(int nPort); + const char *PortName(int nPort) const { return pPortName(hHub, nPort); } + const char *FilterName() const { return pFilterName(hHub, (HFILTER)this); } struct PinOuts { *************** *** 99,105 **** PinOuts pinMap[sizeof(pinIn_names)/sizeof(pinIn_names[0])]; WORD outMask; ! WORD inMask; private: typedef map<int, State*> PortsMap; typedef pair<int, State*> PortPair; --- 113,121 ---- PinOuts pinMap[sizeof(pinIn_names)/sizeof(pinIn_names[0])]; WORD outMask; ! WORD lmInMask; private: + HHUB hHub; + typedef map<int, State*> PortsMap; typedef pair<int, State*> PortPair; *************** *** 112,116 **** Filter::Filter(int argc, const char *const argv[]) : outMask(0), ! inMask(0) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { --- 128,133 ---- Filter::Filter(int argc, const char *const argv[]) : outMask(0), ! lmInMask(0), ! hHub(NULL) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { *************** *** 126,130 **** } ! if (!inMask) { Parse("rts=cts"); Parse("dtr=dsr"); --- 143,147 ---- } ! if (!lmInMask) { Parse("rts=cts"); Parse("dtr=dsr"); *************** *** 168,172 **** if (_stricmp(pParam, pinIn_names[iIn].pName) == 0) { foundIn = TRUE; ! inMask |= pinIn_names[iIn].val; pinMap[iIn].mask |= pinOut_names[iOut].val; --- 185,189 ---- if (_stricmp(pParam, pinIn_names[iIn].pName) == 0) { foundIn = TRUE; ! lmInMask |= pinIn_names[iIn].lmVal; pinMap[iIn].mask |= pinOut_names[iOut].val; *************** *** 251,257 **** << endl << "OUT method input data stream description:" << endl ! << " SET_OPTIONS(<opts>) - the value <opts> will be or'ed with the required mask" << endl << " to to set pin state." << endl ! << " GET_OPTIONS(<pOpts>) - the value pointed by <pOpts> will be or'ed with" << endl << " the required mask to get line status and modem" << endl << " status." << endl --- 268,274 ---- << endl << "OUT method input data stream description:" << endl ! << " SET_OUT_OPTS(<opts>) - the value <opts> will be or'ed with the required mask" << endl << " to to set pin state." << endl ! << " GET_IN_OPTS(<pOpts>) - the value pointed by <pOpts> will be or'ed with" << endl << " the required mask to get line status and modem" << endl << " status." << endl *************** *** 292,305 **** } /////////////////////////////////////////////////////////////// static void InsertPinState( Filter &filter, ! WORD inMask, ! WORD inVal, HUB_MSG **ppOutMsg) { ! if (!inMask) return; ! //cout << "InsertPinState inMask=0x" << hex << inMask << " inVal=0x" << inVal << dec << endl; WORD mask = 0; --- 309,334 ---- } /////////////////////////////////////////////////////////////// + static BOOL CALLBACK Init( + HFILTER hFilter, + HHUB hHub) + { + _ASSERTE(hFilter != NULL); + _ASSERTE(hHub != NULL); + + ((Filter *)hFilter)->SetHub(hHub); + + return TRUE; + } + /////////////////////////////////////////////////////////////// static void InsertPinState( Filter &filter, ! WORD lmInMask, ! WORD lmInVal, HUB_MSG **ppOutMsg) { ! if (!lmInMask) return; ! //cout << "InsertPinState lmInMask=0x" << hex << lmInMask << " lmInVal=0x" << lmInVal << dec << endl; WORD mask = 0; *************** *** 307,316 **** for (int iIn = 0 ; iIn < sizeof(pinIn_names)/sizeof(pinIn_names[0]) ; iIn++) { ! if ((inMask & pinIn_names[iIn].val) == 0) continue; mask |= filter.pinMap[iIn].mask; ! if ((inVal & pinIn_names[iIn].val) != 0) val |= (filter.pinMap[iIn].val & filter.pinMap[iIn].mask); else --- 336,345 ---- for (int iIn = 0 ; iIn < sizeof(pinIn_names)/sizeof(pinIn_names[0]) ; iIn++) { ! if ((lmInMask & pinIn_names[iIn].lmVal) == 0) continue; mask |= filter.pinMap[iIn].mask; ! if ((lmInVal & pinIn_names[iIn].lmVal) != 0) val |= (filter.pinMap[iIn].val & filter.pinMap[iIn].mask); else *************** *** 327,331 **** static BOOL CALLBACK OutMethod( HFILTER hFilter, ! int /*nFromPort*/, int nToPort, HUB_MSG *pOutMsg) --- 356,360 ---- static BOOL CALLBACK OutMethod( HFILTER hFilter, ! int nFromPort, int nToPort, HUB_MSG *pOutMsg) *************** *** 335,349 **** switch (pOutMsg->type) { ! case HUB_MSG_TYPE_SET_OPTIONS: { // or'e with the required mask to set pin state ! pOutMsg->u.val |= ((Filter *)hFilter)->outMask; break; } ! case HUB_MSG_TYPE_GET_OPTIONS: { _ASSERTE(pOutMsg->u.pv.pVal != NULL); // or'e with the required mask to get line status and modem status ! WORD mask = (WORD)(((Filter *)hFilter)->inMask & pOutMsg->u.pv.val); ! *pOutMsg->u.pv.pVal |= mask; break; } --- 364,388 ---- switch (pOutMsg->type) { ! case HUB_MSG_TYPE_SET_OUT_OPTS: { // or'e with the required mask to set pin state ! pOutMsg->u.val |= SO_V2O_PIN_STATE(((Filter *)hFilter)->outMask); break; } ! case HUB_MSG_TYPE_GET_IN_OPTS: { _ASSERTE(pOutMsg->u.pv.pVal != NULL); // or'e with the required mask to get line status and modem status ! *pOutMsg->u.pv.pVal |= (LSRMST2GO(((Filter *)hFilter)->lmInMask) & pOutMsg->u.pv.val); ! break; ! } ! case HUB_MSG_TYPE_FAIL_IN_OPTS: { ! DWORD fail_options = (pOutMsg->u.val & LSRMST2GO(((Filter *)hFilter)->lmInMask)); ! ! if (fail_options) { ! cerr << ((Filter *)hFilter)->PortName(nFromPort) ! << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() ! << " option(s) 0x" << hex << fail_options << dec ! << " not accepted" << endl; ! } break; } *************** *** 359,373 **** return FALSE; ! WORD inVal; if (pOutMsg->type == HUB_MSG_TYPE_MODEM_STATUS) ! inVal = ((WORD)pOutMsg->u.val & 0x00FF) | (pState->inVal & 0xFF00); else ! inVal = ((WORD)pOutMsg->u.val << 8) | (pState->inVal & 0x00FF); ! inVal &= ((Filter *)hFilter)->inMask; ! InsertPinState(*(Filter *)hFilter, pState->inVal ^ inVal, inVal, &pOutMsg); ! pState->inVal = inVal; break; } --- 398,412 ---- return FALSE; ! WORD lmInVal; if (pOutMsg->type == HUB_MSG_TYPE_MODEM_STATUS) ! lmInVal = (MST2LSRMST(pOutMsg->u.val) | (pState->lmInVal & LSR2LSRMST(-1))); else ! lmInVal = (LSR2LSRMST(pOutMsg->u.val) | (pState->lmInVal & MST2LSRMST(-1))); ! lmInVal &= ((Filter *)hFilter)->lmInMask; ! InsertPinState(*(Filter *)hFilter, pState->lmInVal ^ lmInVal, lmInVal, &pOutMsg); ! pState->lmInVal = lmInVal; break; } *************** *** 386,390 **** NULL, // ConfigStop Create, ! NULL, // Init NULL, // InMethod OutMethod, --- 425,429 ---- NULL, // ConfigStop Create, ! Init, NULL, // InMethod OutMethod, *************** *** 400,408 **** const HUB_ROUTINES_A * pHubRoutines) { ! if (!ROUTINE_IS_VALID(pHubRoutines, pMsgInsertVal)) { return NULL; } pMsgInsertVal = pHubRoutines->pMsgInsertVal; return plugins; --- 439,452 ---- const HUB_ROUTINES_A * pHubRoutines) { ! if (!ROUTINE_IS_VALID(pHubRoutines, pMsgInsertVal) || ! !ROUTINE_IS_VALID(pHubRoutines, pPortName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterName)) ! { return NULL; } pMsgInsertVal = pHubRoutines->pMsgInsertVal; + pPortName = pHubRoutines->pPortName; + pFilterName = pHubRoutines->pFilterName; return plugins; |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 14:57:16
|
Update of /cvsroot/com0com/hub4com/plugins In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29647/plugins Modified Files: plugins_api.h Log Message: Redesigned serial port options Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** plugins_api.h 20 Aug 2008 09:06:48 -0000 1.7 --- plugins_api.h 20 Aug 2008 14:30:18 -0000 1.8 *************** *** 63,74 **** #define PIN_STATE_OUT2 0x08 #define PIN_STATE_BREAK 0x10 ! #define HUB_MSG_TYPE_GET_OPTIONS (6 | HUB_MSG_UNION_TYPE_PVAL) #define GO_O2V_MODEM_STATUS(o) ((BYTE)(o)) #define GO_V2O_MODEM_STATUS(v) ((DWORD)(BYTE)(v)) #define GO_O2V_LINE_STATUS(o) ((BYTE)((o) >> 8)) #define GO_V2O_LINE_STATUS(v) ((DWORD)(BYTE)(v) << 8) ! #define HUB_MSG_TYPE_SET_OPTIONS (7 | HUB_MSG_UNION_TYPE_VAL) #define SO_O2V_PIN_STATE(o) ((BYTE)(o)) #define SO_V2O_PIN_STATE(v) ((DWORD)(BYTE)(v)) /*******************************************************************/ typedef struct _HUB_MSG { --- 63,81 ---- #define PIN_STATE_OUT2 0x08 #define PIN_STATE_BREAK 0x10 ! #define HUB_MSG_TYPE_GET_IN_OPTS (6 | HUB_MSG_UNION_TYPE_PVAL) #define GO_O2V_MODEM_STATUS(o) ((BYTE)(o)) #define GO_V2O_MODEM_STATUS(v) ((DWORD)(BYTE)(v)) #define GO_O2V_LINE_STATUS(o) ((BYTE)((o) >> 8)) #define GO_V2O_LINE_STATUS(v) ((DWORD)(BYTE)(v) << 8) ! #define GO_ESCAPE_MODE 0x00010000 ! #define GO_RBR_STATUS 0x00020000 ! #define GO_RLC_STATUS 0x00040000 ! #define HUB_MSG_TYPE_SET_OUT_OPTS (7 | HUB_MSG_UNION_TYPE_VAL) #define SO_O2V_PIN_STATE(o) ((BYTE)(o)) #define SO_V2O_PIN_STATE(v) ((DWORD)(BYTE)(v)) + #define HUB_MSG_TYPE_FAIL_IN_OPTS (8 | HUB_MSG_UNION_TYPE_VAL) + #define HUB_MSG_TYPE_RBR_STATUS (9 | HUB_MSG_UNION_TYPE_VAL) + #define HUB_MSG_TYPE_RLC_STATUS (10 | HUB_MSG_UNION_TYPE_VAL) + #define HUB_MSG_TYPE_COUNT_REPEATS (11 | HUB_MSG_UNION_TYPE_PVAL) /*******************************************************************/ typedef struct _HUB_MSG { |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 10:40:26
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12022 Modified Files: serial.vcproj Log Message: Added ..cncext.h Index: serial.vcproj =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/serial.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** serial.vcproj 26 Mar 2008 08:41:18 -0000 1.1 --- serial.vcproj 20 Aug 2008 10:40:19 -0000 1.2 *************** *** 183,186 **** --- 183,190 ---- > <File + RelativePath="..\cncext.h" + > + </File> + <File RelativePath=".\comio.h" > |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 10:38:29
|
Update of /cvsroot/com0com/hub4com/plugins In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11252 Added Files: cncext.h Log Message: Imported from com0com/include --- NEW FILE: cncext.h --- /* * cncext.h * * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _INCLUDE_C0C_CNCEXT_H_ #define _INCLUDE_C0C_CNCEXT_H_ #define C0CE_SIGNATURE "c0c" #define C0CE_SIGNATURE_SIZE (sizeof(UCHAR)*4) /************************************************************************** Extended IOCTL_SERIAL_LSRMST_INSERT allows to monitor and get the paired port settings as insertion to the data stream **************************************************************************/ /* Following this value is the baud rate (ULONG) of paired port */ #define C0CE_INSERT_RBR 16 /* Following this value is the byte size (UCHAR), parity (UCHAR) and stop bits (UCHAR) of paired port */ #define C0CE_INSERT_RLC 17 /* Options (ULONG) */ #define C0CE_INSERT_IOCTL_CAPS 0xFFFFFFFF /* IOCTL returns bitmap of all possible options */ #define C0CE_INSERT_IOCTL_GET 0x01000000 /* IOCTL returns current values of enabled insertions */ #define C0CE_INSERT_IOCTL_RXCLEAR 0x02000000 /* IOCTL clears the driver's input buffer */ #define C0CE_INSERT_ENABLE_LSR 0x00000001 /* enable standard SERIAL_LSRMST_LSR_[NO]DATA insertion */ #define C0CE_INSERT_ENABLE_MST 0x00000002 /* enable standard SERIAL_LSRMST_MST insertion */ #define C0CE_INSERT_ENABLE_RBR 0x00000100 /* enable C0CE_INSERT_RBR insertion */ #define C0CE_INSERT_ENABLE_RLC 0x00000200 /* enable C0CE_INSERT_RLC insertion */ #define C0CE_INSERT_ENABLE_LSR_BI 0x00000400 /* enable SERIAL_LSRMST_LSR_[NO]DATA insertion on BREAK change */ #endif /* _INCLUDE_C0C_CNCEXT_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 10:08:35
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32578 Modified Files: filter.cpp Log Message: Added strict option checking Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/filter.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** filter.cpp 14 Apr 2008 07:32:04 -0000 1.2 --- filter.cpp 20 Aug 2008 10:08:29 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/08/20 10:08:29 vfrolov + * Added strict option checking + * * Revision 1.2 2008/04/14 07:32:04 vfrolov * Renamed option --use-port-module to --use-driver *************** *** 47,54 **** } /////////////////////////////////////////////////////////////// ! typedef map<int, TelnetProtocol*> PortsMap; ! typedef pair<int, TelnetProtocol*> PortPair; ! ! class Filter { public: Filter(int argc, const char *const argv[]); --- 50,63 ---- } /////////////////////////////////////////////////////////////// ! class Valid { ! public: ! Valid() : isValid(TRUE) {} ! void Invalidate() { isValid = FALSE; } ! BOOL IsValid() const { return isValid; } ! private: ! BOOL isValid; ! }; ! /////////////////////////////////////////////////////////////// ! class Filter : public Valid { public: Filter(int argc, const char *const argv[]); *************** *** 60,63 **** --- 69,76 ---- HHUB hHub; string terminalType; + + typedef map<int, TelnetProtocol*> PortsMap; + typedef pair<int, TelnetProtocol*> PortPair; + PortsMap portsMap; }; *************** *** 72,75 **** --- 85,89 ---- if (!pArg) { cerr << "Unknown option " << *pArgs << endl; + Invalidate(); continue; } *************** *** 81,84 **** --- 95,99 ---- } else { cerr << "Unknown option " << pArg << endl; + Invalidate(); } } *************** *** 176,180 **** const char *const argv[]) { ! return (HFILTER)new Filter(argc, argv); } /////////////////////////////////////////////////////////////// --- 191,205 ---- const char *const argv[]) { ! Filter *pFilter = new Filter(argc, argv); ! ! if (!pFilter) ! return NULL; ! ! if (!pFilter->IsValid()) { ! delete pFilter; ! return NULL; ! } ! ! return (HFILTER)pFilter; } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 09:38:56
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21406 Modified Files: plugins.cpp Log Message: Fixed unknown types printing Index: plugins.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** plugins.cpp 14 Apr 2008 07:32:03 -0000 1.2 --- plugins.cpp 20 Aug 2008 09:38:52 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/08/20 09:38:52 vfrolov + * Fixed unknown types printing + * * Revision 1.2 2008/04/14 07:32:03 vfrolov * Renamed option --use-port-module to --use-driver *************** *** 114,118 **** case PLUGIN_TYPE_FILTER: str << "filter"; break; case PLUGIN_TYPE_DRIVER: str << "driver"; break; ! default: str << type; } --- 117,121 ---- case PLUGIN_TYPE_FILTER: str << "filter"; break; case PLUGIN_TYPE_DRIVER: str << "driver"; break; ! default: str << "UNKNOWN(" << type << ")"; } |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 09:26:43
|
Update of /cvsroot/com0com/hub4com/plugins/awakseq In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16984 Modified Files: filter.cpp Log Message: Fixed typo Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/awakseq/filter.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** filter.cpp 14 Apr 2008 07:32:03 -0000 1.4 --- filter.cpp 20 Aug 2008 09:26:40 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/08/20 09:26:40 vfrolov + * Fixed typo + * * Revision 1.4 2008/04/14 07:32:03 vfrolov * Renamed option --use-port-module to --use-driver *************** *** 46,50 **** static ROUTINE_MSG_INSERT_VAL *pMsgReplaceVal = NULL; static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; ! static ROUTINE_MSG_REPLACE_NONE *pMsgInsertNone = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) --- 49,53 ---- static ROUTINE_MSG_INSERT_VAL *pMsgReplaceVal = NULL; static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; ! static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 09:06:52
|
Update of /cvsroot/com0com/hub4com/plugins In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9643/plugins Modified Files: plugins_api.h Log Message: Added HUB_ROUTINES_A::pFilterName Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** plugins_api.h 15 Aug 2008 12:44:59 -0000 1.6 --- plugins_api.h 20 Aug 2008 09:06:48 -0000 1.7 *************** *** 1,4 **** /* ! * $Id$ * * Copyright (c) 2008 Vyacheslav Frolov --- 1,4 ---- /* ! * plugins_api.h * * Copyright (c) 2008 Vyacheslav Frolov *************** *** 18,49 **** * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * - * $Log$ - * Revision 1.6 2008/08/15 12:44:59 vfrolov - * Added fake read filter method to ports - * - * Revision 1.5 2008/08/11 07:15:33 vfrolov - * Replaced - * HUB_MSG_TYPE_COM_FUNCTION - * HUB_MSG_TYPE_INIT_LSR_MASK - * HUB_MSG_TYPE_INIT_MST_MASK - * by - * HUB_MSG_TYPE_SET_PIN_STATE - * HUB_MSG_TYPE_GET_OPTIONS - * HUB_MSG_TYPE_SET_OPTIONS - * - * Revision 1.4 2008/04/14 07:32:03 vfrolov - * Renamed option --use-port-module to --use-driver - * - * Revision 1.3 2008/04/11 14:48:42 vfrolov - * Replaced SET_RT_EVENTS by INIT_LSR_MASK and INIT_MST_MASK - * Replaced COM_ERRORS by LINE_STATUS - * - * Revision 1.2 2008/04/07 12:20:51 vfrolov - * Added HUB_MSG_TYPE_SET_RT_EVENTS - * - * Revision 1.1 2008/03/26 08:38:37 vfrolov - * Initial revision - * */ --- 18,21 ---- *************** *** 117,120 **** --- 89,93 ---- DECLARE_HANDLE(HHUB); DECLARE_HANDLE(HMASTERPORT); + DECLARE_HANDLE(HFILTER); /*******************************************************************/ typedef BYTE *(CALLBACK ROUTINE_BUF_ALLOC)( *************** *** 151,154 **** --- 124,130 ---- HHUB hHub, int n); + typedef const char *(CALLBACK ROUTINE_FILTER_NAME_A)( + HHUB hHub, + HFILTER hFilter); typedef void (CALLBACK ROUTINE_ON_XOFF)( HHUB hHub, *************** *** 174,177 **** --- 150,154 ---- ROUTINE_NUM_PORTS *pNumPorts; ROUTINE_PORT_NAME_A *pPortName; + ROUTINE_FILTER_NAME_A *pFilterName; ROUTINE_ON_XOFF *pOnXoff; ROUTINE_ON_XON *pOnXon; *************** *** 225,230 **** const HUB_ROUTINES_A *pHubRoutines); /*******************************************************************/ - DECLARE_HANDLE(HFILTER); - /*******************************************************************/ typedef HFILTER (CALLBACK FILTER_CREATE_A)( HCONFIG hConfig, --- 202,205 ---- |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 09:06:52
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9643 Modified Files: export.cpp Log Message: Added HUB_ROUTINES_A::pFilterName Index: export.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/export.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** export.cpp 19 Aug 2008 16:45:27 -0000 1.2 --- export.cpp 20 Aug 2008 09:06:48 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/08/20 09:06:48 vfrolov + * Added HUB_ROUTINES_A::pFilterName + * * Revision 1.2 2008/08/19 16:45:27 vfrolov * Added missing size setting to msg_insert_buf() *************** *** 193,196 **** --- 196,207 ---- } /////////////////////////////////////////////////////////////// + static const char * CALLBACK filter_name(HHUB hHub, HFILTER hFilter) + { + _ASSERTE(hHub != NULL); + _ASSERTE(((ComHub *)hHub)->IsValid()); + + return ((ComHub *)hHub)->FilterName(hFilter); + } + /////////////////////////////////////////////////////////////// static void CALLBACK on_xoff(HHUB hHub, HMASTERPORT hMasterPort) { *************** *** 240,243 **** --- 251,255 ---- num_ports, port_name, + filter_name, on_xoff, on_xon, |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 08:46:09
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2083 Modified Files: comhub.cpp comhub.h Log Message: Implemented ComHub::FilterName() Index: comhub.h =================================================================== RCS file: /cvsroot/com0com/hub4com/comhub.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** comhub.h 15 Aug 2008 12:44:59 -0000 1.6 --- comhub.h 20 Aug 2008 08:46:06 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/08/20 08:46:06 vfrolov + * Implemented ComHub::FilterName() + * * Revision 1.6 2008/08/15 12:44:59 vfrolov * Added fake read filter method to ports *************** *** 102,105 **** --- 105,110 ---- } + const char *FilterName(HFILTER hFilter) const; + private: Ports ports; Index: comhub.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/comhub.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** comhub.cpp 15 Aug 2008 12:44:59 -0000 1.7 --- comhub.cpp 20 Aug 2008 08:46:06 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2008/08/20 08:46:06 vfrolov + * Implemented ComHub::FilterName() + * * Revision 1.7 2008/08/15 12:44:59 vfrolov * Added fake read filter method to ports *************** *** 257,259 **** --- 260,267 ---- ::RouteReport(routeFlowControlMap, "flow control"); } + + const char *ComHub::FilterName(HFILTER hFilter) const + { + return pFilters ? pFilters->FilterName(hFilter) : NULL; + } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-08-20 08:32:39
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29543 Modified Files: filters.cpp filters.h Log Message: Implemented Filters::FilterName() Index: filters.h =================================================================== RCS file: /cvsroot/com0com/hub4com/filters.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** filters.h 16 Apr 2008 14:13:59 -0000 1.2 --- filters.h 20 Aug 2008 08:32:35 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/08/20 08:32:35 vfrolov + * Implemented Filters::FilterName() + * * Revision 1.2 2008/04/16 14:13:59 vfrolov * Added ability to specify source posts for OUT method *************** *** 60,63 **** --- 63,67 ---- void Report() const; BOOL Init() const; + const char *FilterName(HFILTER hFilter) const; BOOL InMethod( int nFromPort, Index: filters.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/filters.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** filters.cpp 16 Apr 2008 14:13:59 -0000 1.2 --- filters.cpp 20 Aug 2008 08:32:35 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/08/20 08:32:35 vfrolov + * Implemented Filters::FilterName() + * * Revision 1.2 2008/04/16 14:13:59 vfrolov * Added ability to specify source posts for OUT method *************** *** 314,317 **** --- 317,330 ---- } /////////////////////////////////////////////////////////////// + const char *Filters::FilterName(HFILTER hFilter) const + { + for (FilterArray::const_iterator i = allFilters.begin() ; i != allFilters.end() ; i++) { + if (*i && (*i)->hFilter == hFilter) + return (*i)->name.c_str(); + } + + return NULL; + } + /////////////////////////////////////////////////////////////// static BOOL InMethod( int nFromPort, |
From: Vyacheslav F. <vf...@us...> - 2008-08-19 16:45:30
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1905 Modified Files: export.cpp Log Message: Added missing size setting to msg_insert_buf() Index: export.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/export.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** export.cpp 26 Mar 2008 08:35:03 -0000 1.1 --- export.cpp 19 Aug 2008 16:45:27 -0000 1.2 *************** *** 20,27 **** * * $Log$ * Revision 1.1 2008/03/26 08:35:03 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2008/08/19 16:45:27 vfrolov + * Added missing size setting to msg_insert_buf() + * * Revision 1.1 2008/03/26 08:35:03 vfrolov * Initial revision * */ *************** *** 47,51 **** { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_BUF); ! _ASSERTE(pMsg != NULL); if ((pMsg->type & HUB_MSG_UNION_TYPE_MASK) != HUB_MSG_UNION_TYPE_BUF) --- 49,55 ---- { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_BUF); ! ! if (!pMsg) ! return NULL; if ((pMsg->type & HUB_MSG_UNION_TYPE_MASK) != HUB_MSG_UNION_TYPE_BUF) *************** *** 71,74 **** --- 75,79 ---- if (pPrevMsg && pPrevMsg->type == type) { BufAppend(&pPrevMsg->u.buf.pBuf, pPrevMsg->u.buf.size, pSrc, sizeSrc); + pPrevMsg->u.buf.size += sizeSrc; return pPrevMsg; } *************** *** 102,106 **** { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_VAL); ! _ASSERTE(pMsg != NULL); ((HubMsg *)pMsg)->Clean(); --- 107,113 ---- { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_VAL); ! ! if (!pMsg) ! return NULL; ((HubMsg *)pMsg)->Clean(); *************** *** 135,139 **** { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_NONE); ! _ASSERTE(pMsg != NULL); ((HubMsg *)pMsg)->Clean(); --- 142,148 ---- { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_NONE); ! ! if (!pMsg) ! return NULL; ((HubMsg *)pMsg)->Clean(); |
From: Vyacheslav F. <vf...@us...> - 2008-08-19 12:41:08
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8459/sys Modified Files: handflow.c io.c ioctl.c Log Message: Replaces C0CE_INSERT_ENABLE_LSR_NBI (insertion on BREAK OFF) by C0CE_INSERT_ENABLE_LSR_BI (insertion on BREAK change) Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/io.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** io.c 26 Jun 2008 13:37:10 -0000 1.38 --- io.c 19 Aug 2008 12:40:58 -0000 1.39 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.39 2008/08/19 12:40:58 vfrolov + * Replaces C0CE_INSERT_ENABLE_LSR_NBI (insertion on BREAK OFF) + * by C0CE_INSERT_ENABLE_LSR_BI (insertion on BREAK change) + * * Revision 1.38 2008/06/26 13:37:10 vfrolov * Implemented noise emulation *************** *** 1398,1402 **** WaitComplete(pIoPortRead, pQueueToComplete); ! if (pIoPortRead->escapeChar && (pIoPortRead->insertMask & C0CE_INSERT_ENABLE_LSR)) { UCHAR lsr = 0x10; /* break interrupt indicator */ --- 1402,1408 ---- WaitComplete(pIoPortRead, pQueueToComplete); ! if (pIoPortRead->escapeChar && ! (pIoPortRead->insertMask & (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_LSR_BI))) ! { UCHAR lsr = 0x10; /* break interrupt indicator */ Index: handflow.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/handflow.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** handflow.c 11 Jul 2008 10:38:00 -0000 1.9 --- handflow.c 19 Aug 2008 12:40:58 -0000 1.10 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.10 2008/08/19 12:40:58 vfrolov + * Replaces C0CE_INSERT_ENABLE_LSR_NBI (insertion on BREAK OFF) + * by C0CE_INSERT_ENABLE_LSR_BI (insertion on BREAK change) + * * Revision 1.9 2008/07/11 10:38:00 vfrolov * Added nonstandard ability to enable LSR insertion on BREAK OFF *************** *** 405,409 **** pIoPortRead = pIoPort->pIoPortRemote; ! if (pIoPortRead->escapeChar && (pIoPortRead->insertMask & C0CE_INSERT_ENABLE_LSR_NBI)) { UCHAR lsr = 0; --- 409,413 ---- pIoPortRead = pIoPort->pIoPortRemote; ! if (pIoPortRead->escapeChar && (pIoPortRead->insertMask & C0CE_INSERT_ENABLE_LSR_BI)) { UCHAR lsr = 0; Index: ioctl.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/ioctl.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** ioctl.c 11 Jul 2008 10:38:00 -0000 1.37 --- ioctl.c 19 Aug 2008 12:40:58 -0000 1.38 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.38 2008/08/19 12:40:58 vfrolov + * Replaces C0CE_INSERT_ENABLE_LSR_NBI (insertion on BREAK OFF) + * by C0CE_INSERT_ENABLE_LSR_BI (insertion on BREAK change) + * * Revision 1.37 2008/07/11 10:38:00 vfrolov * Added nonstandard ability to enable LSR insertion on BREAK OFF *************** *** 636,640 **** C0CE_INSERT_ENABLE_RBR| \ C0CE_INSERT_ENABLE_RLC| \ ! C0CE_INSERT_ENABLE_LSR_NBI) #define C0CE_INSERT_CAPS (C0CE_INSERT_OPTS|C0CE_INSERT_BITS) --- 640,644 ---- C0CE_INSERT_ENABLE_RBR| \ C0CE_INSERT_ENABLE_RLC| \ ! C0CE_INSERT_ENABLE_LSR_BI) #define C0CE_INSERT_CAPS (C0CE_INSERT_OPTS|C0CE_INSERT_BITS) *************** *** 659,663 **** if (optsAndBits & C0CE_INSERT_IOCTL_GET) { ! if (optsAndBits & (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_LSR_NBI)) Information += sizeof(UCHAR)*2 + sizeof(UCHAR); if (optsAndBits & C0CE_INSERT_ENABLE_MST) --- 663,667 ---- if (optsAndBits & C0CE_INSERT_IOCTL_GET) { ! if (optsAndBits & (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_LSR_BI)) Information += sizeof(UCHAR)*2 + sizeof(UCHAR); if (optsAndBits & C0CE_INSERT_ENABLE_MST) *************** *** 701,705 **** if (optsAndBits & C0CE_INSERT_IOCTL_GET) { ! if (optsAndBits & (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_LSR_NBI)) { UCHAR lsr = 0; --- 705,709 ---- if (optsAndBits & C0CE_INSERT_IOCTL_GET) { ! if (optsAndBits & (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_LSR_BI)) { UCHAR lsr = 0; |
From: Vyacheslav F. <vf...@us...> - 2008-08-19 12:41:05
|
Update of /cvsroot/com0com/com0com/include In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8459/include Modified Files: cncext.h Log Message: Replaces C0CE_INSERT_ENABLE_LSR_NBI (insertion on BREAK OFF) by C0CE_INSERT_ENABLE_LSR_BI (insertion on BREAK change) Index: cncext.h =================================================================== RCS file: /cvsroot/com0com/com0com/include/cncext.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cncext.h 11 Jul 2008 10:34:43 -0000 1.3 --- cncext.h 19 Aug 2008 12:40:58 -0000 1.4 *************** *** 55,59 **** #define C0CE_INSERT_ENABLE_RBR 0x00000100 /* enable C0CE_INSERT_RBR insertion */ #define C0CE_INSERT_ENABLE_RLC 0x00000200 /* enable C0CE_INSERT_RLC insertion */ ! #define C0CE_INSERT_ENABLE_LSR_NBI 0x00010000 /* enable SERIAL_LSRMST_LSR_[NO]DATA insertion on BREAK OFF */ #endif /* _INCLUDE_C0C_CNCEXT_H_ */ --- 55,59 ---- #define C0CE_INSERT_ENABLE_RBR 0x00000100 /* enable C0CE_INSERT_RBR insertion */ #define C0CE_INSERT_ENABLE_RLC 0x00000200 /* enable C0CE_INSERT_RLC insertion */ ! #define C0CE_INSERT_ENABLE_LSR_BI 0x00000400 /* enable SERIAL_LSRMST_LSR_[NO]DATA insertion on BREAK change */ #endif /* _INCLUDE_C0C_CNCEXT_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-08-15 12:45:12
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21436 Modified Files: comhub.cpp comhub.h port.cpp port.h Log Message: Added fake read filter method to ports Index: port.h =================================================================== RCS file: /cvsroot/com0com/hub4com/port.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** port.h 26 Mar 2008 08:36:47 -0000 1.1 --- port.h 15 Aug 2008 12:44:59 -0000 1.2 *************** *** 20,27 **** * * $Log$ * Revision 1.1 2008/03/26 08:36:47 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.1 2008/03/26 08:36:47 vfrolov * Initial revision * */ *************** *** 51,54 **** --- 53,57 ---- BOOL Init(); BOOL Start(); + BOOL FakeReadFilter(HubMsg *pMsg); BOOL Write(HubMsg *pMsg); void AddXoff(); *************** *** 66,69 **** --- 69,73 ---- PORT_INIT *pInit; PORT_START *pStart; + PORT_FAKE_READ_FILTER *pFakeReadFilter; PORT_WRITE *pWrite; PORT_ADD_XOFF *pAddXoff; Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/port.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** port.cpp 26 Mar 2008 08:36:47 -0000 1.1 --- port.cpp 15 Aug 2008 12:44:59 -0000 1.2 *************** *** 20,27 **** * * $Log$ * Revision 1.1 2008/03/26 08:36:47 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.1 2008/03/26 08:36:47 vfrolov * Initial revision * */ *************** *** 34,38 **** : hub(_hub), num(_num), ! hPort(_hPort) { #ifdef _DEBUG --- 36,40 ---- : hub(_hub), num(_num), ! hPort(_hPort) { #ifdef _DEBUG *************** *** 61,66 **** pInit = ROUTINE_GET(pPortRoutines, pInit); pStart = ROUTINE_GET(pPortRoutines, pStart); pWrite = ROUTINE_GET(pPortRoutines, pWrite); - pAddXoff = ROUTINE_GET(pPortRoutines, pAddXoff); pAddXon = ROUTINE_GET(pPortRoutines, pAddXon); --- 63,68 ---- pInit = ROUTINE_GET(pPortRoutines, pInit); pStart = ROUTINE_GET(pPortRoutines, pStart); + pFakeReadFilter = ROUTINE_GET(pPortRoutines, pFakeReadFilter); pWrite = ROUTINE_GET(pPortRoutines, pWrite); pAddXoff = ROUTINE_GET(pPortRoutines, pAddXoff); pAddXon = ROUTINE_GET(pPortRoutines, pAddXon); *************** *** 91,94 **** --- 93,106 ---- } + BOOL Port::FakeReadFilter(HubMsg *pMsg) + { + _ASSERTE(pMsg != NULL); + + if (!pFakeReadFilter) + return TRUE; + + return pFakeReadFilter(hPort, (HUB_MSG *)pMsg); + } + BOOL Port::Write(HubMsg *pMsg) { Index: comhub.h =================================================================== RCS file: /cvsroot/com0com/hub4com/comhub.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** comhub.h 26 Mar 2008 08:48:18 -0000 1.5 --- comhub.h 15 Aug 2008 12:44:59 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.5 2008/03/26 08:48:18 vfrolov * Initial revision *************** *** 76,79 **** --- 79,83 ---- const char *pPath); BOOL StartAll() const; + BOOL OnFakeRead(Port *pFromPort, HubMsg *pMsg) const; void OnRead(Port *pFromPort, HubMsg *pMsg) const; void AddXoff(Port *pFromPort) const; Index: comhub.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/comhub.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** comhub.cpp 11 Aug 2008 07:15:33 -0000 1.6 --- comhub.cpp 15 Aug 2008 12:44:59 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.6 2008/08/11 07:15:33 vfrolov * Replaced *************** *** 96,100 **** msg.type = HUB_MSG_TYPE_SET_OPTIONS; ! OnRead(*i, &msg); } --- 99,122 ---- msg.type = HUB_MSG_TYPE_SET_OPTIONS; ! ! if (!OnFakeRead(*i, &msg)) ! return FALSE; ! } ! ! for (Ports::const_iterator i = ports.begin() ; i != ports.end() ; i++) { ! HubMsg msg; ! DWORD options = 0; ! ! msg.type = HUB_MSG_TYPE_GET_OPTIONS; ! msg.u.pv.pVal = &options; ! msg.u.pv.val = DWORD(-1); ! ! if (!OnFakeRead(*i, &msg)) ! return FALSE; ! ! if (options) { ! cout << (*i)->Name() << " WARNING: Requested option(s) 0x" ! << hex << options << dec << " not supported" << endl; ! } } *************** *** 107,110 **** --- 129,142 ---- } + BOOL ComHub::OnFakeRead(Port *pFromPort, HubMsg *pMsg) const + { + if (!pFromPort->FakeReadFilter(pMsg)) + return FALSE; + + OnRead(pFromPort, pMsg); + + return TRUE; + } + void ComHub::OnRead(Port *pFromPort, HubMsg *pMsg) const { |
From: Vyacheslav F. <vf...@us...> - 2008-08-15 12:45:06
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21436/plugins/serial Modified Files: comport.cpp comport.h import.h port.cpp Log Message: Added fake read filter method to ports Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** comport.cpp 13 Aug 2008 15:14:02 -0000 1.5 --- comport.cpp 15 Aug 2008 12:44:59 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.5 2008/08/13 15:14:02 vfrolov * Print bit values in readable form *************** *** 76,79 **** --- 79,83 ---- events(0), maskOutPins(0), + options(0), writeQueueLimit(256), writeQueued(0), *************** *** 172,187 **** BOOL ComPort::Start() { _ASSERTE(hMasterPort != NULL); _ASSERTE(hHub != NULL); _ASSERTE(handle != INVALID_HANDLE_VALUE); - HUB_MSG msg; - - DWORD options = 0; - msg.type = HUB_MSG_TYPE_GET_OPTIONS; - msg.u.pv.pVal = &options; - msg.u.pv.val = 0xFFFFFFFF; - pOnRead(hHub, hMasterPort, &msg); - BYTE optsLsr = GO_O2V_LINE_STATUS(options); BYTE optsMst = GO_O2V_MODEM_STATUS(options); --- 176,185 ---- BOOL ComPort::Start() { + //cout << name << " Start " << ::GetCurrentThreadId() << endl; + _ASSERTE(hMasterPort != NULL); _ASSERTE(hHub != NULL); _ASSERTE(handle != INVALID_HANDLE_VALUE); BYTE optsLsr = GO_O2V_LINE_STATUS(options); BYTE optsMst = GO_O2V_MODEM_STATUS(options); *************** *** 234,237 **** --- 232,237 ---- return FALSE; + HUB_MSG msg; + msg.type = HUB_MSG_TYPE_CONNECT; msg.u.val = TRUE; *************** *** 268,271 **** --- 268,290 ---- } + BOOL ComPort::FakeReadFilter(HUB_MSG *pInMsg) + { + _ASSERTE(pInMsg != NULL); + + if (pInMsg->type == HUB_MSG_TYPE_GET_OPTIONS) { + pInMsg->u.pv.val &= ~(GO_V2O_MODEM_STATUS(-1) | GO_V2O_LINE_STATUS(-1)); + + pInMsg = pMsgInsertNone(pInMsg, HUB_MSG_TYPE_EMPTY); + + if (pInMsg) { + pInMsg->type = HUB_MSG_TYPE_GET_OPTIONS; + pInMsg->u.pv.pVal = &options; + pInMsg->u.pv.val = GO_V2O_MODEM_STATUS(-1) | GO_V2O_LINE_STATUS(-1); + } + } + + return pInMsg != NULL; + } + static FIELD2NAME codeNameTableSetPinState[] = { TOFIELD2NAME2(PIN_STATE_, RTS), *************** *** 432,439 **** countWaitCommEventOverlapped++; ! //cout << name << " Started WaitCommEvent " << countReadOverlapped ! // << " " << hex << events << dec << " [" ! // << FieldToName(codeNameTableComEvents, events) ! // << "] << endl; return TRUE; --- 451,460 ---- countWaitCommEventOverlapped++; ! /* ! cout << name << " Started WaitCommEvent " << countReadOverlapped ! << " " << hex << events << dec << " [" ! << FieldToName(codeNameTableComEvents, events) ! << "] << endl; ! */ return TRUE; *************** *** 442,445 **** --- 463,468 ---- void ComPort::OnWrite(WriteOverlapped *pOverlapped, DWORD len, DWORD done) { + //cout << name << " OnWrite " << ::GetCurrentThreadId() << endl; + delete pOverlapped; *************** *** 455,458 **** --- 478,483 ---- void ComPort::OnRead(ReadOverlapped *pOverlapped, BYTE *pBuf, DWORD done) { + //cout << name << " OnRead " << ::GetCurrentThreadId() << endl; + HUB_MSG msg; *************** *** 467,471 **** countReadOverlapped--; ! //cout << name << " Stopped Read " << countReadOverlapped << endl; } } --- 492,496 ---- countReadOverlapped--; ! cout << name << " Stopped Read " << countReadOverlapped << endl; } } *************** *** 473,476 **** --- 498,509 ---- void ComPort::OnCommEvent(WaitCommEventOverlapped *pOverlapped, DWORD eMask) { + //cout << name << " OnCommEvent " << ::GetCurrentThreadId() << endl; + + /* + cout << name << " Event(s): 0x" << hex << eMask << dec << " [" + << FieldToName(codeNameTableComEvents, eMask) + << "]" << endl; + */ + CheckComEvents(eMask); *************** *** 479,483 **** countWaitCommEventOverlapped--; ! //cout << name << " Stopped WaitCommEvent " << countWaitCommEventOverlapped << endl; } } --- 512,516 ---- countWaitCommEventOverlapped--; ! cout << name << " Stopped WaitCommEvent " << countWaitCommEventOverlapped << endl; } } *************** *** 489,492 **** --- 522,532 ---- if (::GetCommModemStatus(handle, &stat)) { + /* + cout << name << " MODEM STATUS bit(s): 0x" + << hex << stat << dec << " [" + << FieldToName(codeNameTableModemStatus, stat) + << "]" << endl; + */ + HUB_MSG msg; Index: import.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/import.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** import.h 26 Mar 2008 08:41:18 -0000 1.1 --- import.h 15 Aug 2008 12:44:59 -0000 1.2 *************** *** 20,27 **** * * $Log$ * Revision 1.1 2008/03/26 08:41:18 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.1 2008/03/26 08:41:18 vfrolov * Initial revision * */ *************** *** 34,37 **** --- 36,40 ---- extern ROUTINE_BUF_ALLOC *pBufAlloc; extern ROUTINE_BUF_FREE *pBufFree; + extern ROUTINE_MSG_INSERT_NONE *pMsgInsertNone; extern ROUTINE_ON_XOFF *pOnXoff; extern ROUTINE_ON_XON *pOnXon; Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/port.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** port.cpp 13 Aug 2008 14:33:18 -0000 1.5 --- port.cpp 15 Aug 2008 12:44:59 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.5 2008/08/13 14:33:18 vfrolov * Fixed Help *************** *** 107,112 **** << endl << "Input data stream description:" << endl - << " GET_OPTIONS(<pOpts>) - the port sends this message at starting to get the" << endl - << " required input data stream options." << endl << " LINE_DATA(<data>) - readed <data> from serial port." << endl << " CONNECT(TRUE) - serial port started." << endl --- 110,113 ---- *************** *** 114,117 **** --- 115,129 ---- << " MODEM_STATUS(<val>) - current state of modem." << endl << endl + << "Fake read filter input data stream description:" << endl + << " GET_OPTIONS(<pOpts>,<mask>)" << endl + << " - the port removes bits from <mask> in this message" << endl + << " for locally supported input data stream options." << endl + << endl + << "Fake read filter output data stream description:" << endl + << " GET_OPTIONS(<pOpts>,<mask>)" << endl + << " - the port adds this message at detecting the" << endl + << " GET_OPTIONS message in the stream to get the" << endl + << " required input data stream options." << endl + << endl << "Examples:" << endl << " " << pProgPath << " COM1 \\\\.\\CNCB1 \\\\.\\CNCB2" << endl *************** *** 271,274 **** --- 283,296 ---- } /////////////////////////////////////////////////////////////// + static BOOL CALLBACK FakeReadFilter( + HPORT hPort, + HUB_MSG *pMsg) + { + _ASSERTE(hPort != NULL); + _ASSERTE(pMsg != NULL); + + return ((ComPort *)hPort)->FakeReadFilter(pMsg); + } + /////////////////////////////////////////////////////////////// static BOOL CALLBACK Write( HPORT hPort, *************** *** 318,321 **** --- 340,344 ---- Init, Start, + FakeReadFilter, Write, AddXoff, *************** *** 331,334 **** --- 354,358 ---- ROUTINE_BUF_ALLOC *pBufAlloc; ROUTINE_BUF_FREE *pBufFree; + ROUTINE_MSG_INSERT_NONE *pMsgInsertNone; ROUTINE_ON_XOFF *pOnXoff; ROUTINE_ON_XON *pOnXon; *************** *** 341,344 **** --- 365,369 ---- if (!ROUTINE_IS_VALID(pHubRoutines, pBufAlloc) || !ROUTINE_IS_VALID(pHubRoutines, pBufFree) || + !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertNone) || !ROUTINE_IS_VALID(pHubRoutines, pOnXoff) || !ROUTINE_IS_VALID(pHubRoutines, pOnXon) || *************** *** 350,353 **** --- 375,379 ---- pBufAlloc = pHubRoutines->pBufAlloc; pBufFree = pHubRoutines->pBufFree; + pMsgInsertNone = pHubRoutines->pMsgInsertNone; pOnXoff = pHubRoutines->pOnXoff; pOnXon = pHubRoutines->pOnXon; Index: comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** comport.h 13 Aug 2008 15:14:02 -0000 1.5 --- comport.h 15 Aug 2008 12:44:59 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.5 2008/08/13 15:14:02 vfrolov * Print bit values in readable form *************** *** 75,78 **** --- 78,82 ---- BOOL Init(HMASTERPORT _hMasterPort, HHUB _hHub); BOOL Start(); + BOOL FakeReadFilter(HUB_MSG *pInMsg); BOOL Write(HUB_MSG *pMsg); void OnWrite(WriteOverlapped *pOverlapped, DWORD len, DWORD done); *************** *** 101,104 **** --- 105,109 ---- DWORD events; BYTE maskOutPins; + DWORD options; DWORD writeQueueLimit; |
From: Vyacheslav F. <vf...@us...> - 2008-08-15 12:45:06
|
Update of /cvsroot/com0com/hub4com/plugins/tcp In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21436/plugins/tcp Modified Files: port.cpp Log Message: Added fake read filter method to ports Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/port.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** port.cpp 14 Apr 2008 07:32:04 -0000 1.3 --- port.cpp 15 Aug 2008 12:44:59 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.3 2008/04/14 07:32:04 vfrolov * Renamed option --use-port-module to --use-driver *************** *** 247,250 **** --- 250,254 ---- Init, Start, + NULL, // FakeReadFilter Write, AddXoff, |
From: Vyacheslav F. <vf...@us...> - 2008-08-15 12:45:03
|
Update of /cvsroot/com0com/hub4com/plugins In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21436/plugins Modified Files: plugins_api.h Log Message: Added fake read filter method to ports Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** plugins_api.h 11 Aug 2008 07:15:33 -0000 1.5 --- plugins_api.h 15 Aug 2008 12:44:59 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.5 2008/08/11 07:15:33 vfrolov * Replaced *************** *** 266,269 **** --- 269,275 ---- typedef BOOL (CALLBACK PORT_START)( HPORT hPort); + typedef BOOL (CALLBACK PORT_FAKE_READ_FILTER)( + HPORT hPort, + HUB_MSG *pInMsg); typedef BOOL (CALLBACK PORT_WRITE)( HPORT hPort, *************** *** 283,286 **** --- 289,293 ---- PORT_INIT *pInit; PORT_START *pStart; + PORT_FAKE_READ_FILTER *pFakeReadFilter; PORT_WRITE *pWrite; PORT_ADD_XOFF *pAddXoff; |
From: Vyacheslav F. <vf...@us...> - 2008-08-14 15:19:27
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7308 Modified Files: comio.cpp comio.h Log Message: Execute OnCommEvent() in main thread context Index: comio.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** comio.h 11 Aug 2008 07:15:34 -0000 1.3 --- comio.h 14 Aug 2008 15:19:07 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/08/14 15:19:07 vfrolov + * Execute OnCommEvent() in main thread context + * * Revision 1.3 2008/08/11 07:15:34 vfrolov * Replaced *************** *** 107,110 **** --- 110,114 ---- PVOID pParameter, BOOLEAN timerOrWaitFired); + static VOID CALLBACK OnCommEvent(ULONG_PTR pOverlapped); ComPort &port; Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** comio.cpp 11 Aug 2008 07:15:33 -0000 1.3 --- comio.cpp 14 Aug 2008 15:19:07 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2008/08/14 15:19:07 vfrolov + * Execute OnCommEvent() in main thread context + * * Revision 1.3 2008/08/11 07:15:33 vfrolov * Replaced *************** *** 351,358 **** --- 354,383 ---- } /////////////////////////////////////////////////////////////// + static HANDLE hThread = INVALID_HANDLE_VALUE; + WaitCommEventOverlapped::WaitCommEventOverlapped(ComPort &_port) : port(_port), hWait(INVALID_HANDLE_VALUE) { + if (hThread == INVALID_HANDLE_VALUE) { + if (!::DuplicateHandle(::GetCurrentProcess(), + ::GetCurrentThread(), + ::GetCurrentProcess(), + &hThread, + 0, + FALSE, + DUPLICATE_SAME_ACCESS)) + { + hThread = INVALID_HANDLE_VALUE; + + TraceError( + GetLastError(), + "WaitCommEventOverlapped::WaitCommEventOverlapped(): DuplicateHandle() %s", + port.Name().c_str()); + + return; + } + } + ::memset((OVERLAPPED *)this, 0, sizeof(OVERLAPPED)); *************** *** 368,372 **** } ! if (!::RegisterWaitForSingleObject(&hWait, hEvent, OnCommEvent, this, INFINITE, WT_EXECUTEINIOTHREAD)) { TraceError( GetLastError(), --- 393,397 ---- } ! if (!::RegisterWaitForSingleObject(&hWait, hEvent, OnCommEvent, this, INFINITE, WT_EXECUTEINWAITTHREAD)) { TraceError( GetLastError(), *************** *** 405,408 **** --- 430,438 ---- BOOLEAN /*timerOrWaitFired*/) { + ::QueueUserAPC(OnCommEvent, hThread, (ULONG_PTR)pOverlapped); + } + + VOID CALLBACK WaitCommEventOverlapped::OnCommEvent(ULONG_PTR pOverlapped) + { WaitCommEventOverlapped *pOver = (WaitCommEventOverlapped *)pOverlapped; |
From: Vyacheslav F. <vf...@us...> - 2008-08-14 09:49:51
|
Update of /cvsroot/com0com/hub4com/plugins/pinmap In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv17168 Modified Files: filter.cpp Log Message: Fixed output pins masking Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pinmap/filter.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** filter.cpp 13 Aug 2008 14:31:41 -0000 1.2 --- filter.cpp 14 Aug 2008 09:49:45 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/08/14 09:49:45 vfrolov + * Fixed output pins masking + * * Revision 1.2 2008/08/13 14:31:41 vfrolov * Fixed Help *************** *** 307,316 **** continue; ! mask |= (DWORD)filter.pinMap[iIn].mask; if ((inVal & pinIn_names[iIn].val) != 0) ! val |= (filter.pinMap[iIn].val & mask); else ! val |= (~filter.pinMap[iIn].val & mask); } --- 310,319 ---- continue; ! mask |= filter.pinMap[iIn].mask; if ((inVal & pinIn_names[iIn].val) != 0) ! val |= (filter.pinMap[iIn].val & filter.pinMap[iIn].mask); else ! val |= (~filter.pinMap[iIn].val & filter.pinMap[iIn].mask); } |
From: Vyacheslav F. <vf...@us...> - 2008-08-13 15:14:06
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14975 Modified Files: comport.cpp comport.h Log Message: Print bit values in readable form Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** comport.cpp 11 Aug 2008 07:15:34 -0000 1.4 --- comport.cpp 13 Aug 2008 15:14:02 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/08/13 15:14:02 vfrolov + * Print bit values in readable form + * * Revision 1.4 2008/08/11 07:15:34 vfrolov * Replaced *************** *** 98,101 **** --- 101,173 ---- } + struct FIELD2NAME { + DWORD code; + DWORD mask; + const char *name; + }; + + static string FieldToName(const FIELD2NAME *pTable, DWORD mask, const char *pDelimiter = "|") + { + stringstream str; + int count = 0; + + if (pTable) { + while (pTable->name) { + DWORD m = (mask & pTable->mask); + + if (m == pTable->code) { + mask &= ~pTable->mask; + if (count) + str << pDelimiter; + str << pTable->name; + count++; + } + pTable++; + } + } + + if (mask) { + if (count) + str << pDelimiter; + str << "0x" << hex << (long)mask << dec; + } + + return str.str(); + } + + #define TOFIELD2NAME2(p, s) { (ULONG)p##s, (ULONG)p##s, #s } + + static FIELD2NAME codeNameTableModemStatus[] = { + TOFIELD2NAME2(MODEM_STATUS_, DCTS), + TOFIELD2NAME2(MODEM_STATUS_, DDSR), + TOFIELD2NAME2(MODEM_STATUS_, TERI), + TOFIELD2NAME2(MODEM_STATUS_, DDCD), + TOFIELD2NAME2(MODEM_STATUS_, CTS), + TOFIELD2NAME2(MODEM_STATUS_, DSR), + TOFIELD2NAME2(MODEM_STATUS_, RI), + TOFIELD2NAME2(MODEM_STATUS_, DCD), + {0, 0, NULL} + }; + + static FIELD2NAME codeNameTableLineStatus[] = { + TOFIELD2NAME2(LINE_STATUS_, DR), + TOFIELD2NAME2(LINE_STATUS_, OE), + TOFIELD2NAME2(LINE_STATUS_, PE), + TOFIELD2NAME2(LINE_STATUS_, FE), + TOFIELD2NAME2(LINE_STATUS_, BI), + TOFIELD2NAME2(LINE_STATUS_, THRE), + TOFIELD2NAME2(LINE_STATUS_, TEMT), + TOFIELD2NAME2(LINE_STATUS_, FIFOERR), + {0, 0, NULL} + }; + + static FIELD2NAME codeNameTableComEvents[] = { + TOFIELD2NAME2(EV_, CTS), + TOFIELD2NAME2(EV_, DSR), + TOFIELD2NAME2(EV_, RLSD), + TOFIELD2NAME2(EV_, RING), + {0, 0, NULL} + }; + BOOL ComPort::Start() { *************** *** 111,116 **** msg.u.pv.val = 0xFFFFFFFF; pOnRead(hHub, hMasterPort, &msg); ! optsLsr = GO_O2V_LINE_STATUS(options); ! optsMst = GO_O2V_MODEM_STATUS(options); if (optsLsr || optsMst) { --- 183,189 ---- msg.u.pv.val = 0xFFFFFFFF; pOnRead(hHub, hMasterPort, &msg); ! ! BYTE optsLsr = GO_O2V_LINE_STATUS(options); ! BYTE optsMst = GO_O2V_MODEM_STATUS(options); if (optsLsr || optsMst) { *************** *** 127,140 **** events |= EV_RING; ! if (optsMst & ~(MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI)) { ! cout << name << " WARNING: Changing of MODEM STATUS bit(s) 0x" << hex ! << (unsigned)(optsMst & ~(MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI)) ! << dec << " will be ignored" << endl; } if (optsLsr) { ! cout << name << " WARNING: Changing of LINE STATUS bit(s) 0x" << hex ! << (unsigned)optsLsr ! << dec << " will be ignored" << endl; } } --- 200,217 ---- events |= EV_RING; ! optsMst &= ~(MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI); ! ! if (optsMst) { ! cout << name << " WARNING: Changing of MODEM STATUS bit(s) 0x" ! << hex << (unsigned)optsMst << dec << " [" ! << FieldToName(codeNameTableModemStatus, optsMst) ! << "] will be ignored" << endl; } if (optsLsr) { ! cout << name << " WARNING: Changing of LINE STATUS bit(s) 0x" ! << hex << (unsigned)optsLsr << dec << " [" ! << FieldToName(codeNameTableLineStatus, optsLsr) ! << "] will be ignored" << endl; } } *************** *** 147,151 **** return FALSE; ! cout << name << " Event(s) 0x" << hex << events << dec << " will be monitired" << endl; } --- 224,230 ---- return FALSE; ! cout << name << " Event(s) 0x" << hex << events << dec << " [" ! << FieldToName(codeNameTableComEvents, events) ! << "] will be monitired" << endl; } *************** *** 189,192 **** --- 268,280 ---- } + static FIELD2NAME codeNameTableSetPinState[] = { + TOFIELD2NAME2(PIN_STATE_, RTS), + TOFIELD2NAME2(PIN_STATE_, DTR), + TOFIELD2NAME2(PIN_STATE_, OUT1), + TOFIELD2NAME2(PIN_STATE_, OUT2), + TOFIELD2NAME2(PIN_STATE_, BREAK), + {0, 0, NULL} + }; + BOOL ComPort::Write(HUB_MSG *pMsg) { *************** *** 259,265 **** return FALSE; ! cout << name << " SET_PIN_STATE 0x" << hex << pMsg->u.val << dec << endl; ! WORD mask = (SPS_MASK2PIN(pMsg->u.val) & maskOutPins); if (mask & PIN_STATE_RTS) { --- 347,359 ---- return FALSE; ! WORD mask = SPS_MASK2PIN(pMsg->u.val); ! cout << name << " SET_PIN_STATE 0x" << hex << pMsg->u.val << dec << " SET[" ! << FieldToName(codeNameTableSetPinState, pMsg->u.val & mask) ! << "] CLR[" ! << FieldToName(codeNameTableSetPinState, ~pMsg->u.val & mask) ! << "]" << endl; ! ! mask &= maskOutPins; if (mask & PIN_STATE_RTS) { *************** *** 339,343 **** //cout << name << " Started WaitCommEvent " << countReadOverlapped ! // << " " << hex << events << dec << endl; return TRUE; --- 433,439 ---- //cout << name << " Started WaitCommEvent " << countReadOverlapped ! // << " " << hex << events << dec << " [" ! // << FieldToName(codeNameTableComEvents, events) ! // << "] << endl; return TRUE; *************** *** 420,423 **** --- 516,529 ---- } + static FIELD2NAME codeNameTableCommErrors[] = { + TOFIELD2NAME2(CE_, RXOVER), + TOFIELD2NAME2(CE_, OVERRUN), + TOFIELD2NAME2(CE_, RXPARITY), + TOFIELD2NAME2(CE_, FRAME), + TOFIELD2NAME2(CE_, BREAK), + TOFIELD2NAME2(CE_, TXFULL), + {0, 0, NULL} + }; + void ComPort::LostReport() { *************** *** 433,445 **** if (errors) { ! cout << "Error " << name << ":"; ! ! if (errors & CE_RXOVER) { cout << " RXOVER"; errors &= ~CE_RXOVER; } ! if (errors & CE_OVERRUN) { cout << " OVERRUN"; errors &= ~CE_OVERRUN; } ! if (errors & CE_RXPARITY) { cout << " RXPARITY"; errors &= ~CE_RXPARITY; } ! if (errors & CE_FRAME) { cout << " FRAME"; errors &= ~CE_FRAME; } ! if (errors & CE_BREAK) { cout << " BREAK"; errors &= ~CE_BREAK; } ! if (errors & CE_TXFULL) { cout << " TXFULL"; errors &= ~CE_TXFULL; } ! if (errors) { cout << " 0x" << hex << errors << dec; errors = 0; } #define IOCTL_SERIAL_GET_STATS CTL_CODE(FILE_DEVICE_SERIAL_PORT,35,METHOD_BUFFERED,FILE_ANY_ACCESS) --- 539,544 ---- if (errors) { ! cout << "Error " << name << ": " << FieldToName(codeNameTableCommErrors, errors, " "); ! errors = 0; #define IOCTL_SERIAL_GET_STATS CTL_CODE(FILE_DEVICE_SERIAL_PORT,35,METHOD_BUFFERED,FILE_ANY_ACCESS) Index: comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** comport.h 11 Aug 2008 07:15:34 -0000 1.4 --- comport.h 13 Aug 2008 15:14:02 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/08/13 15:14:02 vfrolov + * Print bit values in readable form + * * Revision 1.4 2008/08/11 07:15:34 vfrolov * Replaced *************** *** 98,103 **** DWORD events; BYTE maskOutPins; - BYTE optsLsr; - BYTE optsMst; DWORD writeQueueLimit; --- 101,104 ---- |
From: Vyacheslav F. <vf...@us...> - 2008-08-13 14:33:21
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32665 Modified Files: port.cpp Log Message: Fixed Help Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/port.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** port.cpp 14 Apr 2008 07:32:04 -0000 1.4 --- port.cpp 13 Aug 2008 14:33:18 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/08/13 14:33:18 vfrolov + * Fixed Help + * * Revision 1.4 2008/04/14 07:32:04 vfrolov * Renamed option --use-port-module to --use-driver *************** *** 99,112 **** << endl << "Output data stream description:" << endl << " LINE_DATA(<data>) - write <data> to serial port." << endl ! << " COM_FUNCTION(<function>) - direct serial port to perform <function>." << endl ! << " SET_RT_EVENTS(<mask>) - direct serial port to monitor <mask> real-time" << endl ! << " events." << endl << endl << "Input data stream description:" << endl << " LINE_DATA(<data>) - readed <data> from serial port." << endl << " CONNECT(TRUE) - serial port started." << endl ! << " MODEM_STATUS(<value>) - modem control register changed to <value>." << endl ! << " COM_ERRORS(<mask>) - occured communications errors indicated in <mask>." << endl << endl << "Examples:" << endl --- 102,116 ---- << endl << "Output data stream description:" << endl + << " SET_OPTIONS(<opts>) - or'e <opts> with the output data stream options." << endl << " LINE_DATA(<data>) - write <data> to serial port." << endl ! << " SET_PIN_STATE(<state>) - set serial port pins to required state." << endl << endl << "Input data stream description:" << endl + << " GET_OPTIONS(<pOpts>) - the port sends this message at starting to get the" << endl + << " required input data stream options." << endl << " LINE_DATA(<data>) - readed <data> from serial port." << endl << " CONNECT(TRUE) - serial port started." << endl ! << " LINE_STATUS(<val>) - current state of line." << endl ! << " MODEM_STATUS(<val>) - current state of modem." << endl << endl << "Examples:" << endl |