X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ftesto%2Fapi.c;h=43a5f2513f67ca4822356fa00e74e5b52fd5e150;hb=f6ce25ec05e8707ee3783b111ea13779f237c3b3;hp=b208ff724ccaad304bc0fcf5b58816325947fabd;hpb=b258c09f26dad9896e1cc08467ecef0e69e9c1d8;p=libsigrok.git diff --git a/src/hardware/testo/api.c b/src/hardware/testo/api.c index b208ff72..43a5f251 100644 --- a/src/hardware/testo/api.c +++ b/src/hardware/testo/api.c @@ -109,9 +109,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) if (strncmp(manufacturer, "testo", 5)) continue; - usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); + if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0) + continue; - /* Hardcode the 435 for now.*/ + /* Hardcode the 435 for now. */ if (strcmp(product, "testo 435/635/735")) continue; @@ -184,12 +185,11 @@ static int dev_close(struct sr_dev_inst *sdi) return SR_OK; } -static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg) +static int config_get(uint32_t key, GVariant **data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc = sdi->priv; struct sr_usb_dev_inst *usb; - char str[128]; (void)cg; @@ -198,8 +198,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s if (!sdi || !sdi->conn) return SR_ERR_ARG; usb = sdi->conn; - snprintf(str, 128, "%d.%d", usb->bus, usb->address); - *data = g_variant_new_string(str); + *data = g_variant_new_printf("%d.%d", usb->bus, usb->address); break; case SR_CONF_LIMIT_MSEC: case SR_CONF_LIMIT_SAMPLES: @@ -211,8 +210,8 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s return SR_OK; } -static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg) +static int config_set(uint32_t key, GVariant *data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc = sdi->priv; @@ -221,8 +220,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd return sr_sw_limits_config_set(&devc->sw_limits, key, data); } -static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg) +static int config_list(uint32_t key, GVariant **data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); }