Skip to content
/ wiki Public

Telling a camera about its own hardware: the settings route and the device-profile route - #551

Merged
openipc-ai merged 2 commits into
masterfrom
per-device-settings-doc
Sep 19, 2026
Merged

openipc-ai merged 2 commits into
masterfrom
per-device-settings-doc

Conversation

@openipc-ai

@openipc-ai openipc-ai commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

An OpenIPC image is built for an SoC family, so it ships no knowledge of where a
particular camera's IR-cut filter is wired, which pad powers its SD card, or where it
should fetch its next firmware from.

There are two ways to tell it, and the wiki documented neither in one place:

  • On the camera itself — Settings → Pins and Settings → Day / Night, or cli over
    SSH. This is how most people actually do it, and en/finding-a-gpio.md explains how
    to find a pin without ever saying where the answer goes.
  • In a device profile — customizer.sh, muxes.sh and gpio.conf in
    OpenIPC/builder, so every unit of a model comes
    up right with nobody there. These three files were documented nowhere at all.

The gap has a visible cost. en/gpio-settings.md lists pin numbers for dozens of boards
and never says where they go, so somebody bringing up a new camera writes a fresh init
script with the pins typed into it, or drops a customizer.sh into the shared firmware
overlay — where it reaches every camera of every vendor. That came up again on
OpenIPC/firmware#2446, which did both.

What the page covers

Both routes get a section of their own, with a comparison table up front so a reader can
tell in one glance which one they want. The honest framing is that they are not
alternatives: a device profile mostly consists of the very writes the web interface
would have made, made before you ever open it.

The difference that actually matters gets its own table row and its own troubleshooting
entry, because it catches people: a factory reset clears the overlay, so settings
made on the camera do not come back and settings carried by a profile do.

On the profile side: when each file runs and why they differ (customizer.sh once
behind /etc/custom.ok; muxes.sh on every boot, because pad multiplexing is a
register that does not survive a power cycle; gpio.conf never — it is sourced), where
S30customizer sits in the boot order, what belongs in each, why they live in builder,
a worked example, and the four things that go wrong.

Accuracy

Every figure was counted from OpenIPC/builder and OpenIPC/firmware as they stand rather
than recalled: 96 devices ship a customizer.sh, 18 a gpio.conf, 15 a muxes.sh; the
fw_setenv frequencies are per-variable counts across those 96; and seven pin names
(button, ircut1, ircut2, led1, led2, light_ir, mmc_pwr) appear in all 18
gpio.conf files, with six more on 16–17.

Three things I had written were wrong and were removed rather than shipped: a
gpio_button environment variable (set by no device and read by nothing — the reset
button is button in gpio.conf); a claim that all thirteen common pin names appear on
all 18 devices; and a statement about when a kept pin choice is re-applied, which I
could not support from anything a reader can observe, so the page now describes only
Try / Keep and that a kept choice is saved.

Review

The bot review found a real contradiction: the gpio.conf snippet drove mmc_pwr low
as "power enable" while the worked example drove the same named rail high. Both were
copied from real devices, so making them agree would have been consistent and still
wrong for half the boards. The page now states that polarity is board-specific and that
gpio.conf records which pad, never which level, with both examples labelled.

Checks

$ cspell --config cspell.yaml en/per-device-settings.md en/gpio-settings.md en/finding-a-gpio.md README.md
CSpell: Files checked: 4, Issues found: 0 in 0 files.

All five cross-page links resolve, and all four in-page anchors match a heading. Added to
the table of contents and cross-linked both ways with gpio-settings.md and
finding-a-gpio.md, which are where a reader arrives holding a pin number with nothing
to do with it.

A mainline image is built for an SoC family, so it knows nothing about where
a particular camera's IR-cut filter is wired or which pad powers its SD card.
Three files supply that, and none of them were documented anywhere: a reader
could find en/gpio-settings.md listing a board's pin numbers and had no page
telling them where those numbers are supposed to go.

The consequence shows up in review. Somebody with a new camera writes a fresh
init script with the pin numbers typed into it, or drops a customizer.sh into
the shared firmware overlay where it reaches every camera of every vendor,
because nothing pointed at the seam that already exists. That is not a mistake
a contributor can be expected to avoid unaided.

The page covers what runs when -- customizer.sh once behind /etc/custom.ok,
muxes.sh on every boot because pad multiplexing does not survive a power
cycle, gpio.conf sourced rather than executed -- what belongs in each, and
why they live in OpenIPC/builder under the device's own directory rather than
in the firmware tree. It ends with a worked example and the four things that
actually go wrong, including the one that catches everyone: a factory reset
clears the overlay and with it /etc/custom.ok, so the device re-applies its
defaults from scratch on the next boot.

Figures in the page were counted from builder as it stands: 96 devices ship a
customizer.sh, 18 a gpio.conf, 15 a muxes.sh, and seven pin names appear in
every one of those gpio.conf files.

Cross-linked both ways with gpio-settings.md and finding-a-gpio.md, which are
where a reader arrives with a pin number and no idea what to do with it.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Document per-device board settings and boot lifecycle

📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Documents lifecycle, placement, and responsibilities of the three per-device settings files.
• Explains boot ordering, reset behavior, pin naming, examples, and troubleshooting.
• Cross-links GPIO guides and adds the new page to the wiki contents.
Diagram

graph TD
  A["GPIO Guides"] --> B["Settings Guide"] --> C["Builder Device"] --> D["Rootfs Overlay"] --> E["S30 Customizer"]
  E -->|"first boot"| F["customizer.sh"]
  E -->|"every boot"| G["muxes.sh"]
  H["gpio.conf"] -->|"sourced by"| G
Loading
High-Level Assessment

A dedicated guide cross-linked from both GPIO discovery pages is the best approach. Folding this material into the pin catalog would mix board data with lifecycle and deployment guidance, while duplicating explanations across existing pages would make future corrections inconsistent.

Files changed (4) +302 / -0

Documentation (4) +302 / -0
README.mdAdd per-device settings guide to the wiki contents +1/-0

Add per-device settings guide to the wiki contents

• Adds the new guide beside the existing GPIO discovery and board settings pages so readers can find the full workflow from the main index.

README.md

finding-a-gpio.mdDirect discovered GPIO pins to per-device configuration +6/-0

Direct discovered GPIO pins to per-device configuration

• Adds follow-up guidance explaining that identified pins belong in the board's gpio.conf and links to the new settings guide.

en/finding-a-gpio.md

gpio-settings.mdConnect board GPIO listings to their configuration destination +6/-0

Connect board GPIO listings to their configuration destination

• Explains that known board pin numbers should be recorded once in per-device configuration rather than repeated in scripts, with a link to the new guide.

en/gpio-settings.md

per-device-settings.mdDocument board-specific settings files and their runtime lifecycle +289/-0

Document board-specific settings files and their runtime lifecycle

• Introduces a comprehensive guide to customizer.sh, muxes.sh, and gpio.conf, including boot timing, persistence, builder placement, naming conventions, and factory-reset behavior. It also provides configuration examples, usage guidance, and troubleshooting steps.

en/per-device-settings.md

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. SD-card instructions can disable power ✓ Resolved 🐞 Bug ≡ Correctness
Description
The gpio.conf usage snippet labels gpio clear $mmc_pwr as power enable even though the page
defines clear as driving low and twice uses gpio set to enable the demonstrated SD-card power
pin. An integrator following this snippet for pin 38 can drive the rail opposite to the worked
example and leave the SD card unavailable.
Code

en/per-device-settings.md[R177-178]

+# sd card power enable
+gpio clear $mmc_pwr
Evidence
The page defines set as high and clear as low, then shows pin 38 enabled with set both before
and after the conflicting snippet. The board table also associates the same demonstrated GPIO
mapping with SD pin 38, so the unexplained polarity reversal is directly actionable and ambiguous.

en/per-device-settings.md[127-132]
en/per-device-settings.md[171-179]
en/per-device-settings.md[247-253]
en/gpio-settings.md[188-192]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The GPIO usage snippet drives the documented SD-card power pin low, while the surrounding and worked examples drive the same pin high to enable the rail.
## Fix Focus Areas
- en/per-device-settings.md[127-132]
- en/per-device-settings.md[171-179]
- en/per-device-settings.md[247-253]
## Recommended Fix
Change the usage snippet to `gpio set $mmc_pwr` so it agrees with the worked example, or explicitly identify it as a separate active-low example and explain that power-enable polarity is board-specific.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread en/per-device-settings.md Outdated
…rity

The page presented device profiles as the way to tell a camera about its
hardware, with the web interface mentioned only in passing. That is
backwards for most readers: somebody with one camera in front of them
sets the IR-cut pins on Settings -> Day / Night and declares a pad on
Settings -> Pins, and never writes a file at all. The three profile files
are for the person who wants the hundredth unit of a model to come up
right with nobody there.

Both now get a section of their own, with a table up front so a reader
can tell in one glance which one they want. The honest framing is that
they are not alternatives: a profile mostly consists of the very writes
the interface would have made. The one real difference is worth its own
row and its own troubleshooting entry, because it catches people -- a
factory reset clears the overlay, so settings made on the camera do not
come back and settings carried by a profile do.

Retitled accordingly, since "customizer.sh, muxes.sh and gpio.conf" no
longer describes half of what the page covers, and relinked from the
table of contents and the two GPIO pages.

The bot review caught a real contradiction: the gpio.conf snippet drove
mmc_pwr low as "power enable" while the worked example drove the same
named rail high. Both were copied from real devices, so the fix is not to
pick one -- polarity is board-specific and gpio.conf records which pad,
never which level. Said so, with both examples now labelled which way
their board goes.

Also removed a duplicated warning about cli -s silently accepting a
mistyped path; it belongs with the settings route, and the profile
section now points back at it with the reason it is worse there -- nobody
is at the interface to notice the switch did nothing.
@openipc-ai openipc-ai changed the title Per-device settings: the three files that teach an image its board Telling a camera about its own hardware: the settings route and the device-profile route Sep 19, 2026
@openipc-ai
openipc-ai merged commit 2aa5093 into master Sep 19, 2026
@openipc-ai
openipc-ai deleted the per-device-settings-doc branch September 19, 2026 07:20
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