X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Falsa%2Fprotocol.c;h=eea2f5bd427159faff0ee160f4474952659037e8;hb=4a35548bbee613149fa4fbfa3dd9eaacb7511376;hp=4a9f02f3075342c7ed239f63225531fa7652e36f;hpb=3d6de074a445fbd3ac0adfa2bc28e3fd283df681;p=libsigrok.git diff --git a/hardware/alsa/protocol.c b/hardware/alsa/protocol.c index 4a9f02f3..eea2f5bd 100644 --- a/hardware/alsa/protocol.c +++ b/hardware/alsa/protocol.c @@ -152,14 +152,14 @@ static void alsa_scan_handle_dev(GSList **devices, devc->num_probes = channels; devc->hw_params = hw_params; memcpy(devrates, hwrates, offset * sizeof(uint64_t)); - devc->supp_rates.list = devrates; + devc->samplerates = devrates; sdi->priv = devc; sdi->driver = di; for (i = 0; i < devc->num_probes; i++) { snprintf(p_name, sizeof(p_name), "Ch_%d", i); - if (!(probe = sr_probe_new(0, SR_PROBE_ANALOG, TRUE, p_name))) + if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, p_name))) goto scan_error_cleanup; sdi->probes = g_slist_append(sdi->probes, probe); } @@ -282,22 +282,6 @@ SR_PRIV GSList *alsa_scan(GSList *options, struct sr_dev_driver *di) return devices; } -/* - * Helper to be used with g_slist_free_full(); for properly freeing an alsa - * dev instance. - */ -SR_PRIV void alsa_dev_inst_clear(struct sr_dev_inst *sdi) -{ - struct dev_context *devc; - - if (!(devc = sdi->priv)) - return; - - snd_pcm_hw_params_free(devc->hw_params); - g_free((void*)devc->supp_rates.list); - sr_dev_inst_free(sdi); -} - /** * Set the samplerate of the ALSA device. * @@ -326,11 +310,11 @@ SR_PRIV int alsa_set_samplerate(const struct sr_dev_inst *sdi, i = 0; do { - if (newrate == devc->supp_rates.list[i]) { + if (newrate == devc->samplerates[i]) { rate = newrate; break; } - } while (devc->supp_rates.list[i++] != 0); + } while (devc->samplerates[i++] != 0); if (!rate) { sr_err("Sample rate %" PRIu64 " not supported.", newrate); @@ -396,6 +380,7 @@ SR_PRIV int alsa_receive_data(int fd, int revents, void *cb_data) } /* Send a sample packet with the analog values. */ + analog.probes = sdi->probes; analog.num_samples = count; analog.mq = SR_MQ_VOLTAGE; /* FIXME */ analog.unit = SR_UNIT_VOLT; /* FIXME */