Bert Vermeulen [Fri, 25 Jan 2013 00:24:42 +0000 (01:24 +0100)]
New driver API function: config_list()
This takes an sr_config key and returns a list of possible values for
that key to be submitted with config_set(). The format of the list and
its contents is dependent on the key.
This will replace the SR_DI_* keys that returned such a list before,
such as SR_DI_SAMPLERATES.
Bert Vermeulen [Sun, 20 Jan 2013 14:45:09 +0000 (15:45 +0100)]
Use new SR_DF_META packet.
Since input modules determine a samplerate by reading from their
file format (or having it overridden with an option), they need
to pass this up to the frontend.
Bert Vermeulen [Sun, 6 Jan 2013 16:41:30 +0000 (17:41 +0100)]
drivers: use new sr_config struct
Sending an SR_DF_META packet at the start of every stream is not
mandatory; the frontend should ask for what it needs, and any extra
information the driver wants to send will come in due time.
Uwe Hermann [Sun, 20 Jan 2013 17:48:02 +0000 (18:48 +0100)]
Remove non-error hw_info_get() messages.
Currently hw_info_get() can receive requests for entries (info_id) that
the specific driver doesn't support. That is (right now) a valid
use-case and not an error (might change later, though).
Thus, for now, don't output messages for such requests at all (certainly
not as sr_err() where they show up in e.g. sigrok-cli output per default).
Uwe Hermann [Tue, 15 Jan 2013 23:02:24 +0000 (00:02 +0100)]
alsa: Silence ALSA scanning process.
Errors while opening or configuring ALSA devices during scan for devices
should not be shown by default (i.e., no sr_err() usage). Non-working
or non-accessible devices (due to permissions or other reasons) will
simply not show up in frontends. Use sr_dbg() instead of sr_err().
Fix the bare minumum of whitespace/indentation/coding-style via
automatic 'indent' run, followed by some minor manual fixes.
Some more fixes and cleanups might follow later.
Uwe Hermann [Thu, 3 Jan 2013 18:17:51 +0000 (19:17 +0100)]
Add gnuplot_rigol_ds1xx2.gpi gnuplot script.
This is a very simple gnuplot script for testing the Rigol DS1xx2 driver.
It currently has various issues and limitations (e.g. only one channel
is displayed, the scaling is not usable, and so on) to be fixed later.
alsa: Find supported samplerates during device scan
Since we are using the 'hw' interface of ALSA, we don't have the luxury of
samplerate conversion, given by the 'plughw' interface. If we try to set a
samplerate that is not supported, ALSA will just throw an error.
We can test for the supported samplerates, and create a list of supported
samplerates, then limit the selection to only those values. The frontend can
query the list of supported samplerates.
alsa: Fix sample acquisition and send normalized values
The alsa driver requested signed 16-bit integers from ALSA, but casted them to
to an unsigned 16bit before finally casting them to a float. The end result was
that half of the wave would be clipped off.
We also requested data in little endian format. ALSA can be instructed to send
data with the correct endianness for the platform, without needing to worry
about what that is.
This patch attempts three points, which, together, fix the acquisition:
1) Request data from ALSA without specifying endianness; ALSA will handle the
endianness.
2) Simplify the int16_t to float loop by using straightforward indexes.
3) Normalize every value before sending it on the session bus.
NOTE: If testing with PulseView, it will appear as if sigrok is sending all
zeroes. sigrok is sending correct data, but since the data is normalized,
PulseView will incorrectly plot it as a straight line.
alsa: Scan all soundcards and create a sigrok device per input
The alsa driver only works with device "default". This limits the driver's
scope to whatever device ALSA deems to be "default". It is desirable to have
access to all ALSA devices from sigrok.
Change the alsa device scan so that:
Each alsa device (not alsa card) gets its own sigrok device
For example,
hw:1,0 == sigrok device 0
hw:1,1 == sigrok device 1
hw:2,0 == sigrok device 2
hw:2,1 == sigrok device 3
hw:2,2 == sigrok device 4
[...]
We don't currently look at alsa subdevices. We only use subdevice 0.
Every input device will have its own channels (left, right, etc). Each of
those channels gets mapped to a different sigrok probe. A device with 4
channels will have 4 probes from sigrok's perspective.
alsa: Do not use snd_pcm_hw_params_set_rate_near()
snd_pcm_hw_params_set_rate_near() will try to use the samplerate closest to the
given value, potentially starting the acquisition with a different samplerate
than the one specified.
Instead, use snd_pcm_hw_params_set_rate(). It will return an error if the
samplerate is not supported by the hardware, which is arguably better than
collecting data with a different samplerate than the one specified.