Where to install libgpiod to work with GPIO?

I’m aware that Jetson come with a python library called Jetson‑IO for working with the GPIO and under the hood, it uses the GPIO sysfs interface which is now deprecated, the new interface is libgpiod. I want to use the API provided by libgpiod from my C program, however, it seems that libgpiod is not installed on the Jetson Nano by default? If so, I need to install the library. From the build instruction of libgpiod:

./autogen.sh --enable-tools=yes --prefix=<install path>

What should I put for install path? Does /usr/local work or it need to be install under aarch64-linux-gnu?

hello hyperlight,

please refer to Configuring the 40-Pin Expansion Header, are you able to enable Jetson-IO python tool for accessing.

Hi @JerryChang,

Thank you for the link but it doesn’t answer my question. I didn’t ask about how to configure the GPIO pins.

I’m aware of Jetson‑IO (for pin configuration) and Jetson.GPIO (Python API for working with GPIO from the user space through the sysfs interface).

Neither work for my use case for several reasons:

  1. I’m not trying to configuration the pins so Jetson‑IO is not what I need.

  2. I want to work with the pins from my application via API calls, Jetson.GPIO provides that but:

    a) it’s in Python and my application code is written in C (a nvidia deepstream application)

    b) Jetson.GPIO use sysfs interface which is slow and the sysfs interface is now deprecated, the recommended interface is the character device interface (libgpiod) which provide native C API and C++/Python bindings.

I’m trying to figure out how to install libgpiod on a jetson nano and where to install it. I apology if my original question is unclear.

hello hyperlight,

please also check Topic 144550, for several ways to access GPIOs. such as, kernel APIs, python scripts, C++ samples.