Scanning Functions

struct iio_scan *iio_scan(const struct iio_context_params *params, const char *backends)

Scan backends for IIO contexts.

NOTE: It is possible to provide backend-specific information. For instance, “local,usb=0456:*” will scan the local backend and limit scans on USB to vendor ID 0x0456, and accept all product IDs. The “usb=0456:b673” string would limit the scan to the device with this particular VID/PID. Both IDs are expected in hexadecimal, no 0x prefix needed.

Parameters:
  • params – A pointer to a iio_context_params structure that contains context creation information; can be NULL

  • backends – a NULL-terminated string containing a comma-separated list of the backends to be scanned for contexts. If NULL, all the available backends are scanned.

Returns:

On success, a pointer to an iio_scan structure

Returns:

On failure, a pointer-encoded error is returned

void iio_scan_destroy(struct iio_scan *ctx)

Destroy the given scan context.

NOTE: After that function, the iio_scan pointer shall be invalid.

Parameters:

ctx – A pointer to an iio_scan structure

size_t iio_scan_get_results_count(const struct iio_scan *ctx)

Get number of results of a scan operation.

Parameters:

ctx – A pointer to an iio_scan structure

Returns:

The number of results of the scan operation

const char *iio_scan_get_description(const struct iio_scan *ctx, size_t idx)

Get description of scanned context.

Parameters:
  • ctx – A pointer to an iio_scan structure

  • idx – The index of the scanned context

Returns:

On success, a pointer to a NULL-terminated string

Returns:

If the index is invalid, NULL is returned

const char *iio_scan_get_uri(const struct iio_scan *ctx, size_t idx)

Get URI of scanned context.

Parameters:
  • ctx – A pointer to an iio_scan structure

  • idx – The index of the scanned context

Returns:

On success, a pointer to a NULL-terminated string

Returns:

If the index is invalid, NULL is returned

struct iio_scan
#include <iio.h>

Structure holding scanning information.