beaglelogic: Update scan() to return all 14 channels by default
This is unlike the previous behavior to return 8 channels and then use logic_channels to get all the 14 channels Signed-off-by: Kumar Abhishek <abhishek@theembeddedkitchen.net>
This commit is contained in:
parent
1f488f50b9
commit
6eab3021ec
|
@ -83,41 +83,24 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS))
|
if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sdi = g_malloc0(sizeof(struct sr_dev_inst));
|
maxch = NUM_CHANNELS;
|
||||||
sdi->status = SR_ST_INACTIVE;
|
|
||||||
sdi->model = g_strdup("BeagleLogic");
|
|
||||||
sdi->version = g_strdup("1.0");
|
|
||||||
|
|
||||||
/* Unless explicitly specified, keep max channels to 8 only */
|
|
||||||
maxch = 8;
|
|
||||||
for (l = options; l; l = l->next) {
|
for (l = options; l; l = l->next) {
|
||||||
src = l->data;
|
src = l->data;
|
||||||
if (src->key == SR_CONF_NUM_LOGIC_CHANNELS)
|
if (src->key == SR_CONF_NUM_LOGIC_CHANNELS)
|
||||||
maxch = g_variant_get_int32(src->data);
|
maxch = g_variant_get_int32(src->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need to test for number of channels by opening the node */
|
if (maxch > 8)
|
||||||
devc = beaglelogic_devc_alloc();
|
|
||||||
|
|
||||||
if (beaglelogic_open_nonblock(devc) != SR_OK) {
|
|
||||||
g_free(devc);
|
|
||||||
sr_dev_inst_free(sdi);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxch > 8) {
|
|
||||||
maxch = NUM_CHANNELS;
|
maxch = NUM_CHANNELS;
|
||||||
devc->sampleunit = BL_SAMPLEUNIT_16_BITS;
|
else
|
||||||
} else {
|
|
||||||
maxch = 8;
|
maxch = 8;
|
||||||
devc->sampleunit = BL_SAMPLEUNIT_8_BITS;
|
|
||||||
}
|
|
||||||
|
|
||||||
beaglelogic_set_sampleunit(devc);
|
sdi = g_new0(struct sr_dev_inst, 1);
|
||||||
beaglelogic_close(devc);
|
sdi->status = SR_ST_INACTIVE;
|
||||||
|
sdi->model = g_strdup("BeagleLogic");
|
||||||
|
sdi->version = g_strdup("1.0");
|
||||||
|
|
||||||
sr_info("BeagleLogic device found at "BEAGLELOGIC_DEV_NODE);
|
devc = beaglelogic_devc_alloc();
|
||||||
|
|
||||||
for (i = 0; i < maxch; i++)
|
for (i = 0; i < maxch; i++)
|
||||||
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
|
sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
|
||||||
|
@ -125,6 +108,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
|
|
||||||
|
/* Signal */
|
||||||
|
sr_info("BeagleLogic device found at "BEAGLELOGIC_DEV_NODE);
|
||||||
|
|
||||||
return std_scan_complete(di, g_slist_append(NULL, sdi));
|
return std_scan_complete(di, g_slist_append(NULL, sdi));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue