[Ttssh2-commit] [7849] シリアルポート設定に下記設定項目を追加した。

scmno****@osdn***** scmno****@osdn*****
2019年 7月 13日 (土) 18:49:51 JST


Revision: 7849
          https://osdn.net/projects/ttssh2/scm/svn/commits/7849
Author:   yutakapon
Date:     2019-07-13 18:49:51 +0900 (Sat, 13 Jul 2019)
Log Message:
-----------
シリアルポート設定に下記設定項目を追加した。

[ ] Use device's internal I/O buffer   (英語)
[ ] デバイスの送受信バッファを使う (日本語)

チケット #39369

Ticket Links:
------------
    https://osdn.net/projects/ttssh2/tracker/detail/39369

Modified Paths:
--------------
    branches/CH340G_hw_flowctrl/teraterm/common/tttypes.h
    branches/CH340G_hw_flowctrl/teraterm/teraterm/commlib.c
    branches/CH340G_hw_flowctrl/teraterm/ttpdlg/dlg_res.h
    branches/CH340G_hw_flowctrl/teraterm/ttpdlg/ttdlg.c
    branches/CH340G_hw_flowctrl/teraterm/ttpdlg/ttpdlg.rc
    branches/CH340G_hw_flowctrl/teraterm/ttpset/ttset.c

-------------- next part --------------
Modified: branches/CH340G_hw_flowctrl/teraterm/common/tttypes.h
===================================================================
--- branches/CH340G_hw_flowctrl/teraterm/common/tttypes.h	2019-07-12 16:31:29 UTC (rev 7848)
+++ branches/CH340G_hw_flowctrl/teraterm/common/tttypes.h	2019-07-13 09:49:51 UTC (rev 7849)
@@ -687,6 +687,7 @@
 	char DialogFontName[LF_FACESIZE];
 	int DialogFontPoint;
 	int DialogFontCharSet;
+	WORD UseDevcieInternalBuffer;
 };
 
 typedef struct tttset TTTSet, *PTTSet;

Modified: branches/CH340G_hw_flowctrl/teraterm/teraterm/commlib.c
===================================================================
--- branches/CH340G_hw_flowctrl/teraterm/teraterm/commlib.c	2019-07-12 16:31:29 UTC (rev 7848)
+++ branches/CH340G_hw_flowctrl/teraterm/teraterm/commlib.c	2019-07-13 09:49:51 UTC (rev 7849)
@@ -168,7 +168,27 @@
 	}
 
 	ClearCommError(cv->ComID,&DErr,NULL);
