> @@ -122,6 +122,10 @@ SR_PRIV int serial_open(struct sr_serial_dev_inst > *serial, int flags) > if (ret != SR_OK) > return ret; > > + ret = serial_flush(serial); > + if (ret != SR_OK) > + return ret; > + > if (serial->serialcomm) > return serial_set_paramstr(serial, serial->serialcomm); > else
On second thought, maybe we should flush the buffer *after* setting the parameters like this? 125 if (serial->serialcomm) { 126 ret = serial_set_paramstr(serial, serial->serialcomm); 127 if (ret != SR_OK) 128 return ret; 129 } 130 131 return serial_flush(serial); Sidenote: I also have been trying to find out if ports get automatically flushed when opening. I couldn't find any specs on that (not surprised), so this justifies this patch some more hopefully.
signature.asc
Description: PGP signature
_______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel