#input-output #linux #iio #analog #unsafe-bindings

sys libiio-sys

Native, unsafe, bindings to the Linux libiio library. Used by industrial-io.

5 releases (3 breaking)

new 0.4.0 Dec 10, 2024
0.3.1 Jan 28, 2022
0.3.0 May 26, 2021
0.2.0 Dec 29, 2019
0.1.0 Nov 22, 2018

#479 in Embedded development

Download history 748/week @ 2024-08-23 560/week @ 2024-08-30 624/week @ 2024-09-06 584/week @ 2024-09-13 734/week @ 2024-09-20 1102/week @ 2024-09-27 995/week @ 2024-10-04 901/week @ 2024-10-11 852/week @ 2024-10-18 830/week @ 2024-10-25 805/week @ 2024-11-01 603/week @ 2024-11-08 1009/week @ 2024-11-15 843/week @ 2024-11-22 702/week @ 2024-11-29 813/week @ 2024-12-06

3,451 downloads per month
Used in 2 crates (via industrial-io)

MIT license

2MB
44K SLoC

Rust wrapper for Linux Industrial I/O library, libiio

Crates.io

Rust wrapper for the Linux Industrial I/O user-space library, libiio. This provides high-performance analog input and output on Linux systems.

Currently this defaults to bindings for libiio v0.25.

To use in an application, add this to Cargo.toml:

[dependencies]
libiio-sys = "0.4"

Generating Bindings

Bindings for different versions of the C library can be generated using the bindgen command-line tools.

Run bindgen over the iio.h header from the desired version of the library, outputting the results to a file,

bindings-<version>_<size>.rs

where <version> is the libiio version and <size> is the target CPU word size (typically 32 or 64).

So, for example, this is how we generated them v0.25, on a 64-bit system:

First we cloned the repo and checked out the proper version:

$ git clone https://github.com/analogdevicesinc/libiio.git
$ cd libiio
$ git checkout v0.25

Then into the directory for this repo, we ran bindgen on the header saving the result in the bindings directory:

$ cd industrial-io/libiio-sys/
$ bindgen ~/libiio/iio.h -o bindings/bindings-0.25_64.rs

Dependencies