Skip to content

fix(aio): hold V2 enable GPIOs via systemd service (config.txt gpio= is not enough) - #6

Merged
fabiiw05 merged 1 commit into
mainfrom
fix/aio-v2-gpio-hold-service
Jul 12, 2026
Merged

fix(aio): hold V2 enable GPIOs via systemd service (config.txt gpio= is not enough)#6
fabiiw05 merged 1 commit into
mainfrom
fix/aio-v2-gpio-hold-service

Conversation

@fabiiw05

Copy link
Copy Markdown
Owner

背景 / Problem

PR #5 で入れた AIO V2 対応は config.txt の gpio=7,16,23,27=op,dh だけで電源イネーブルを賄っていましたが、実機検証で不十分と判明しました。

実機(uConsole CM4 / Arch / kernel 6.12.94-v8+)の dmesg:

usb 1-1.3: Product: AIO_V2 Ext / Manufacturer: HackerGadgets   ← 起動時は列挙
usb 1-1.3: USB disconnect, device number 4                     ← 起動 ~8.5 秒後に切断

firmware の gpio=…=op,dhカーネルの GPIO サブシステム初期化時に解除されるため、GPS/LoRa/SDR/内部USB のラインがオフに戻ります(ベンダ手順が userspace の pinctrl … op/dh を使う理由)。

修正 / Fix

  • scripts/customize.sh(v2 のみ): libgpiod を導入し、gpioset で BCM 7/16/23/27 を high 保持する uconsole-aio-gpio.service を作成・enable。libgpiod v2 の gpioset はプロセス生存中ラインを保持するため、フォアグラウンド Type=simple + Restart=always で常時保持。/etc 配下なので実機のカーネル更新後も残存します。
  • build.sh: 追記する config.txt の gpio= コメントを「早期電源のみ・永続保持はサービス側」と明確化。
  • ドキュメント(README / MAINTAINING、EN+JA): v2 の GPIO 保持サービス、更新後も残る点(config.txt オーバーレイのみリセット)、RTL-SDR には rtl-sdr/librtlsdr が必要(SDR++ の rtl_sdr_source プラグインが dlopen、rtl_test・udev uaccess も提供)を追記。

検証 / Verification

実機で本サービス+rtl-sdr 導入後:

$ rtl_test -t
Found 1 device(s):
  0:  HackerGadgets, AIO_V2 Ext, SN: 25120901
Found Rafael Micro R820T tuner
  • uconsole-aio-gpio.service = enabled/active、gpioset がラインを保持
  • SDR デバイスノードに user:fabio:rw-(udev uaccess)ACL 付与を確認
  • bash -n build.sh scripts/*.sh OK

RTC(/dev/rtc0)・LoRa(/dev/spidev1.0) も動作。実機で確認済み。

🤖 Generated with Claude Code

…is not enough)

On real hardware the AIO V2 RTL-SDR enumerates at boot then USB-disconnects
~8s in: the firmware config.txt `gpio=...=op,dh` directive is released once
the kernel GPIO subsystem initialises, powering the GPS/LoRa/SDR/internal-USB
rails back off. Re-assert and HOLD them from userspace.

- customize.sh (v2 only): install libgpiod and a uconsole-aio-gpio.service
  that runs `gpioset` holding BCM 7/16/23/27 high (libgpiod v2 keeps the lines
  while the process lives); enable it. Lives under /etc, so it survives
  on-device kernel updates.
- build.sh: clarify the appended config.txt gpio= comment (early power only;
  the service does the persistent hold).
- Docs (README/MAINTAINING, EN+JA): document the v2 GPIO-hold service, that it
  survives updates (only the config.txt overlays get reset), and that the
  RTL-SDR needs `rtl-sdr`/librtlsdr (SDR++'s rtl_sdr_source plugin dlopens it;
  also provides rtl_test + the udev uaccess rule).

Verified on the uConsole (CM4, Arch, kernel 6.12.94-v8+): after installing
rtl-sdr and enabling the service, `rtl_test -t` detects "HackerGadgets,
AIO_V2 Ext" (RTL2832U + R820T) and the device node gets a uaccess ACL.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@fabiiw05
fabiiw05 merged commit 4d894b3 into main Jul 12, 2026
2 checks passed
@fabiiw05
fabiiw05 deleted the fix/aio-v2-gpio-hold-service branch July 12, 2026 07:43
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.

1 participant