]> sigrok.org Git - libsigrok.git/blobdiff - hardware/agilent-dmm/api.c
Rename SR_HWOPT_* and SR_HWCAP_* to SR_CONF_*
[libsigrok.git] / hardware / agilent-dmm / api.c
index de89422a7a4d9a4af0759037f2c120b72194cf57..9d401c7e51734f9a8c10bf659dffe7fb32f08704 100644 (file)
 #include "agilent-dmm.h"
 
 static const int hwopts[] = {
-       SR_HWOPT_CONN,
-       SR_HWOPT_SERIALCOMM,
+       SR_CONF_CONN,
+       SR_CONF_SERIALCOMM,
        0,
 };
 
 static const int hwcaps[] = {
-       SR_HWCAP_MULTIMETER,
-       SR_HWCAP_LIMIT_SAMPLES,
-       SR_HWCAP_LIMIT_MSEC,
-       SR_HWCAP_CONTINUOUS,
+       SR_CONF_MULTIMETER,
+       SR_CONF_LIMIT_SAMPLES,
+       SR_CONF_LIMIT_MSEC,
+       SR_CONF_CONTINUOUS,
        0,
 };
 
-static const char *probe_names[] = {
-       "Probe",
-       NULL,
-};
-
 extern const struct agdmm_job agdmm_jobs_u123x[];
 extern const struct agdmm_recv agdmm_recvs_u123x[];
 extern const struct agdmm_job agdmm_jobs_u125x[];
@@ -114,7 +109,7 @@ static GSList *hw_scan(GSList *options)
        struct sr_dev_inst *sdi;
        struct drv_context *drvc;
        struct dev_context *devc;
-       struct sr_hwopt *opt;
+       struct sr_config *src;
        struct sr_probe *probe;
        struct sr_serial_dev_inst *serial;
        GSList *l, *devices;
@@ -128,13 +123,13 @@ static GSList *hw_scan(GSList *options)
        devices = NULL;
        conn = serialcomm = NULL;
        for (l = options; l; l = l->next) {
-               opt = l->data;
-               switch (opt->hwopt) {
-               case SR_HWOPT_CONN:
-                       conn = opt->value;
+               src = l->data;
+               switch (src->key) {
+               case SR_CONF_CONN:
+                       conn = src->value;
                        break;
-               case SR_HWOPT_SERIALCOMM:
-                       serialcomm = opt->value;
+               case SR_CONF_SERIALCOMM:
+                       serialcomm = src->value;
                        break;
                }
        }
@@ -255,7 +250,6 @@ static int hw_cleanup(void)
 static int hw_info_get(int info_id, const void **data,
        const struct sr_dev_inst *sdi)
 {
-
        (void)sdi;
 
        switch (info_id) {
@@ -265,12 +259,6 @@ static int hw_info_get(int info_id, const void **data,
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;
-       case SR_DI_NUM_PROBES:
-               *data = GINT_TO_POINTER(1);
-               break;
-       case SR_DI_PROBE_NAMES:
-               *data = probe_names;
-               break;
        default:
                return SR_ERR_ARG;
        }
@@ -292,7 +280,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
        }
 
        switch (hwcap) {
-       case SR_HWCAP_LIMIT_MSEC:
+       case SR_CONF_LIMIT_MSEC:
                /* TODO: not yet implemented */
                if (*(const uint64_t *)value == 0) {
                        sr_err("LIMIT_MSEC can't be 0.");
@@ -302,7 +290,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                sr_dbg("Setting time limit to %" PRIu64 "ms.",
                       devc->limit_msec);
                break;
-       case SR_HWCAP_LIMIT_SAMPLES:
+       case SR_CONF_LIMIT_SAMPLES:
                devc->limit_samples = *(const uint64_t *)value;
                sr_dbg("Setting sample limit to %" PRIu64 ".",
                       devc->limit_samples);
@@ -321,7 +309,6 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
 {
        struct sr_datafeed_packet packet;
        struct sr_datafeed_header header;
-       struct sr_datafeed_meta_analog meta;
        struct dev_context *devc;
 
        if (!(devc = sdi->priv)) {
@@ -341,13 +328,6 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        gettimeofday(&header.starttime, NULL);
        sr_session_send(devc->cb_data, &packet);
 
-       /* Send metadata about the SR_DF_ANALOG packets to come. */
-       sr_dbg("Sending SR_DF_META_ANALOG.");
-       packet.type = SR_DF_META_ANALOG;
-       packet.payload = &meta;
-       meta.num_probes = 1;
-       sr_session_send(devc->cb_data, &packet);
-
        /* Poll every 100ms, or whenever some data comes in. */
        sr_source_add(devc->serial->fd, G_IO_IN, 100, agdmm_receive_data, (void *)sdi);