X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flascar-el-usb%2Fapi.c;h=aacc3ead108b2e9270d8562ac3e8011fb8188aea;hb=dd7a72ea697a172032f5473b0ddff5e8d47222f4;hp=7c7eda9e68858847825a96fbad6728fd9f91a093;hpb=7e463623382e1f574fde150b3fc88a65eaebb578;p=libsigrok.git diff --git a/src/hardware/lascar-el-usb/api.c b/src/hardware/lascar-el-usb/api.c index 7c7eda9e..aacc3ead 100644 --- a/src/hardware/lascar-el-usb/api.c +++ b/src/hardware/lascar-el-usb/api.c @@ -28,9 +28,12 @@ static const uint32_t scanopts[] = { SR_CONF_CONN, }; -static const uint32_t devopts[] = { +static const uint32_t drvopts[] = { SR_CONF_THERMOMETER, SR_CONF_HYGROMETER, +}; + +static const uint32_t devopts[] = { SR_CONF_CONN | SR_CONF_GET, SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET, SR_CONF_DATALOG | SR_CONF_GET | SR_CONF_SET, @@ -108,19 +111,17 @@ static int dev_close(struct sr_dev_inst *sdi) usb = sdi->conn; if (!usb->devhdl) - /* Nothing to do. */ - return SR_OK; + return SR_ERR_BUG; libusb_release_interface(usb->devhdl, LASCAR_INTERFACE); libusb_close(usb->devhdl); usb->devhdl = NULL; - sdi->status = SR_ST_INACTIVE; 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; struct sr_usb_dev_inst *usb; @@ -155,8 +156,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; int ret; @@ -182,26 +183,10 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd return ret; } -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) { - (void)sdi; - (void)cg; - - switch (key) { - case SR_CONF_SCAN_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); - break; - case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); - break; - default: - return SR_ERR_NA; - } - - return SR_OK; + return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); } static void LIBUSB_CALL mark_xfer(struct libusb_transfer *xfer) @@ -404,7 +389,7 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info = { .cleanup = std_cleanup, .scan = scan, .dev_list = std_dev_list, - .dev_clear = NULL, + .dev_clear = std_dev_clear, .config_get = config_get, .config_set = config_set, .config_list = config_list,