X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fserial.c;h=34d7cbea3f9b40b965d588b8c4a6003a8d54cc24;hb=3f8453b274d7776ff4f0bb7a869eb6211364c190;hp=8ffba7956b09cd4e248627528d72bd56c674fd0a;hpb=b1184024fed838ec67d3cb2de097b66b6c48d9c7;p=libsigrok.git diff --git a/src/serial.c b/src/serial.c index 8ffba795..34d7cbea 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. *