X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fopenbench-logic-sniffer%2Fprotocol.c;h=125c279d0f8f11cb455089a2e41c3df937a68d75;hb=6986c63d2dbab98725247c11d18119ba154f6569;hp=2bcf9f411335a795a2e47155a9bfe70a16ad39cd;hpb=838f01227382bfd8e5b9c817e7fefff93d2c7b28;p=libsigrok.git diff --git a/src/hardware/openbench-logic-sniffer/protocol.c b/src/hardware/openbench-logic-sniffer/protocol.c index 2bcf9f41..125c279d 100644 --- a/src/hardware/openbench-logic-sniffer/protocol.c +++ b/src/hardware/openbench-logic-sniffer/protocol.c @@ -139,18 +139,6 @@ static int convert_trigger(const struct sr_dev_inst *sdi, return SR_OK; } -static void ols_channel_new(struct sr_dev_inst *sdi, int num_chan) -{ - struct dev_context *devc = sdi->priv; - int i; - - for (i = 0; i < num_chan; i++) - sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, - ols_channel_names[i]); - - devc->max_channels = num_chan; -} - static void ols_metadata_quirks(struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -165,7 +153,7 @@ static void ols_metadata_quirks(struct sr_dev_inst *sdi) is_shrimp = sdi->model && strcmp(sdi->model, "Shrimp1.0") == 0; if (is_shrimp) { if (!devc->max_channels) - ols_channel_new(sdi, 4); + devc->max_channels = 4; if (!devc->max_samples) devc->max_samples = 256 * 1024; if (!devc->max_samplerate) @@ -252,7 +240,7 @@ SR_PRIV int ols_get_metadata(struct sr_dev_inst *sdi) switch (key) { case METADATA_TOKEN_NUM_PROBES_LONG: /* Number of usable channels */ - ols_channel_new(sdi, tmp_int); + devc->max_channels = tmp_int; break; case METADATA_TOKEN_SAMPLE_MEMORY_BYTES: /* Amount of sample memory available (bytes) */ @@ -286,7 +274,7 @@ SR_PRIV int ols_get_metadata(struct sr_dev_inst *sdi) switch (key) { case METADATA_TOKEN_NUM_PROBES_SHORT: /* Number of usable channels */ - ols_channel_new(sdi, tmp_c); + devc->max_channels = tmp_c; break; case METADATA_TOKEN_PROTOCOL_VERSION_SHORT: /* protocol version */ @@ -304,10 +292,8 @@ SR_PRIV int ols_get_metadata(struct sr_dev_inst *sdi) } } - sdi->model = devname->str; - sdi->version = version->str; - g_string_free(devname, FALSE); - g_string_free(version, FALSE); + sdi->model = g_string_free(devname, FALSE); + sdi->version = g_string_free(version, FALSE); /* Optionally amend received metadata, model specific quirks. */ ols_metadata_quirks(sdi);