-	SetupComm(cv->ComID,CommInQueSize,CommOutQueSize);
+
+	/* \x83V\x83\x8A\x83A\x83\x8B\x83|\x81[\x83g\x83h\x83\x89\x83C\x83o\x82̑\x97\x8E\xF3\x90M\x83o\x83b\x83t\x83@\x83T\x83C\x83Y\x82\xF0\x8Ew\x92肷\x82\xE9\x8Fꍇ\x81A
+	 * SetupComm API\x82\xF0\x8CĂяo\x82\xB5\x82Đݒ\xE8\x82\xF0\x8Ds\x82\xA4\x81B\x8F]\x97\x88\x93\xAE\x8D\xEC\x81B
+	 *
+	 * \x8Ew\x92肵\x82Ȃ\xA2\x8Fꍇ\x81A\x83h\x83\x89\x83C\x83o\x82̃f\x83t\x83H\x83\x8B\x83g\x82̃T\x83C\x83Y\x82\xF0\x8Eg\x97p\x82\xB7\x82\xE9\x81B
+	 * \x82\xB1\x82\xEA\x82ɂ\xE6\x82\xE8CH340G(USB\x83V\x83\x8A\x83A\x83\x8B\x95ϊ\xB7)\x82Ńn\x81[\x83h\x83E\x83F\x83A\x83t\x83\x8D\x81[\x90\xA7\x8C䂪\x8C\xF8\x82\xA9\x82Ȃ\xA2
+	 * \x82Ƃ\xA2\x82\xA4\x8C\xBB\x8Fۂ\xAA\x89\xF1\x94\xF0\x82ł\xAB\x82\xE9(\x83\x8F\x81[\x83N\x83A\x83\x89\x83E\x83\x93\x83h)\x81B
+	 */
+	if (ts->UseDevcieInternalBuffer) {
+		OutputDebugPrintf("%s: Use driver's default buffer size to skip SetupComm calling.\n", 
+			__FUNCTION__);
+
+	} else {
+		DWORD ret, err = 0;
+		ret = SetupComm(cv->ComID,CommInQueSize,CommOutQueSize);
+		if (ret == 0)
+			err = GetLastError();
+		OutputDebugPrintf("%s: Change driver's internal buffer size to call SetupComm(ret=%lu, err=%lu).\n", 
+			__FUNCTION__, ret, err);
+	}
+
 	/* flush input and output buffers */
 	if (ClearBuff) {
 		PurgeComm(cv->ComID, PURGE_TXABORT | PURGE_RXABORT |

Modified: branches/CH340G_hw_flowctrl/teraterm/ttpdlg/dlg_res.h
===================================================================
--- branches/CH340G_hw_flowctrl/teraterm/ttpdlg/dlg_res.h	2019-07-12 16:31:29 UTC (rev 7848)
+++ branches/CH340G_hw_flowctrl/teraterm/ttpdlg/dlg_res.h	2019-07-13 09:49:51 UTC (rev 7849)
@@ -170,6 +170,7 @@
 #define IDC_TERMRUSSFONTLABEL           1075
 #define IDC_TERMRUSSFONT                1076
 #define IDC_GENLANG_UI                  1077
+#define IDC_SERIALDEVICE_IO_BUFFER      1078
 #define IDC_GENHELP                     1099
 #define IDD_TERMDLG                     1100
 #define IDD_WINLISTDLG                  1200
@@ -189,7 +190,7 @@
 #define _APS_NO_MFC                     1
 #define _APS_NEXT_RESOURCE_VALUE        103
 #define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1078
+#define _APS_NEXT_CONTROL_VALUE         1079
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

Modified: branches/CH340G_hw_flowctrl/teraterm/ttpdlg/ttdlg.c
===================================================================
--- branches/CH340G_hw_flowctrl/teraterm/ttpdlg/ttdlg.c	2019-07-12 16:31:29 UTC (rev 7848)
+++ branches/CH340G_hw_flowctrl/teraterm/ttpdlg/ttdlg.c	2019-07-13 09:49:51 UTC (rev 7849)
@@ -1116,6 +1116,7 @@
 		{ IDC_SERIALDELAY, "DLG_SERIAL_DELAY" },
 		{ IDC_SERIALDELAYCHAR_LABEL, "DLG_SERIAL_DELAYCHAR" },
 		{ IDC_SERIALDELAYLINE_LABEL, "DLG_SERIAL_DELAYLINE" },
+		{ IDC_SERIALDEVICE_IO_BUFFER, "DLG_SERIAL_USE_DEVICE_IO_BUFFER" },
 		{ IDOK, "BTN_OK" },
 		{ IDCANCEL, "BTN_CANCEL" },
 		{ IDC_SERIALHELP, "BTN_HELP" },
@@ -1196,6 +1197,8 @@
 			SetDlgItemInt(Dialog,IDC_SERIALDELAYLINE,ts->DelayPerLine,FALSE);
 			SendDlgItemMessage(Dialog, IDC_SERIALDELAYLINE, EM_LIMITTEXT,4, 0);
 
+			SetRB(Dialog,ts->UseDevcieInternalBuffer,IDC_SERIALDEVICE_IO_BUFFER,IDC_SERIALDEVICE_IO_BUFFER);
+
 			CenterWindow(Dialog, GetParent(Dialog));
 
 			return TRUE;
@@ -1234,6 +1237,8 @@
 
 						ts->PortType = IdSerial;
 
+						GetRB(Dialog,&ts->UseDevcieInternalBuffer,IDC_SERIALDEVICE_IO_BUFFER,IDC_SERIALDEVICE_IO_BUFFER);
+
 						// \x83{\x81[\x83\x8C\x81[\x83g\x82\xAA\x95ύX\x82\xB3\x82\xEA\x82邱\x82Ƃ\xAA\x82\xA0\x82\xE9\x82̂ŁA\x83^\x83C\x83g\x83\x8B\x8Dĕ\\x8E\xA6\x82\xCC
 						// \x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x94\xF2\x82΂\xB7\x82悤\x82ɂ\xB5\x82\xBD\x81B (2007.7.21 maya)
 						PostMessage(GetParent(Dialog),WM_USER_CHANGETITLE,0,0);

Modified: branches/CH340G_hw_flowctrl/teraterm/ttpdlg/ttpdlg.rc
===================================================================
--- branches/CH340G_hw_flowctrl/teraterm/ttpdlg/ttpdlg.rc	2019-07-12 16:31:29 UTC (rev 7848)
+++ branches/CH340G_hw_flowctrl/teraterm/ttpdlg/ttpdlg.rc	2019-07-13 09:49:51 UTC (rev 7849)
@@ -125,7 +125,7 @@
     EDITTEXT        IDC_LOCALE_EDIT,59,140,63,13,ES_AUTOHSCROLL
 END
 
-IDD_SERIALDLG DIALOGEX 20, 20, 190, 143
+IDD_SERIALDLG DIALOGEX 20, 20, 190, 167
 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "Tera Term: Serial port setup"
 FONT 14, "System", 0, 0, 0x0
@@ -147,6 +147,8 @@
     EDITTEXT        IDC_SERIALDELAYCHAR,29,116,20,12,ES_AUTOHSCROLL | ES_NUMBER
     LTEXT           "msec/&line",IDC_SERIALDELAYLINE_LABEL,124,118,42,10
     EDITTEXT        IDC_SERIALDELAYLINE,100,116,20,12,ES_AUTOHSCROLL | ES_NUMBER
+    CONTROL         "&Use device's internal I/O buffer",IDC_SERIALDEVICE_IO_BUFFER,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,143,160,10
     DEFPUSHBUTTON   "OK",IDOK,138,9,40,16,WS_GROUP
     PUSHBUTTON      "Cancel",IDCANCEL,138,34,40,16
     PUSHBUTTON      "&Help",IDC_SERIALHELP,138,62,40,16
@@ -404,6 +406,11 @@
 #ifdef APSTUDIO_INVOKED
 GUIDELINES DESIGNINFO
 BEGIN
+    IDD_SERIALDLG, DIALOG
+    BEGIN
+        BOTTOMMARGIN, 164
+    END
+
     IDD_HOSTDLG, DIALOG
     BEGIN
         LEFTMARGIN, 4

Modified: branches/CH340G_hw_flowctrl/teraterm/ttpset/ttset.c
===================================================================
--- branches/CH340G_hw_flowctrl/teraterm/ttpset/ttset.c	2019-07-12 16:31:29 UTC (rev 7848)
+++ branches/CH340G_hw_flowctrl/teraterm/ttpset/ttset.c	2019-07-13 09:49:51 UTC (rev 7849)
@@ -1085,6 +1085,17 @@
 	ts->DelayPerLine =
 		GetPrivateProfileInt(Section, "DelayPerLine", 0, FName);
 
+	/* Using internal input and output buffer of serial device driver 
+	 * \x83V\x83\x8A\x83A\x83\x8B\x83|\x81[\x83g\x83h\x83\x89\x83C\x83o\x82̓\xE0\x95\x94\x83o\x83b\x83t\x83@\x82̑\x97\x8E\xF3\x90M\x83T\x83C\x83Y\x82𖾎\xA6\x93I\x82Ɏw\x92肷\x82邩\x81A
+	 * \x83h\x83\x89\x83C\x83o\x93\xE0\x95\x94\x82̃f\x83t\x83H\x83\x8B\x83g\x82̃p\x83\x89\x83\x81\x81[\x83^\x82Ŏg\x82\xA4\x82\xA9\x82\xF0\x8Ew\x92肷\x82\xE9\x81B
+	 *
+	 *   TRUE: \x83h\x83\x89\x83C\x83o\x93\xE0\x95\x94\x82̃f\x83t\x83H\x83\x8B\x83g\x82̃p\x83\x89\x83\x81\x81[\x83^\x82\xF0\x8Eg\x82\xA4
+	 *   FALSE: \x93\xE0\x95\x94\x83o\x83b\x83t\x83@\x82̑\x97\x8E\xF3\x90M\x83T\x83C\x83Y\x82𖾎\xA6\x93I\x82Ɏw\x92肷\x82\xE9
+	 *
+	 * \x83f\x83t\x83H\x83\x8B\x83g\x82\xCD FLASE \x81B\x8F]\x97\x88\x92ʂ\xE8\x82̓\xAE\x82\xAB\x82ɍ\x87\x82킹\x82\xE9\x81B
+	 */
+	ts->UseDevcieInternalBuffer = GetOnOff(Section, "UseDevcieInternalBuffer", FName, FALSE);
+
 	/* Telnet flag */
 	ts->Telnet = GetOnOff(Section, "Telnet", FName, TRUE);
 
@@ -2654,6 +2665,9 @@
 	/* Delay per line */
 	WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine);
 
+	/* Using internal input and output buffer of serial device driver */
+	WriteOnOff(Section, "UseDevcieInternalBuffer", FName, ts->UseDevcieInternalBuffer);
+
 	/* Telnet flag */
 	WriteOnOff(Section, "Telnet", FName, ts->Telnet);
 


Ttssh2-commit メーリングリストの案内