The comments in serialport.c indicate an intention to leave the serial port control lines untouched during sigrok opertion; the code then mixes-in a HUPCL flag to the termios bits that will be set on the serial port.
The effect of setting a HUPCL bit is that modem control lines will be asserted when the last user of the serial port closes its open handles. So the net effect of setting this bit is that sigrok effects a hangup on close. For FTDI usb-serial expanders this is state change of the DTR pin. For boards like the buspirate, this is not an issue when using the OLS driver -- the bus pirate does not make use of the DTR pin on the FTDI serial expander; however, boards like arduinos and the JTAGulator do. They use it for programming purposes but the result in spurious DTR state changes is a reset of the processor. The latter of these two is having a OLS compatibility layer added. So, when using the OLS driver with this in-development JTAGulator firmware, a reset occurs on close of sigrok-cli and on completion of capture in pulseview. This is a problem for systems like the jtagulator which do not persists any configuration -- critically, voltage settings. Please consider this patch for inclusion; based on my understanding of the HUPCL bit the changes here correct code to match the intent stated in the code comments. Signed-off-by: Ben Gardiner <ben.l.gardi...@gmail.com> --- I have tested this with the OLS driver (and a WIP JTAGulator firmware) on a Linux host -- as well as with the same platform and driver against a bus pireate; however, the serialcomm transport is used by many more drivers than OLS. I'm not sure this is a valid change for all of them but I expect it would be (which is why I'm submitted this patch). My expectation here could be wrong if any of the devices whose drivers use the serialcomm transport rely on DTR toggling on close. --- serialport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/serialport.c b/serialport.c index d271478..bd63643 100644 --- a/serialport.c +++ b/serialport.c @@ -586,7 +586,8 @@ SP_API enum sp_return sp_open(struct sp_port *port, enum sp_mode flags) data.term.c_cc[VTIME] = 0; /* Ignore modem status lines; enable receiver; leave control lines alone on close. */ - data.term.c_cflag |= (CLOCAL | CREAD | HUPCL); + data.term.c_cflag |= (CLOCAL | CREAD); + data.term.c_cflag &= ~(HUPCL); #endif #ifdef _WIN32 -- 2.6.1.134.g4b1fd35 ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140 _______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel