hameg-hmo: Fix index access for models with 2 pods / 16 digital channels

Fix the code which registers the name of the second pod for digital
probes. The previous implementation registered the first pod twice, and
lost the reference to the second pod. No harm was done, none of the
supported models declared support for two pods so far.

Factor out a channel to group mapping in the registration of digital
channels, while we are here.
This commit is contained in:
Gerhard Sittig 2016-11-06 11:51:08 +01:00 committed by Uwe Hermann
parent f05903ebe3
commit 2d224dbae7
1 changed files with 5 additions and 4 deletions

View File

@ -631,7 +631,7 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
{ {
char tmp[25]; char tmp[25];
int model_index; int model_index;
unsigned int i, j; unsigned int i, j, group;
struct sr_channel *ch; struct sr_channel *ch;
struct dev_context *devc; struct dev_context *devc;
@ -684,7 +684,7 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
devc->digital_groups[i]->name = g_strdup(tmp); devc->digital_groups[i]->name = g_strdup(tmp);
sdi->channel_groups = g_slist_append(sdi->channel_groups, sdi->channel_groups = g_slist_append(sdi->channel_groups,
devc->digital_groups[i < 8 ? 0 : 1]); devc->digital_groups[i]);
} }
/* Add digital channels. */ /* Add digital channels. */
@ -692,8 +692,9 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
ch = sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, ch = sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
(*scope_models[model_index].digital_names)[i]); (*scope_models[model_index].digital_names)[i]);
devc->digital_groups[i < 8 ? 0 : 1]->channels = g_slist_append( group = i / 8;
devc->digital_groups[i < 8 ? 0 : 1]->channels, ch); devc->digital_groups[group]->channels = g_slist_append(
devc->digital_groups[group]->channels, ch);
} }
devc->model_config = &scope_models[model_index]; devc->model_config = &scope_models[model_index];