Unable to open chip: gpiochip0

Hello!

I’m trying to use python adafruit_dht on a snap installed on a ubuntu core 18 on a rpi 3 b+.

When i run the snap i get:

Unable to open chip: gpiochip0
  File "/snap/demo/x9/daemon.py", line 6, in <module>
    dht = adafruit_dht.DHT22(board.D4)
....
    raise RuntimeError(
RuntimeError: Timed out waiting for PulseIn message. Make sure libgpiod is installed.

Snap connections:

$ snap connections demo
Interface            Plug                               Slot                  Notes
gpio                 demo:gpio                 pi:bcm-gpio-4         manual
gpio-control         demo:gpio-control         :gpio-control         manual
gpio-memory-control  demo:gpio-memory-control  :gpio-memory-control  manual
hardware-observe     demo:hardware-observe     :hardware-observe     manual
i2c                  demo:i2c                  pi:i2c-0              manual
mount-observe        demo:mount-observe        -                     -
network-observe      demo:network-observe      -                     -

Yaml:

name: demo
version: '0.1'
base: core20
grade: stable
confinement: strict

apps:
  demo:
    command: bin/daemon.sh
    daemon: simple
    plugs:
      - i2c
      - gpio
      - gpio-control
      - mount-observe
      - network-observe
      - gpio-memory-control
      - hardware-observe

parts:
  main:
    source: .
    plugin: python
   ....

    stage-packages:
      - libgpiod2

Is it a interface connection problem? Where does the snap look for libgpiod? In the snap or on the ubuntu core 18 on raspberry?

do you run with sudo ? i doubt a general user has access to the device nodes by default…

:roll_eyes:

You are right. The daemon was working just fine. Tried with sudo, no errors.

1 Like