Skip to content

Improve IR cut GPIO detection using /proc/maps#144

Merged
widgetii merged 1 commit intomasterfrom
fix-ircut-gpio-detection
Apr 22, 2026
Merged

Improve IR cut GPIO detection using /proc/maps#144
widgetii merged 1 commit intomasterfrom
fix-ircut-gpio-detection

Conversation

@widgetii
Copy link
Copy Markdown
Member

Summary

  • Scan /proc/*/maps for userspace processes (streamers) that have GPIO registers memory-mapped via /dev/mem
  • Report output pins only from mapped groups with ≤2 outputs (dedicated IR cut vs busy general I/O)
  • Fall back to original heuristic (output + LOW) when no /proc/maps matches found

Problem

The old heuristic reported GPIOs that are output+LOW as IR cut candidates. On a Hi3516AV200 camera this reported GPIO 11 (wrong) and missed GPIO 63 (the actual IR cut pin, which is output+HIGH in day mode).

Verified on hardware

Tested on Hi3516AV200 with vendor streamer robcat:

Method Result
Old heuristic possible-IR-cut-GPIO: 11 (wrong)
New /proc/maps possible-IR-cut-GPIO: 63 (correct, verified by physical toggle test)

Test plan

  • Cross-compiled and tested on Hi3516AV200 camera
  • GPIO 63 confirmed as actual IR cut pin by physical click test
  • Falls back to old heuristic when no streamer process found
  • Test on other SoC platforms (HiSilicon V2/V3/V4)

Fixes #143

🤖 Generated with Claude Code

The old heuristic (output + LOW) missed IR cut pins that are HIGH in
steady state. Instead, scan /proc/*/maps for userspace processes that
have GPIO registers memory-mapped via /dev/mem, then report output
pins from those groups that have at most 2 outputs (dedicated IR cut
groups vs busy general I/O groups).

Falls back to the original heuristic when no /proc/maps matches found.

Fixes #143

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit 297d25c into master Apr 22, 2026
2 checks passed
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.

IR cut GPIO detection reports wrong pin (heuristic fails on output-HIGH IR cut)

1 participant