X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ftondaj-sl-814%2Fprotocol.c;h=d09d19bf2c9a5ddf550a245123e9c44847477a0d;hb=e5ef649be3167dbb9f6403e2c1d0e2e1b09d3a0c;hp=c3b065615de746b5b89b95624a0aef63ebc78187;hpb=e8be616955f2bc4e2c72fc55d899056ad68fb75c;p=libsigrok.git diff --git a/src/hardware/tondaj-sl-814/protocol.c b/src/hardware/tondaj-sl-814/protocol.c index c3b06561..d09d19bf 100644 --- a/src/hardware/tondaj-sl-814/protocol.c +++ b/src/hardware/tondaj-sl-814/protocol.c @@ -18,9 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include -#include "libsigrok.h" +#include #include "libsigrok-internal.h" #include "protocol.h" @@ -33,7 +34,7 @@ enum { }; static void parse_packet(const uint8_t *buf, float *floatval, - struct sr_datafeed_analog *analog) + struct sr_datafeed_analog_old *analog) { gboolean is_a, is_fast; uint16_t intval; @@ -88,12 +89,12 @@ static void parse_packet(const uint8_t *buf, float *floatval, static void decode_packet(struct sr_dev_inst *sdi) { struct sr_datafeed_packet packet; - struct sr_datafeed_analog analog; + struct sr_datafeed_analog_old analog; struct dev_context *devc; float floatval; devc = sdi->priv; - memset(&analog, 0, sizeof(struct sr_datafeed_analog)); + memset(&analog, 0, sizeof(struct sr_datafeed_analog_old)); parse_packet(devc->buf, &floatval, &analog); @@ -101,7 +102,7 @@ static void decode_packet(struct sr_dev_inst *sdi) analog.channels = sdi->channels; analog.num_samples = 1; analog.data = &floatval; - packet.type = SR_DF_ANALOG; + packet.type = SR_DF_ANALOG_OLD; packet.payload = &analog; sr_session_send(devc->cb_data, &packet); @@ -133,7 +134,8 @@ SR_PRIV int tondaj_sl_814_receive_data(int fd, int revents, void *cb_data) buf[2] = 0x0d; sr_spew("Sending init command: %02x %02x %02x.", buf[0], buf[1], buf[2]); - if ((ret = serial_write_blocking(serial, buf, 3, 0)) < 0) { + if ((ret = serial_write_blocking(serial, buf, 3, + serial_timeout(serial, 3))) < 0) { sr_err("Error sending init command: %d.", ret); return FALSE; } @@ -159,7 +161,8 @@ SR_PRIV int tondaj_sl_814_receive_data(int fd, int revents, void *cb_data) buf[2] = 0x0d; sr_spew("Sending data request command: %02x %02x %02x.", buf[0], buf[1], buf[2]); - if ((ret = serial_write_blocking(serial, buf, 3, 0)) < 0) { + if ((ret = serial_write_blocking(serial, buf, 3, + serial_timeout(serial, 3))) < 0) { sr_err("Error sending request command: %d.", ret); return FALSE; }