Added implementation of iio_channel_get_index

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Added implementations of iio_channel_[enable|disable|is_enabled]

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Local backend: Enable all channels when opening the device

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Added API function iio_device_open_mask

This function accepts a mask as parameter, of which each bit
corresponds to the index of a channel. If the bit is set, the
corresponding channel is enabled; otherwise, the channel is disabled.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
iio_readdev: Enable all channels before opening the device
iio_readdev: Set the trigger before opening the device

Otherwise, opening the device will fail.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Local backend: Fix error messages

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
IIOD: Add the make target "analyze" to analyze code with Clang

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
IIOD: Added commands OPEN and CLOSE

Previously, the daemon would open and close the IIO devices on
demand (open when READBUF was used, close after a timeout).

However, we want to be able to select a mask of channels when
opening the device, so that we receive only the data of the channels
we're interested in.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
IIOD: Register a client thread as soon as OPEN is used

Previously, a client thread was registered as a client for a device
at the beginning of the read_buffer function (called with the READBUF
command from the interpreter) and de-registered as soon as the read
was complete. This caused several problems; for instance, it was not
possible for the reading thread to know the best channel mask to use,
as it had no pointers to the structures of its clients.

Now, the client thread is registered when the OPEN command is used,
and it is de-registered only when CLOSE is used. This permits to
dynamically adjust the number of opened channels, according to the
channel mask of each client, when clients use those commands.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>