]> sigrok.org Git - libsigrok.git/commit - src/hardware/demo/api.c
demo: Handle the case when zero analog or logic channels were requested
authorLars-Peter Clausen <redacted>
Fri, 13 May 2016 15:36:06 +0000 (17:36 +0200)
committerUwe Hermann <redacted>
Fri, 13 May 2016 23:06:20 +0000 (01:06 +0200)
commitf18e0db3b8e8c24703e74fe36f9353381221b3c7
tree3d8a263025da539798688deacb54c165ed2602dc
parent7e2f42214a72bb3ad2b4ce1767ff8945fa83fe97
demo: Handle the case when zero analog or logic channels were requested

The demo device has support for specifying the number of analog and logic
channels it should have. Currently this does not work correctly if one of
them is set to zero. Being able to set the number of channels to zero for
one of the channel types is quite useful for corner case testing though.

Make the following modifications to handle it correctly:

1) If the channel count is zero no channel group for that channel type
should be created since a channel group needs at least one channel.

2) Drop the check if logic_unitsize is less or equal to zero in
prepare_data() since this condition will always be true if the number of
logic channels is zero and it is not possible to create a demo device with
only analog channels.

Signed-off-by: Lars-Peter Clausen <redacted>
src/hardware/demo/demo.c