X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flink-mso19%2Fapi.c;h=a0f033a8291344ccdf1c34b673c184c962057399;hb=76bc28c3f1cbd88f01eda7251e9f4f1d88c506f2;hp=89718894e7fab93be6de47d585d735c03be649ad;hpb=0f34cb472368be61aa2e7bc9d9d1b25bb28aa560;p=libsigrok.git diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index 89718894..a0f033a8 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -19,6 +19,7 @@ * along with this program. If not, see . */ +#include #include "protocol.h" static const uint32_t devopts[] = { @@ -60,7 +61,7 @@ static int dev_clear(const struct sr_dev_driver *di) struct dev_context *devc; int ret = SR_OK; - if (!(drvc = di->priv)) + if (!(drvc = di->context)) return SR_OK; /* Properly close and free all devices. */ @@ -116,7 +117,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) } if (!conn) conn = SERIALCONN; - if (serialcomm == NULL) + if (!serialcomm) serialcomm = SERIALCOMM; udev = udev_new(); @@ -213,13 +214,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi->driver = di; sdi->priv = devc; - for (i = 0; i < NUM_CHANNELS; i++) { + for (i = 0; i < ARRAY_SIZE(channel_names); i++) { chtype = (i == 0) ? SR_CHANNEL_ANALOG : SR_CHANNEL_LOGIC; sr_channel_new(sdi, i, chtype, TRUE, channel_names[i]); } //Add the driver - struct drv_context *drvc = di->priv; + struct drv_context *drvc = di->context; drvc->instances = g_slist_append(drvc->instances, sdi); devices = g_slist_append(devices, sdi); } @@ -229,7 +230,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) static GSList *dev_list(const struct sr_dev_driver *di) { - return ((struct drv_context *)(di->priv))->instances; + return ((struct drv_context *)(di->context))->instances; } static int dev_open(struct sr_dev_inst *sdi) @@ -268,14 +269,14 @@ static int cleanup(const struct sr_dev_driver *di) return dev_clear(); } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; (void)cg; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: if (sdi) { devc = sdi->priv; @@ -290,7 +291,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { int ret; @@ -306,7 +307,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - switch (id) { + switch (key) { case SR_CONF_SAMPLERATE: // FIXME return mso_configure_rate(sdi, g_variant_get_uint64(data)); @@ -483,5 +484,5 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info = { .dev_close = std_serial_dev_close, .dev_acquisition_start = dev_acquisition_start, .dev_acquisition_stop = dev_acquisition_stop, - .priv = NULL, + .context = NULL, };