sr: zeroplus: Fix segfault, add debug output.
There are various ZEROPLUS models with different probe numbers. For now hardcode to 16 (for the popular LAP-C(16032)). This will need to be fixed in a dynamic way later. This fixes a segfault due to only 16 probe-names being defined, but the drivers returning 32 as probecount. Also, add some additional debug output.
This commit is contained in:
parent
993526f824
commit
6752905e6b
|
@ -34,6 +34,7 @@
|
||||||
#define USB_MODEL_NAME "Logic Cube"
|
#define USB_MODEL_NAME "Logic Cube"
|
||||||
#define USB_MODEL_VERSION ""
|
#define USB_MODEL_VERSION ""
|
||||||
|
|
||||||
|
#define NUM_PROBES 16
|
||||||
#define USB_INTERFACE 0
|
#define USB_INTERFACE 0
|
||||||
#define USB_CONFIGURATION 1
|
#define USB_CONFIGURATION 1
|
||||||
#define NUM_TRIGGER_STAGES 4
|
#define NUM_TRIGGER_STAGES 4
|
||||||
|
@ -78,7 +79,7 @@ static int hwcaps[] = {
|
||||||
* ZEROPLUS LAP-C (16032) numbers the 16 probes A0-A7 and B0-B7.
|
* ZEROPLUS LAP-C (16032) numbers the 16 probes A0-A7 and B0-B7.
|
||||||
* We currently ignore other untested/unsupported devices here.
|
* We currently ignore other untested/unsupported devices here.
|
||||||
*/
|
*/
|
||||||
static const char *probe_names[] = {
|
static const char *probe_names[NUM_PROBES + 1] = {
|
||||||
"A0",
|
"A0",
|
||||||
"A1",
|
"A1",
|
||||||
"A2",
|
"A2",
|
||||||
|
@ -345,7 +346,8 @@ static int hw_init(const char *devinfo)
|
||||||
/* Set some sane defaults. */
|
/* Set some sane defaults. */
|
||||||
ctx->cur_samplerate = 0;
|
ctx->cur_samplerate = 0;
|
||||||
ctx->limit_samples = 0;
|
ctx->limit_samples = 0;
|
||||||
ctx->num_channels = 32; /* TODO: This isn't initialized before it's needed :( */
|
/* TODO: num_channels isn't initialized before it's needed :( */
|
||||||
|
ctx->num_channels = NUM_PROBES;
|
||||||
ctx->memory_size = 0;
|
ctx->memory_size = 0;
|
||||||
ctx->probe_mask = 0;
|
ctx->probe_mask = 0;
|
||||||
memset(ctx->trigger_mask, 0, NUM_TRIGGER_STAGES);
|
memset(ctx->trigger_mask, 0, NUM_TRIGGER_STAGES);
|
||||||
|
@ -512,24 +514,35 @@ static void *hw_dev_info_get(int dev_index, int dev_info_id)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sr_spew("zp: %s: dev_index %d, dev_info_id %d.", __func__,
|
||||||
|
dev_index, dev_info_id);
|
||||||
|
|
||||||
switch (dev_info_id) {
|
switch (dev_info_id) {
|
||||||
case SR_DI_INST:
|
case SR_DI_INST:
|
||||||
info = sdi;
|
info = sdi;
|
||||||
|
sr_spew("zp: %s: Returning sdi.", __func__);
|
||||||
break;
|
break;
|
||||||
case SR_DI_NUM_PROBES:
|
case SR_DI_NUM_PROBES:
|
||||||
info = GINT_TO_POINTER(ctx->num_channels);
|
info = GINT_TO_POINTER(ctx->num_channels);
|
||||||
|
sr_spew("zp: %s: Returning number of probes: %d.", __func__,
|
||||||
|
NUM_PROBES);
|
||||||
break;
|
break;
|
||||||
case SR_DI_PROBE_NAMES:
|
case SR_DI_PROBE_NAMES:
|
||||||
info = probe_names;
|
info = probe_names;
|
||||||
|
sr_spew("zp: %s: Returning probenames.", __func__);
|
||||||
break;
|
break;
|
||||||
case SR_DI_SAMPLERATES:
|
case SR_DI_SAMPLERATES:
|
||||||
info = &samplerates;
|
info = &samplerates;
|
||||||
|
sr_spew("zp: %s: Returning samplerates.", __func__);
|
||||||
break;
|
break;
|
||||||
case SR_DI_TRIGGER_TYPES:
|
case SR_DI_TRIGGER_TYPES:
|
||||||
info = TRIGGER_TYPES;
|
info = TRIGGER_TYPES;
|
||||||
|
sr_spew("zp: %s: Returning triggertypes: %s.", __func__, info);
|
||||||
break;
|
break;
|
||||||
case SR_DI_CUR_SAMPLERATE:
|
case SR_DI_CUR_SAMPLERATE:
|
||||||
info = &ctx->cur_samplerate;
|
info = &ctx->cur_samplerate;
|
||||||
|
sr_spew("zp: %s: Returning samplerate: %" PRIu64 "Hz.",
|
||||||
|
__func__, ctx->cur_samplerate);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Unknown device info ID, return NULL. */
|
/* Unknown device info ID, return NULL. */
|
||||||
|
|
Loading…
Reference in New Issue