• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision10586 (tree)
Time2023-02-06 22:26:02
Authorzmatsuo

Log Message

シリアルのハードフローが動作しない対策,パラメータ設定

- パラメータ設定(SetCommState())時、設定値に誤りがあったので修正

- dcb.XonChar, XoffChar メンバが同じ値になっていた

Change Summary

Incremental Difference

--- branches/ttcomtester/teraterm/teraterm/commlib.c (revision 10585)
+++ branches/ttcomtester/teraterm/teraterm/commlib.c (revision 10586)
@@ -33,6 +33,7 @@
3333 #include "tttypes.h"
3434 #include "tt_res.h"
3535 #include <process.h>
36+#include <assert.h>
3637
3738 #include "ttcommon.h"
3839 #include "ttwsk.h"
@@ -203,14 +204,18 @@
203204
204205 dcb.fDtrControl = DTR_CONTROL_ENABLE;
205206 dcb.fRtsControl = RTS_CONTROL_ENABLE;
207+#if 1
208+ dcb.XonChar = XON;
209+ dcb.XoffChar = XOFF;
210+#endif
206211 switch (ts->Flow) {
207212 case IdFlowX:
213+ dcb.XonChar = XON;
214+ dcb.XoffChar = XOFF;
208215 dcb.fOutX = TRUE;
209216 dcb.fInX = TRUE;
210217 dcb.XonLim = CommXonLim;
211218 dcb.XoffLim = CommXoffLim;
212- dcb.XonChar = XON;
213- dcb.XoffChar = XOFF;
214219 break;
215220 case IdFlowHard: // RTS/CTS
216221 dcb.fOutxCtsFlow = TRUE;
@@ -239,7 +244,19 @@
239244 break;
240245 }
241246
242- SetCommState(cv->ComID, &dcb);
247+ if (SetCommState(cv->ComID, &dcb) == 0) {
248+ // 設定エラー
249+ assert(0);
250+ }
251+#if !defined(NDEBUG)
252+ {
253+ DCB dcb_read;
254+ GetCommState(cv->ComID, &dcb_read);
255+ if (memcmp(&dcb, &dcb_read, sizeof(dcb)) != 0) {
256+ assert(0);
257+ }
258+ }
259+#endif
243260
244261 /* enable receive request */
245262 SetCommMask(cv->ComID,0);
Show on old repository browser