Questions tagged [libgpiod]

22 questions
4
votes
2 answers

How to programmatically use GPIO Expander driver in Linux?

I am trying to configure my Yocto Linux distro to setup two on-board I2C GPIO Expanders and document how to access them programmatically (i.e. from a C user application). The GPIO Expanders are both NXP PCA9557, which is supported by the…
3
votes
2 answers

Get value of a gpio output using libgpiod in Linux

I am using Linux (kernel 5.8.17) on an embedded custom board and have a script doing some gpioget and gpioset operations with the libgpiod package. Setting output pins with gpioset works great, as does getting value of input pins with gpioget. But…
sRuby
  • 33
  • 1
  • 6
3
votes
1 answer

Can't access gpio line with gpiod_line_request_output() on Adafruit FT232H

I am using an Adafruit Ft232H breakout to add GPIO ports to my Linux pc. Although I had some success to flash a led with libftdi and bitbang mode, I don't have the same luck with libgpiod because gpiod_line_request_output is failing. Some gpio…
Petross404
  • 177
  • 1
  • 12
2
votes
1 answer

gpiod - programmatically monitor asynchronously in C++

I'm looking at using the gpiod interface on an embedded Linux device with a C++ framework. The issue is that I haven't come across an example of how to asynchronously monitor inputs using gpiod. Ideally it would be something like gpiomon but not…
leo8382
  • 91
  • 8
2
votes
1 answer

Simulate gpios for libgpiod

I have an existing C++ code that reads periodically from /sys/class/gpio. Since this is depreciated, I want to change it and use libgpiod. I have got component tests that run independently from the actual hardware. It runs on my dev machine that…
kuga
  • 1,483
  • 1
  • 17
  • 38
2
votes
0 answers

Sysfs doesn't recognize any GPIO chip - Ubuntu 18.04

I am trying to set GPIOs of an embedded Mini PC with Ubuntu 18.04 as inputs or outputs for handling several sub-projects. My PC is the Supermicro SYS E100-9W-E, it provides 1x 8-bit GPIO via the DB9. The kernel version of the system is…
2
votes
2 answers

Map Raspberry hardware GPIO pins to gpiod chip line numbers

I was playing with my Raspberry Pi over the weekend. I used a tutorial from Freenove that I followed to realize a few simple circuits that are controlled by the GPIO pins on the raspberry. The Freenove tutorial is using a deprecated library named…
lanoxx
  • 12,249
  • 13
  • 87
  • 142
1
vote
1 answer

control gpio from linux userspace with linux/gpio.h

I want to write to GPIO 128. Inside linux/gpio.h there is struct gpiohandle_request which hold information about a GPIO handle request. I saw this example: Let say we want to configure pin 17 and 27 as OUTPUT and we want to write HIGH (1) on pin 17…
void_brain
  • 642
  • 2
  • 13
1
vote
0 answers

How to link self compiled libgpiod in cmake

I need to link the c++ bindings of libgpiod to my project, but I cannot figure out how to do this. I did some research the last few days but without any luck and now I'm kinda stuck. I would like to add the repo as a submodule, build the module and…
Moritz
  • 378
  • 5
  • 14
1
vote
1 answer

Embedded Linux: GPIO "Device or resource busy" despite no process, system or otherwise could be detected using it

First of all, about this system: I didn't build it, but it was tailored and customized with a lot of functions removed. The kernel version appears to be v4.x. It's running on an embedded system. When I call in my program echo 0 >…
1
vote
2 answers

Is there an ioctl equivalant in Golang that helps with controling GPIO

I am writing an Arduino-like library for the raspberryPi in golang. There are 2 main ways to interface with the GPIO linux kernel ABI one using /sys/class/gpio/* (deprecated) or /dev/gpiochip[0-9]*. I would like to use the latter because well, the…
RHL120
  • 63
  • 1
  • 7
0
votes
1 answer

Problem with 'event_wait' in python3-libgpiod

I am working with a Debian 11 (bullseye) based system on a aarch64 chip. The affected libraries are: libgpiod2 1.6.2-1 python3-libgpiod 1.6.2-1 The Problem occurs in the following example: import gpiod GPIO_CHIP = "/dev/gpiochip0" INPUT = 26 def…
cone1018
  • 13
  • 4
0
votes
0 answers

Why does `ioctl(GPIO_GET_LINEHANDLE_IOCTL)` return EINVAL

I am working on an application for an NXP iMX7ULP custom board. I am trying to open a GPIO pin from user-mode using the character mode interface. I keep getting EINVAL on the ioctl(GPIO_GET_LINEHANDLE_IOCTL). I cannot see to find the bug or…
MrJones
  • 29
  • 1
0
votes
0 answers

Why is libgpiod is corrupting my filesystem?

I have an OpenWRT system (Intel) where I have to control some GPIOS (it87). I would like to update from the classic sysfs approach (which works fine, but is being deprecated) to the new chardev, using libgpiod. However, when I use the gpiod-tools…
0
votes
1 answer

Python libgpiod vs gpiod packages in Linux?

I wrote a little test program in Python to manipulate GPIO pins on an an Intel Up Xtreme i11. First running under NixOS, I brought in the package as "libgpiod" and things are working. (MacOS package managers also know "libgpiod".) Then I tried to…
Joymaker
  • 813
  • 1
  • 9
  • 23
1
2