Skip to content

Find the GPIO chip by label so kernel renumbering cannot break activation - #8

Open
cavers-travers wants to merge 4 commits into
dlubom:codex/arm64-test-packagesfrom
cavers-travers:fix/gpiochip-by-label
Open

cavers-travers wants to merge 4 commits into
dlubom:codex/arm64-test-packagesfrom
cavers-travers:fix/gpiochip-by-label

Conversation

@cavers-travers

Copy link
Copy Markdown

Problem (found on real hardware)

Tested the field package mandeye-multisensor-bookworm-arm64-b0ee7d1…-a1.deb on:
Raspberry Pi 5 8 GB, Raspberry Pi OS Bookworm 64-bit (after apt full-upgrade, 2026-12-04), 2× Livox Mid-360 via a switch on eth0, fake_pps, standard RPi 5 wiring.

sudo mandeye-activate with rpi5.json stops with:

mandeye-activate: /dev/gpiochip4: missing character device (required by mandeye)

gpiodetect on this kernel:

gpiochip11 [gpio-brcmstb@107d517c00] (15 lines)
gpiochip12 [gpio-brcmstb@107d517c20] (6 lines)
gpiochip13 [gpio-brcmstb@107d508500] (32 lines)
gpiochip14 [gpio-brcmstb@107d508520] (4 lines)
gpiochip15 [pinctrl-rp1] (54 lines)

There is no /dev/gpiochip4 (or gpiochip0) and no compatibility symlink. The Pi 5 header number has been 4, 0 and now 15 across kernels, but the label pinctrl-rp1 is stable. The number stayed at 15 across reboots on this unit.

Change

  • device.json "gpiochip" accepts a chip label as well as a device path (validator: gpioChip() in device_config.cpp).
  • Controller, LED/button demos (gpios.cpp) and FakePPS open the chip with gpiod_chip_open_lookup (libgpiod 1.6: path, name, number or label). Their errors now point to gpiodetect.
  • mandeye-activate resolves a label through GPIO_GET_CHIPINFO_IOCTL before the permission checks, prints the resolved device, and lists available chips if the label is not found.
  • Examples: pinctrl-rp1 (rpi5, cm5-direct), pinctrl-bcm2711 (rpi4, pro-cm4-bookworm).
  • Existing path-based configurations keep working. tests/package/test-device-config.py covers labels, paths and an invalid value. One README sentence added.

Testing

  • clang-format 18 clean. Python compiles.
  • Not compiled locally (written on Windows), so it relies on this repository's ARM64 package build.
  • On hardware: with "gpiochip": "/dev/gpiochip15" set manually, activation succeeds. LEDs, buzzer and buttons work, both Mid-360 record, and data is saved in both modes. Once this PR's package is built, it will be retested with the unmodified pinctrl-rp1 example.

Other field observation (not in this PR)

Booting without the USB drive: RequiresMountsFor=/media/usb makes the controller fail with Dependency failed after ~90 s, and it does not start when the drive is inserted later. There is no LED or buzzer signal, so the scanner looks dead. It might be worth starting without the drive and signalling its absence.

🤖 Generated with Claude Code

cavers-travers and others added 4 commits December 4, 2026 19:07
…tion

On a current Raspberry Pi 5 Bookworm kernel the 40-pin header is
/dev/gpiochip15 [pinctrl-rp1]; neither /dev/gpiochip4 from rpi5.json nor
/dev/gpiochip0 exists, so mandeye-activate stops with "missing character
device" (reproduced on real hardware: RPi 5, 2x Mid-360, fake_pps).

device.json "gpiochip" now accepts a chip label as well as a device path.
The controller, demos and FakePPS open it with gpiod_chip_open_lookup, and
mandeye-activate resolves the label through GPIO_GET_CHIPINFO_IOCTL before
its permission checks. The examples use pinctrl-rp1 (Pi 5, CM5) and
pinctrl-bcm2711 (Pi 4, CM4); existing path-based configurations still work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants