X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flink-mso19%2Fapi.c;h=7d0fbf8b21030e080f699c6090b0fa8251b7e8f6;hb=65e0036635a54b3273436b4ea7918aea25bad788;hp=6ee01c8680689d7adec8e2d5eec666badc43174e;hpb=4f840ce965b1c30c5ab75afecc56193cbaf5c1b3;p=libsigrok.git diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index 6ee01c86..7d0fbf8b 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -38,9 +38,9 @@ static const uint32_t devopts[] = { * * See also: http://www.linkinstruments.com/images/mso19_1113.gif */ -SR_PRIV const char *mso19_channel_names[NUM_CHANNELS + 1] = { +static const char *channel_names[] = { /* Note: DSO needs to be first. */ - "DSO", "0", "1", "2", "3", "4", "5", "6", "7", NULL, + "DSO", "0", "1", "2", "3", "4", "5", "6", "7", }; static const uint64_t samplerates[] = { @@ -116,7 +116,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,10 +213,9 @@ 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, - mso19_channel_names[i]); + sr_channel_new(sdi, i, chtype, TRUE, channel_names[i]); } //Add the driver @@ -269,14 +268,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; @@ -291,7 +290,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; @@ -307,7 +306,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)); @@ -320,8 +319,6 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, ret = SR_ERR_ARG; } else { devc->limit_samples = num_samples; - sr_dbg("setting limit_samples to %i\n", - num_samples); ret = SR_OK; } break;