Don't start session with 0-channel devices.
Drivers aren't really able to deal with that in some cases, and it denotes a frontend bug.
This commit is contained in:
parent
cfd8ec53ab
commit
013ec84b83
|
@ -434,8 +434,9 @@ static int verify_trigger(struct sr_trigger *trigger)
|
||||||
SR_API int sr_session_start(struct sr_session *session)
|
SR_API int sr_session_start(struct sr_session *session)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
GSList *l;
|
struct sr_channel *ch;
|
||||||
int ret;
|
GSList *l, *c;
|
||||||
|
int enabled_channels, ret;
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
sr_err("%s: session was NULL", __func__);
|
sr_err("%s: session was NULL", __func__);
|
||||||
|
@ -456,6 +457,21 @@ SR_API int sr_session_start(struct sr_session *session)
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
for (l = session->devs; l; l = l->next) {
|
for (l = session->devs; l; l = l->next) {
|
||||||
sdi = l->data;
|
sdi = l->data;
|
||||||
|
enabled_channels = 0;
|
||||||
|
for (c = sdi->channels; c; c = c->next) {
|
||||||
|
ch = c->data;
|
||||||
|
if (ch->enabled) {
|
||||||
|
enabled_channels++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (enabled_channels == 0) {
|
||||||
|
ret = SR_ERR;
|
||||||
|
sr_err("%s instance %d has no enabled channels!",
|
||||||
|
sdi->driver->name, sdi->index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ((ret = sr_config_commit(sdi)) != SR_OK) {
|
if ((ret = sr_config_commit(sdi)) != SR_OK) {
|
||||||
sr_err("Failed to commit device settings before "
|
sr_err("Failed to commit device settings before "
|
||||||
"starting acquisition (%s)", sr_strerror(ret));
|
"starting acquisition (%s)", sr_strerror(ret));
|
||||||
|
|
Loading…
Reference in New Issue