[Com0com-cvs] hub4com/plugins/serial comport.cpp, 1.25, 1.26 comport.h, 1.17, 1.18
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
From: Vyacheslav F. <vf...@us...> - 2011-05-19 16:47:02
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory vz-cvs-2.sog:/tmp/cvs-serv32284 Modified Files: comport.cpp comport.h Log Message: Fixed unexpected assertion Added human readable printing output options set Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** comport.cpp 14 Sep 2010 16:31:50 -0000 1.25 --- comport.cpp 19 May 2011 16:46:59 -0000 1.26 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.26 2011/05/19 16:46:59 vfrolov + * Fixed unexpected assertion + * Added human readable printing output options set + * * Revision 1.25 2010/09/14 16:31:50 vfrolov * Implemented --write-limit=0 to disable writing to the port *************** *** 219,222 **** --- 223,245 ---- }; /////////////////////////////////////////////////////////////// + static const FIELD2NAME fieldNameTableSetPinState[] = { + TOFIELD2NAME2(PIN_STATE_, RTS), + TOFIELD2NAME2(PIN_STATE_, DTR), + TOFIELD2NAME2(PIN_STATE_, OUT1), + TOFIELD2NAME2(PIN_STATE_, OUT2), + TOFIELD2NAME2(PIN_STATE_, CTS), + TOFIELD2NAME2(PIN_STATE_, DSR), + TOFIELD2NAME2(PIN_STATE_, RI), + TOFIELD2NAME2(PIN_STATE_, DCD), + TOFIELD2NAME2(PIN_STATE_, BREAK), + {0, 0, NULL} + }; + /////////////////////////////////////////////////////////////// + static const FIELD2NAME fieldNameTableSoOptions[] = { + TOFIELD2NAME2(SO_, SET_BR), + TOFIELD2NAME2(SO_, SET_LC), + {0, 0, NULL} + }; + /////////////////////////////////////////////////////////////// static const FIELD2NAME fieldNameTableComEvents[] = { TOFIELD2NAME2(EV_, CTS), *************** *** 290,293 **** --- 313,319 ---- countXoff(0), outOptions(0), + #ifdef _DEBUG + outOptionsRequested(0), + #endif writeQueueLimit(comParams.WriteQueueLimit()), writeQueued(0), *************** *** 439,445 **** } ! cout << name << " Event(s) 0x" << hex << events << dec << " ["; PrintFields(cout, fieldNameTableComEvents, events); ! cout << "] will be monitired" << endl; } --- 465,471 ---- } ! cout << name << " Event(s) ["; PrintFields(cout, fieldNameTableComEvents, events); ! cout << "] will be monitored" << endl; } *************** *** 689,705 **** } case HUB_MSG_T2N(HUB_MSG_TYPE_SET_PIN_STATE): ! _ASSERTE((~SO_O2V_PIN_STATE(outOptions) & MASK2VAL(pMsg->u.val)) == 0); if (!pComIo) return FALSE; ! pComIo->SetPinState((WORD)pMsg->u.val, MASK2VAL(pMsg->u.val)); break; case HUB_MSG_T2N(HUB_MSG_TYPE_SET_BR): { ! _ASSERTE(outOptions & SO_SET_BR); if (!pComIo) return FALSE; DWORD oldVal = pComIo->BaudRate(); DWORD curVal = pComIo->SetBaudRate(pMsg->u.val); --- 715,734 ---- } case HUB_MSG_T2N(HUB_MSG_TYPE_SET_PIN_STATE): ! _ASSERTE((~SO_O2V_PIN_STATE(outOptionsRequested) & MASK2VAL(pMsg->u.val)) == 0); if (!pComIo) return FALSE; ! pComIo->SetPinState((WORD)pMsg->u.val, SO_O2V_PIN_STATE(outOptions) & MASK2VAL(pMsg->u.val)); break; case HUB_MSG_T2N(HUB_MSG_TYPE_SET_BR): { ! _ASSERTE(outOptionsRequested & SO_SET_BR); if (!pComIo) return FALSE; + if ((outOptions & SO_SET_BR) == 0) + break; + DWORD oldVal = pComIo->BaudRate(); DWORD curVal = pComIo->SetBaudRate(pMsg->u.val); *************** *** 733,741 **** } case HUB_MSG_T2N(HUB_MSG_TYPE_SET_LC): { ! _ASSERTE(outOptions & SO_SET_LC); if (!pComIo) return FALSE; DWORD oldVal = pComIo->LineControl(); DWORD curVal = pComIo->SetLineControl(pMsg->u.val); --- 762,773 ---- } case HUB_MSG_T2N(HUB_MSG_TYPE_SET_LC): { ! _ASSERTE(outOptionsRequested & SO_SET_LC); if (!pComIo) return FALSE; + if ((outOptions & SO_SET_LC) == 0) + break; + DWORD oldVal = pComIo->LineControl(); DWORD curVal = pComIo->SetLineControl(pMsg->u.val); *************** *** 793,801 **** } case HUB_MSG_T2N(HUB_MSG_TYPE_PURGE_TX): ! _ASSERTE(outOptions & SO_PURGE_TX); if (!pComIo) return FALSE; PurgeWrite(FALSE); FlowControlUpdate(); --- 825,836 ---- } case HUB_MSG_T2N(HUB_MSG_TYPE_PURGE_TX): ! _ASSERTE(outOptionsRequested & SO_PURGE_TX); if (!pComIo) return FALSE; + if ((outOptions & SO_PURGE_TX) == 0) + break; + PurgeWrite(FALSE); FlowControlUpdate(); *************** *** 805,808 **** --- 840,847 ---- return FALSE; + #ifdef _DEBUG + outOptionsRequested |= pMsg->u.val; + #endif + pMsg->u.val &= ~outOptions; *************** *** 843,849 **** if (pMsg->u.val) { ! cerr << name << " WARNING: Requested output option(s) [0x" ! << hex << pMsg->u.val << dec ! << "] will be ignored by driver" << endl; } break; --- 882,890 ---- if (pMsg->u.val) { ! cerr << name << " WARNING: Requested output option(s) ["; ! BOOL delimitNext = FALSE; ! delimitNext = PrintFields(cerr, fieldNameTableSetPinState, SO_O2V_PIN_STATE(pMsg->u.val), delimitNext, "SET_"); ! PrintFields(cerr, fieldNameTableSoOptions, pMsg->u.val & ~SO_V2O_PIN_STATE(-1), delimitNext); ! cerr << "] will be ignored by driver" << endl; } break; *************** *** 941,947 **** void ComPort::OnCommEvent(WaitCommEventOverlapped *pOverlapped, DWORD eMask) { ! //cout << name << " OnCommEvent " << ::GetCurrentThreadId() << endl; ! ! //cout << name << " Event(s): 0x" << hex << eMask << dec << " ["; //PrintFields(cout, fieldNameTableComEvents, eMask); //cout << "]" << endl; --- 982,986 ---- void ComPort::OnCommEvent(WaitCommEventOverlapped *pOverlapped, DWORD eMask) { ! //cout << name << " OnCommEvent " << ::GetCurrentThreadId() << " ["; //PrintFields(cout, fieldNameTableComEvents, eMask); //cout << "]" << endl; Index: comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** comport.h 18 Dec 2008 16:50:52 -0000 1.17 --- comport.h 19 May 2011 16:47:00 -0000 1.18 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.18 2011/05/19 16:47:00 vfrolov + * Fixed unexpected assertion + * Added human readable printing output options set + * * Revision 1.17 2008/12/18 16:50:52 vfrolov * Extended the number of possible IN options *************** *** 146,149 **** --- 150,156 ---- DWORD inOptions[2]; DWORD outOptions; + #ifdef _DEBUG + DWORD outOptionsRequested; + #endif DWORD writeQueueLimit; |