]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hameg-hmo/protocol.c
Don't check sr_channel_new() return value (always succeeds).
[libsigrok.git] / src / hardware / hameg-hmo / protocol.c
index a1cee6aa9ef1df788043007e1f04ef22b2f5e973..8f39ba112b40f1955fe924a07a9db66c035b4e8f 100644 (file)
@@ -45,21 +45,21 @@ static const char *hameg_scpi_dialect[] = {
        [SCPI_CMD_SET_ANALOG_CHAN_STATE]    = ":CHAN%d:STAT %d",
 };
 
-static const uint32_t hmo_hwcaps[] = {
+static const uint32_t hmo_devopts[] = {
        SR_CONF_OSCILLOSCOPE,
-       SR_CONF_TRIGGER_SOURCE,
-       SR_CONF_TIMEBASE,
-       SR_CONF_NUM_TIMEBASE,
-       SR_CONF_TRIGGER_SLOPE,
-       SR_CONF_HORIZ_TRIGGERPOS,
-       SR_CONF_SAMPLERATE,
        SR_CONF_LIMIT_FRAMES,
+       SR_CONF_TRIGGER_SOURCE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_TIMEBASE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_NUM_TIMEBASE | SR_CONF_GET,
+       SR_CONF_TRIGGER_SLOPE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_HORIZ_TRIGGERPOS | SR_CONF_GET | SR_CONF_SET,
+       SR_CONF_SAMPLERATE | SR_CONF_GET,
 };
 
-static const uint32_t hmo_analog_caps[] = {
-       SR_CONF_NUM_VDIV,
-       SR_CONF_COUPLING,
-       SR_CONF_VDIV,
+static const uint32_t hmo_analog_devopts[] = {
+       SR_CONF_NUM_VDIV | SR_CONF_GET,
+       SR_CONF_COUPLING | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_VDIV | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
 };
 
 static const char *hmo_coupling_options[] = {
@@ -204,11 +204,11 @@ static struct scope_config scope_models[] = {
                .analog_names = &scope_analog_channel_names,
                .digital_names = &scope_digital_channel_names,
 
-               .hw_caps = &hmo_hwcaps,
-               .num_hwcaps = ARRAY_SIZE(hmo_hwcaps),
+               .devopts = &hmo_devopts,
+               .num_devopts = ARRAY_SIZE(hmo_devopts),
 
-               .analog_hwcaps = &hmo_analog_caps,
-               .num_analog_hwcaps = ARRAY_SIZE(hmo_analog_caps),
+               .analog_devopts = &hmo_analog_devopts,
+               .num_analog_devopts = ARRAY_SIZE(hmo_analog_devopts),
 
                .coupling_options = &hmo_coupling_options,
                .trigger_sources = &hmo_compact2_trigger_sources,
@@ -234,11 +234,11 @@ static struct scope_config scope_models[] = {
                .analog_names = &scope_analog_channel_names,
                .digital_names = &scope_digital_channel_names,
 
-               .hw_caps = &hmo_hwcaps,
-               .num_hwcaps = ARRAY_SIZE(hmo_hwcaps),
+               .devopts = &hmo_devopts,
+               .num_devopts = ARRAY_SIZE(hmo_devopts),
 
-               .analog_hwcaps = &hmo_analog_caps,
-               .num_analog_hwcaps = ARRAY_SIZE(hmo_analog_caps),
+               .analog_devopts = &hmo_analog_devopts,
+               .num_analog_devopts = ARRAY_SIZE(hmo_analog_devopts),
 
                .coupling_options = &hmo_coupling_options,
                .trigger_sources = &hmo_compact4_trigger_sources,
@@ -616,9 +616,8 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
 
        /* Add analog channels. */
        for (i = 0; i < scope_models[model_index].analog_channels; i++) {
-               if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
-                          (*scope_models[model_index].analog_names)[i])))
-                       return SR_ERR_MALLOC;
+               ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
+                          (*scope_models[model_index].analog_names)[i]);
                sdi->channels = g_slist_append(sdi->channels, ch);
 
                devc->analog_groups[i] = g_malloc0(sizeof(struct sr_channel_group));
@@ -644,9 +643,8 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
 
        /* Add digital channels. */
        for (i = 0; i < scope_models[model_index].digital_channels; i++) {
-               if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
-                          (*scope_models[model_index].digital_names)[i])))
-                       return SR_ERR_MALLOC;
+               ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
+                          (*scope_models[model_index].digital_names)[i]);
                sdi->channels = g_slist_append(sdi->channels, ch);
 
                devc->digital_groups[i < 8 ? 0 : 1]->channels = g_slist_append(