]> sigrok.org Git - libsigrok.git/blobdiff - hardware/alsa/api.c
Replace 'probe' with 'channel' in most places.
[libsigrok.git] / hardware / alsa / api.c
index dd5588dd4ff11c10d92e5ec6c96eb7f7db0bbad0..82af3d0ed70111127312780c26f21e1c7ad1f1ff 100644 (file)
@@ -43,7 +43,10 @@ static void clear_helper(void *priv)
        devc = priv;
 
        snd_pcm_hw_params_free(devc->hw_params);
+       devc->hw_params = NULL;
+
        g_free((void *)devc->samplerates);
+       devc->samplerates = NULL;
 }
 
 static int dev_clear(void)
@@ -108,12 +111,11 @@ static int dev_close(struct sr_dev_inst *sdi)
 
        if (devc->capture_handle) {
                sr_dbg("Closing PCM device.");
-               if ((ret = snd_pcm_close(devc->capture_handle)) < 0) {
+               if ((ret = snd_pcm_close(devc->capture_handle)) < 0)
                        sr_err("Failed to close device: %s.",
                               snd_strerror(ret));
-                       devc->capture_handle = NULL;
-            sdi->status = SR_ST_INACTIVE;
-               }
+               devc->capture_handle = NULL;
+               sdi->status = SR_ST_INACTIVE;
        } else {
                sr_dbg("No capture handle, no need to close audio device.");
        }
@@ -126,10 +128,13 @@ static int cleanup(void)
        return dev_clear();
 }
 
-static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
+static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
 
+       (void)cg;
+
        switch (id) {
        case SR_CONF_SAMPLERATE:
                devc = sdi->priv;
@@ -142,10 +147,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
+static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
 
+       (void)cg;
+
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
@@ -165,13 +173,16 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
+static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
        GVariant *gvar;
        GVariantBuilder gvb;
        int i;
 
+       (void)cg;
+
        switch (key) {
        case SR_CONF_DEVICE_OPTIONS:
                *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
@@ -244,9 +255,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
                return SR_ERR;
        }
 
-       sr_dbg("Setting audio channel count to %d.", devc->num_probes);
+       sr_dbg("Setting audio channel count to %d.", devc->num_channels);
        ret = snd_pcm_hw_params_set_channels(devc->capture_handle,
-                                            devc->hw_params, devc->num_probes);
+                                            devc->hw_params, devc->num_channels);
        if (ret < 0) {
                sr_err("Can't set channel count: %s.", snd_strerror(ret));
                return SR_ERR;