Skip to content

adafruit-pitft.py: restore fbcp mirroring for RetroPie (PiGRRL, Cupcade) - #406

Merged
makermelissa merged 2 commits into
adafruit:mainfrom
mikeysklar:fix-lite-mirror-fbcp
Aug 25, 2026
Merged

adafruit-pitft.py: restore fbcp mirroring for RetroPie (PiGRRL, Cupcade)#406
makermelissa merged 2 commits into
adafruit:mainfrom
mikeysklar:fix-lite-mirror-fbcp

Conversation

@mikeysklar

@mikeysklar mikeysklar commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

On RetroPie and other lite images --install-type mirror exits 0 but never installs fbcp, so the PiGRRL and Cupcade guides end with a black PiTFT. install_mirror() lost its call site in #348 and pitft-fbcp.py wraps that path.

This restores the fbcp install on non-desktop images that have the legacy display stack (Buster, RetroPie 4.8), leaves out the ,drm overlay param there, brings back --install-type fbcp as an alias for mirror (it was falling through to the uninstall path, and the Cupcade guide uses it), and fixes the inverted systemd branch plus a bad update_configtxt() keyword inside install_mirror(). On Bookworm and later lite images it now fails with a clear message instead of silently succeeding. The desktop/Wayland path is unchanged.

Tested with the branch cloned as in the guides:

board / OS display command result
Pi Zero 2 W, RetroPie 4.8 fresh image 2.8" resistive pitft-fbcp.py, PiGRRL 2 fbcp.service up at boot, EmulationStation on the PiTFT
Pi Zero 2 W, RetroPie 4.8 3.5" resistive --display 35r --install-type mirror fbcp.service up at boot, EmulationStation on the PiTFT
Pi 3B+, Pi OS Trixie 64-bit desktop (labwc) 2.8" resistive --display=28r --rotation=90 --install-type=mirror desktop path unchanged: overlay with drm, no fbcp, desktop on the PiTFT (SPI-1 320x240)

--install-type mirror on a lite image (RetroPie, Pi OS Lite) exited
successfully without installing anything: install_mirror() lost its only
call site in adafruit#348 and the mirror branch became desktop-only. pitft-fbcp.py
(PiGRRL Zero / Pocket PiGRRL / PiGRRL 2 / Cupcade guides) wraps that path,
so those builds got a black PiTFT with no error.

- Call install_mirror() for mirror installs on non-desktop images when the
  legacy VideoCore/DispmanX stack is present (Buster and earlier, e.g.
  RetroPie 4.8). On Bookworm+ Lite, where fbcp cannot work, bail with a
  message pointing at --install-type console instead of silently succeeding.
  The desktop/Wayland mirror path is unchanged.
- Do not append ",drm" (or the touch overlay params) for the fbcp path:
  fbcp needs the fbtft framebuffer, and pre-Bookworm overlays reject the
  parameter ("Unknown dtparam 'drm'").
- Restore "fbcp" as a CLI alias for "mirror" (it fell through to the
  uninstall branch) and add "drivers" so the CLI matches the menu.
- install_mirror(): fix the inverted systemd/sysvinit branch, fix the
  update_configtxt(rotation=) keyword (rotation_override), keep the HDMI
  rotate/unrotate dance desktop-only, comment out active vc4-kms-v3d, and
  install libraspberrypi-dev for the fbcp build.

Tested on Pi Zero 2 W + RetroPie 4.8 (Buster, 5.10.103) + PiTFT 2.8"
resistive via pitft-fbcp.py "PiGRRL 2": fbcp.service starts at boot and
EmulationStation mirrors to the panel.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mikeysklar
mikeysklar marked this pull request as ready for review August 24, 2026 02:24
@mikeysklar

Copy link
Copy Markdown
Contributor Author

@ladyada

@ladyada

ladyada commented Aug 24, 2026

Copy link
Copy Markdown
Member

@makermelissa want to take a look since this is your domain?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores rpi-fbcp-based mirroring for RetroPie/legacy (DispmanX) console images so PiGRRL/Cupcade-style installs don’t silently “succeed” while leaving the PiTFT black, while keeping the modern desktop/Wayland behavior intact.

Changes:

  • Reintroduces the install_mirror() call path for non-desktop --install-type mirror, and restores --install-type fbcp as an alias.
  • Adds legacy display stack detection and fails fast on Bookworm+ lite images with a clear error message (instead of exiting 0 without installing fbcp).
  • Fixes the systemd/sysvinit branching for fbcp startup and corrects the update_configtxt() rotation override keyword usage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread adafruit-pitft.py
Comment on lines +727 to +731
# On console images the panel's own rotate= parameter is the orientation
# and display_rotate is left to the caller (pitft-fbcp.py sets it per
# project), so only the desktop needs the HDMI rotate/unrotate dance.
if not is_desktop:
return True
Comment thread adafruit-pitft.py Outdated
Comment on lines +1035 to +1038
shell.bail("""Mirroring on a console/lite image needs the legacy VideoCore display stack
(Raspberry Pi OS Buster or earlier, e.g. RetroPie 4.8), which this OS does not have.
Use --install-type console to show the console on the PiTFT, or install the
desktop version of Raspberry Pi OS to use the PiTFT as a second display.""")

@makermelissa makermelissa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, it looks good to me. Please address the copilot suggestions.

…mat bail message

- On non-desktop mirror installs, remove any existing display_hdmi_rotate
  before the early return so a leftover value from a previous install
  cannot rotate the mirrored HDMI output unexpectedly.
- Rewrite the unsupported-OS bail message as concatenated strings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mikeysklar

mikeysklar commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Both suggestions addressed in b22539c:

  • Lite mirror path now clears any existing display_hdmi_rotate before its early return, so a leftover value cannot rotate the mirrored output. Verified on RetroPie 4.8: planted display_hdmi_rotate=2, re-ran --display 35r --install-type mirror, the line was removed and mirroring still works after a cold boot.
  • Bail message rewritten as concatenated strings. Verified the unsupported-OS path on Pi OS Trixie (lightdm temporarily hidden to simulate lite): message prints flush left, exit code 1, config.txt untouched.

left - Pi 3B + 2.8" PiTFT (Pi OS : Trixie)
right - Pi Zero 2W + 3.5" PiTFT (RetroPie 4.8)

IMG_0840

@makermelissa makermelissa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@makermelissa
makermelissa merged commit b7289b2 into adafruit:main Aug 25, 2026
1 check 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.

4 participants