mbox series

[V2,0/4] libgpiod: Add Rust bindings

Message ID cover.1638443930.git.viresh.kumar@linaro.org
Headers show
Series libgpiod: Add Rust bindings | expand

Message

Viresh Kumar Dec. 2, 2021, 11:22 a.m. UTC
Hi Bartosz,

This patch adds rust bindings for libgpiod v2.0, this is already partially
tested with the virtio rust backend I am developing, which uses these to talk to
the host kernel.

This is based of the next/post-libgpiod-2.0 branch.

I will be adding testing infrastructure later on, once other bindings are
converted to use gpiosim.

V1->V2:
- Added examples (I tested everything except gpiomon.rs, didn't have right
  hardware/mock device to test).
- Build rust bindings as part of Make, update documentation.

Thanks.

--
Viresh

Viresh Kumar (4):
  libgpiod: Generate rust FFI bindings
  libgpiod: Add rust wrappers
  rust: Add examples
  rust: Integrate building of rust bindings with make

 .gitignore                           |   5 +
 README                               |   8 +-
 TODO                                 |   8 -
 bindings/Makefile.am                 |   6 +
 bindings/rust/Cargo.toml             |  14 +
 bindings/rust/Makefile.am            |  29 ++
 bindings/rust/build.rs               |  60 ++++
 bindings/rust/examples/gpiodetect.rs |  38 +++
 bindings/rust/examples/gpiofind.rs   |  43 +++
 bindings/rust/examples/gpioget.rs    |  45 +++
 bindings/rust/examples/gpioinfo.rs   |  90 ++++++
 bindings/rust/examples/gpiomon.rs    |  73 +++++
 bindings/rust/examples/gpioset.rs    |  55 ++++
 bindings/rust/src/bindings.rs        |  16 +
 bindings/rust/src/chip.rs            | 197 ++++++++++++
 bindings/rust/src/edge_event.rs      |  78 +++++
 bindings/rust/src/event_buffer.rs    |  59 ++++
 bindings/rust/src/info_event.rs      |  70 +++++
 bindings/rust/src/lib.rs             | 268 +++++++++++++++++
 bindings/rust/src/line_config.rs     | 431 +++++++++++++++++++++++++++
 bindings/rust/src/line_info.rs       | 186 ++++++++++++
 bindings/rust/src/line_request.rs    | 217 ++++++++++++++
 bindings/rust/src/request_config.rs  | 118 ++++++++
 bindings/rust/wrapper.h              |   2 +
 configure.ac                         |  16 +
 25 files changed, 2121 insertions(+), 11 deletions(-)
 create mode 100644 bindings/rust/Cargo.toml
 create mode 100644 bindings/rust/Makefile.am
 create mode 100644 bindings/rust/build.rs
 create mode 100644 bindings/rust/examples/gpiodetect.rs
 create mode 100644 bindings/rust/examples/gpiofind.rs
 create mode 100644 bindings/rust/examples/gpioget.rs
 create mode 100644 bindings/rust/examples/gpioinfo.rs
 create mode 100644 bindings/rust/examples/gpiomon.rs
 create mode 100644 bindings/rust/examples/gpioset.rs
 create mode 100644 bindings/rust/src/bindings.rs
 create mode 100644 bindings/rust/src/chip.rs
 create mode 100644 bindings/rust/src/edge_event.rs
 create mode 100644 bindings/rust/src/event_buffer.rs
 create mode 100644 bindings/rust/src/info_event.rs
 create mode 100644 bindings/rust/src/lib.rs
 create mode 100644 bindings/rust/src/line_config.rs
 create mode 100644 bindings/rust/src/line_info.rs
 create mode 100644 bindings/rust/src/line_request.rs
 create mode 100644 bindings/rust/src/request_config.rs
 create mode 100644 bindings/rust/wrapper.h

Comments

Viresh Kumar April 11, 2022, 3:33 a.m. UTC | #1
On 02-12-21, 16:52, Viresh Kumar wrote:
> Hi Bartosz,
> 
> This patch adds rust bindings for libgpiod v2.0, this is already partially
> tested with the virtio rust backend I am developing, which uses these to talk to
> the host kernel.
> 
> This is based of the next/post-libgpiod-2.0 branch.
> 
> I will be adding testing infrastructure later on, once other bindings are
> converted to use gpiosim.

Hi Bartosz,

I can see a lots of patches related to V2 version making there way
into libgpiod, but it is a bit hard for me to follow them currently.

Just wanted to request you, if you can ping me once the API is stable
enough and most of the V2 changes you planned are merged, so I can
rebase my stuff over those and send for review.

Thanks.
Bartosz Golaszewski April 11, 2022, 8:57 a.m. UTC | #2
On Mon, Apr 11, 2022 at 5:33 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 02-12-21, 16:52, Viresh Kumar wrote:
> > Hi Bartosz,
> >
> > This patch adds rust bindings for libgpiod v2.0, this is already partially
> > tested with the virtio rust backend I am developing, which uses these to talk to
> > the host kernel.
> >
> > This is based of the next/post-libgpiod-2.0 branch.
> >
> > I will be adding testing infrastructure later on, once other bindings are
> > converted to use gpiosim.
>
> Hi Bartosz,
>
> I can see a lots of patches related to V2 version making there way
> into libgpiod, but it is a bit hard for me to follow them currently.
>
> Just wanted to request you, if you can ping me once the API is stable
> enough and most of the V2 changes you planned are merged, so I can
> rebase my stuff over those and send for review.
>
> Thanks.
>
> --
> viresh

Hi Viresh!

Yes, I will! Just to give you a summary: the C API is mostly ready but
I can't guarantee it won't change more. The C++ API needs another
revision that should be posted today or tomorrow. The Python bindings
are still WIP but will be ready soon. Once those three are agreed
upon, we'll merge them into master as one (for bisectability), drop
the next branch and work from there on new features (including Rust
bindings). That's my plan at least.

Bart