X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Ffluke-dmm%2Fapi.c;h=78b63a8658fd280ab3c1f3063ee432fd5118aca6;hb=7a36037546aaf11b91ff5d63fbd571e15407e357;hp=69ce1724c7be2c3b063d3727dfa56cb51a7300db;hpb=31d84da3a22cc6fc9b2226ab3863e9235a3d5b87;p=libsigrok.git diff --git a/hardware/fluke-dmm/api.c b/hardware/fluke-dmm/api.c index 69ce1724..78b63a86 100644 --- a/hardware/fluke-dmm/api.c +++ b/hardware/fluke-dmm/api.c @@ -18,14 +18,14 @@ */ #include -#include "libsigrok.h" -#include "libsigrok-internal.h" -#include "fluke-dmm.h" #include #include #include #include #include +#include "libsigrok.h" +#include "libsigrok-internal.h" +#include "fluke-dmm.h" static const int hwopts[] = { SR_HWOPT_CONN, @@ -87,7 +87,7 @@ static int hw_init(void) if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) { sr_err("Driver context malloc failed."); - return SR_ERR; + return SR_ERR_MALLOC; } di->priv = drvc; @@ -95,40 +95,6 @@ static int hw_init(void) return SR_OK; } -static int serial_readline(int fd, char **buf, int *buflen, uint64_t timeout_ms) -{ - uint64_t start; - int maxlen, len; - - timeout_ms *= 1000; - start = g_get_monotonic_time(); - - maxlen = *buflen; - *buflen = len = 0; - while(1) { - len = maxlen - *buflen - 1; - if (len < 1) - break; - len = serial_read(fd, *buf + *buflen, 1); - if (len > 0) { - *buflen += len; - *(*buf + *buflen) = '\0'; - if (*buflen > 0 && *(*buf + *buflen - 1) == '\r') { - /* Strip LF and terminate. */ - *(*buf + --*buflen) = '\0'; - break; - } - } - if (g_get_monotonic_time() - start > timeout_ms) - /* Timeout */ - break; - g_usleep(2000); - } - sr_dbg("Received %d: '%s'.", *buflen, *buf); - - return SR_OK; -} - static GSList *fluke_scan(const char *conn, const char *serialcomm) { struct sr_dev_inst *sdi; @@ -414,8 +380,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, return SR_OK; } -static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi, - void *cb_data) +static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) { struct sr_datafeed_packet packet; struct dev_context *devc;