From 6ca355fa13358a8a82ea06525ba551585c183794 Mon Sep 17 00:00:00 2001 From: Igor Derzhavets Date: Tue, 30 Jan 2018 20:01:56 +0200 Subject: [PATCH] Add Serial Flow control option, which allows to disable DTR and RTS connection settings in Windows In order to initiate serial connection with Intel's UartSub Devices: ACPI\INT3511 and ACPI\INT3512 following DCB struct fields should be set: fDtrControl = DTR_CONTROL_DISABLE fRtsControl = RTS_CONTROL_DISABLE Added "Disable DTR/RTS" option to Flow control list box of serial connection settings which add desired functionality to putty.exe Signed-off-by: Igor Derzhavets --- cmdline.c | 3 +++ doc/using.but | 4 ++-- putty.h | 2 +- sercfg.c | 1 + windows/wincfg.c | 2 +- windows/winser.c | 5 +++++ 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cmdline.c b/cmdline.c index f288ed629..d7feb8bb6 100644 --- a/cmdline.c +++ b/cmdline.c @@ -554,6 +554,9 @@ int cmdline_process_param(const char *p, char *value, case 'D': conf_set_int(conf, CONF_serflow, SER_FLOW_DSRDTR); break; + case 'U': + conf_set_int(conf, CONF_serflow, SER_FLOW_NONE_DTR_RTS_DIS); + break; default: cmdline_error("Unrecognised suboption \"-sercfg %c\"", diff --git a/doc/using.but b/doc/using.but index 7d184b7c2..f5a734b3f 100644 --- a/doc/using.but +++ b/doc/using.but @@ -980,8 +980,8 @@ follows: \cq{o} for odd, \cq{e} for even, \cq{m} for mark and \cq{s} for space. \b A single upper-case letter specifies the flow control: \cq{N} for -none, \cq{X} for XON/XOFF, \cq{R} for RTS/CTS and \cq{D} for -DSR/DTR. +none, \cq{X} for XON/XOFF, \cq{R} for RTS/CTS, \cq{D} for +DSR/DTR and \cq{U} Disables DTR/RTS (only in Windows version). For example, \cq{-sercfg 19200,8,n,1,N} denotes a baud rate of 19200, 8 data bits, no parity, 1 stop bit and no flow control. diff --git a/putty.h b/putty.h index fd2d02506..19b15dcbc 100644 --- a/putty.h +++ b/putty.h @@ -368,7 +368,7 @@ enum { }; enum { - SER_FLOW_NONE, SER_FLOW_XONXOFF, SER_FLOW_RTSCTS, SER_FLOW_DSRDTR + SER_FLOW_NONE, SER_FLOW_XONXOFF, SER_FLOW_RTSCTS, SER_FLOW_DSRDTR, SER_FLOW_NONE_DTR_RTS_DIS }; /* diff --git a/sercfg.c b/sercfg.c index fef910f31..2d6fb3e62 100644 --- a/sercfg.c +++ b/sercfg.c @@ -82,6 +82,7 @@ static void serial_flow_handler(union control *ctrl, void *dlg, {"XON/XOFF", SER_FLOW_XONXOFF}, {"RTS/CTS", SER_FLOW_RTSCTS}, {"DSR/DTR", SER_FLOW_DSRDTR}, + {"Disable DTR/RTS", SER_FLOW_NONE_DTR_RTS_DIS}, }; int mask = ctrl->listbox.context.i; int i, j; diff --git a/windows/wincfg.c b/windows/wincfg.c index 9d3673a6d..2c93ac5ca 100644 --- a/windows/wincfg.c +++ b/windows/wincfg.c @@ -387,7 +387,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, * Serial back end is available on Windows. */ if (!midsession || (protocol == PROT_SERIAL)) - ser_setup_config_box(b, midsession, 0x1F, 0x0F); + ser_setup_config_box(b, midsession, 0x1F, 0x01F); /* * $XAUTHORITY is not reliable on Windows, so we provide a diff --git a/windows/winser.c b/windows/winser.c index 646cd2546..edcef6ac6 100644 --- a/windows/winser.c +++ b/windows/winser.c @@ -170,6 +170,11 @@ static const char *serial_configure(Serial serial, HANDLE serport, Conf *conf) dcb.fOutxDsrFlow = TRUE; str = "DSR/DTR"; break; + case SER_FLOW_NONE_DTR_RTS_DIS: + str = "Disable DTR/RTS"; + dcb.fDtrControl = DTR_CONTROL_DISABLE; + dcb.fRtsControl = RTS_CONTROL_DISABLE; + break; } msg = dupprintf("Configuring %s flow control", str); logevent(serial->frontend, msg);