]> sigrok.org Git - libsigrok.git/blobdiff - hardware/common/serial.c
serial: Use new sp_set_config instead of sp_set_params.
[libsigrok.git] / hardware / common / serial.c
index 7dde05e00af35c70cd5513cda5a359a11aaf5656..75c4a47d6e69f89b197892d9504d3c9eb2471b55 100644 (file)
@@ -110,6 +110,7 @@ SR_PRIV int serial_close(struct sr_serial_dev_inst *serial)
        sr_spew("Closing serial port %s (fd %d).", serial->port, serial->fd);
 
        ret = sp_close(serial->data);
+       sp_free_port(serial->data);
 
        switch (ret) {
        case SP_ERR_ARG:
@@ -276,6 +277,7 @@ SR_PRIV int serial_set_params(struct sr_serial_dev_inst *serial, int baudrate,
 {
        int ret;
        char *error;
+       struct sp_port_config config;
 
        if (!serial) {
                sr_dbg("Invalid serial port.");
@@ -291,8 +293,15 @@ SR_PRIV int serial_set_params(struct sr_serial_dev_inst *serial, int baudrate,
        sr_spew("Setting serial parameters on port %s (fd %d).", serial->port,
                serial->fd);
 
-       ret = sp_set_params(serial->data, baudrate, bits, parity, stopbits,
-                       flowcontrol, rts, dtr);
+       config.baudrate = baudrate;
+       config.bits = bits;
+       config.parity = parity;
+       config.stopbits = stopbits;
+       config.flowcontrol = flowcontrol;
+       config.rts = rts;
+       config.dtr = dtr;
+
+       ret = sp_set_config(serial->data, &config);
 
        switch (ret) {
        case SP_ERR_ARG: