From: Martin Ling Date: Sun, 3 Nov 2013 22:53:04 +0000 (+0000) Subject: Update to new libserialport API. X-Git-Tag: libsigrok-0.3.0~565 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c9bc57b6bc0c13d7bf4fef60db3030f88eeebda5;p=libsigrok.git Update to new libserialport API. --- diff --git a/hardware/common/serial.c b/hardware/common/serial.c index 53712e82..66d8b925 100644 --- a/hardware/common/serial.c +++ b/hardware/common/serial.c @@ -59,7 +59,9 @@ SR_PRIV int serial_open(struct sr_serial_dev_inst *serial, int flags) sr_spew("Opening serial port '%s' (flags %d).", serial->port, flags); - ret = sp_open(&serial->data, serial->port, flags); + sp_get_port_by_name(serial->port, &serial->data); + + ret = sp_open(serial->data, flags); switch (ret) { @@ -74,7 +76,7 @@ SR_PRIV int serial_open(struct sr_serial_dev_inst *serial, int flags) } #ifndef _WIN32 - serial->fd = serial->data.fd; + serial->fd = serial->data->fd; #endif if (serial->serialcomm) @@ -109,7 +111,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 = SR_OK; - ret = sp_close(&serial->data); + ret = sp_close(serial->data); switch (ret) { @@ -153,7 +155,7 @@ SR_PRIV int serial_flush(struct sr_serial_dev_inst *serial) sr_spew("Flushing serial port %s (fd %d).", serial->port, serial->fd); - ret = sp_flush(&serial->data); + ret = sp_flush(serial->data); switch (ret) { @@ -196,7 +198,7 @@ SR_PRIV int serial_write(struct sr_serial_dev_inst *serial, return -1; } - ret = sp_write(&serial->data, buf, count); + ret = sp_write(serial->data, buf, count); switch (ret) { @@ -241,7 +243,7 @@ SR_PRIV int serial_read(struct sr_serial_dev_inst *serial, void *buf, return -1; } - ret = sp_read(&serial->data, buf, count); + ret = sp_read(serial->data, buf, count); switch (ret) { @@ -294,7 +296,7 @@ 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, + ret = sp_set_params(serial->data, baudrate, bits, parity, stopbits, flowcontrol, rts, dtr); switch (ret) diff --git a/libsigrok-internal.h b/libsigrok-internal.h index ebbcca9b..0c03aed6 100644 --- a/libsigrok-internal.h +++ b/libsigrok-internal.h @@ -72,7 +72,7 @@ struct sr_serial_dev_inst { char *port; char *serialcomm; int fd; - struct sp_port data; + struct sp_port *data; }; /* Private driver context. */