X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fserial.c;h=1b76c935e3a0e1b73874b875185a18105f1f7f37;hb=92cd85149a2497e6eecd8f35e43893b905dc2faa;hp=8ffba7956b09cd4e248627528d72bd56c674fd0a;hpb=b1184024fed838ec67d3cb2de097b66b6c48d9c7;p=libsigrok.git diff --git a/src/serial.c b/src/serial.c index 8ffba795..1b76c935 100644 --- a/src/serial.c +++ b/src/serial.c @@ -561,6 +561,37 @@ SR_PRIV int serial_set_params(struct sr_serial_dev_inst *serial, return ret; } +/** + * Manipulate handshake state for the specified serial port. + * + * @param serial Previously initialized serial port structure. + * @param[in] rts Status of RTS line (0 or 1; or -1 to ignore). + * @param[in] dtr Status of DTR line (0 or 1; or -1 to ignore). + * + * @retval SR_OK Success. + * @retval SR_ERR Failure. + * + * @private + */ +SR_PRIV int serial_set_handshake(struct sr_serial_dev_inst *serial, + int rts, int dtr) +{ + int ret; + + if (!serial) { + sr_dbg("Invalid serial port."); + return SR_ERR; + } + + sr_spew("Modifying serial parameters on port %s.", serial->port); + + if (!serial->lib_funcs || !serial->lib_funcs->set_handshake) + return SR_ERR_NA; + ret = serial->lib_funcs->set_handshake(serial, rts, dtr); + + return ret; +} + /** * Set serial parameters for the specified serial port from parameter string. * @@ -836,7 +867,7 @@ SR_PRIV int serial_stream_detect(struct sr_serial_dev_inst *serial, *buflen = ibuf; - sr_err("Didn't find a valid packet (read %zu bytes).", *buflen); + sr_info("Didn't find a valid packet (read %zu bytes).", *buflen); return SR_ERR; }