Skip to content

R36 Control Centre

southoz edited this page Mar 10, 2026 · 23 revisions

R36 LED & Config Service for dArkOS RE

Customisable Battery Warning LEDs + Hardware Detection for R36S / Clones / Soy Sauce

This service solves the biggest pain point for RK3326 R36S-style handhelds on dArkOS RE:

Different mainboards use different GPIO pins for status LEDs (or PMIC control), and many DTBs define these GPIOs → causing conflicts or no LED control in userspace.

The solution:

  • Remove LED / battery / charger GPIO definitions from DTB nodes (or override them) so userspace owns the LEDs.
  • Early-boot script (r36_config.sh) detects hardware via /proc/cpuinfo.
  • Selects the correct battery warning Python script from /usr/local/bin/r36_config/batt_life_warning/.
  • Persists settings in /etc/r36_config.ini.
  • Provides a friendly R36 Control menu (under Options) to change LED behaviour, gamma, audio path, boot volume, etc.

Goal: Support R36 variants — genuine R36S (PMIC LEDs), Soy Sauce (Y3506), clones (G80C / G80CA / etc.) — without breaking DTB compatibility for screen / other hardware.

Features (v1.0)

  • Automatic hardware detection & LED script selection on first boot/hardware change
  • Safe override: LED control moved to Python scripts (no DTB GPIO conflict)
  • Gamma correction persistence (Soy Sauce often oversaturated, clones under-saturated)
  • ALSA Playback Path (SPK_HP vs SPK) + optional persistent boot volume
  • User-friendly R36 Control menu:
    • Choose LED warning style (Blue/Purple/Red, Off variants, etc.)
    • Adjust gamma (0.4–1.8, live preview hint)
    • Toggle audio routing & set/clear boot volume
    • View/delete config (reset to defaults on reboot)
  • Logging to /boot/darkosre_device.log
  • Updated DTBs included (UHS removed from Soy Sauce for max compatibility)

How It Works

  1. Early boot (r36-config.servicer36_config.sh):

    • Reads Hardware string from /proc/cpuinfo
    • Looks up variant in /boot/dtb/r36_devices.ini
    • If no /etc/r36_config.ini or hardware changed → creates config + selects matching LED script
    • Applies gamma, ALSA path, default 80% volume (only on first boot/change)
    • Symlinks correct batt_life_warning.py
  2. Battery warning (batt_led.service):

    • Runs the selected Python script
    • Monitors battery → controls LEDs via sysfs (/sys/class/leds/ or exported GPIOs)
    • Different scripts for each variant (colour/thresholds)
  3. User changes via R36 Control menu:

    • Overrides script, gamma, audio path/volume
    • Persisted in config.ini

Installation

(Assumes you're on dArkOS RE from southoz repos)

  1. Update your image or copy files manually:

    • /usr/local/bin/r36_config.sh
    • /usr/local/bin/r36_config/batt_life_warning/ (all .py scripts)
    • /etc/r36_config.ini (created automatically)
    • /boot/dtb/r36_devices.ini
    • Systemd service: /etc/systemd/system/r36-config.service
    • Menu integration for "R36 Control" under Options
  2. DTB preparation (critical for clones/Soy Sauce):

    • Use the updated DTBs included (or from your repo)
    • Ensure LED/charger/battery GPIO nodes are removed or disabled in the DTB → otherwise DTB fights userspace → LEDs may not work or conflict
  3. Reboot → service runs → config created → LEDs should work.

Using R36 Control Centre

Launch from EmulationStation → OptionsR36 Control

Main options:

  • Select Battery LED Warning Type
    Pick script matching your variant (filtered for known devices; full list for unknown)

  • Adjust Gamma Correction
    0.4–1.8 range. Changes apply on reboot.
    Tip: Hold R3 + D-Pad Left/Right for live preview (if gamma tool supports it)

  • Audio Controls

    • Playback Path: SPK_HP (jack detection) or SPK (speaker only)
    • Boot Volume: Set fixed % or Clear to regain manual control
  • Utilities

    • View current config
    • Delete config (resets to defaults on reboot)

Available LED Scripts when the system is on

File Fully Charged 🔌 🔋 🔋 🔋
Clone_Blue_30_Purple_10_Red.py TBA 🔴 >30% 🔵 >10% Purple <=10% 🔴
Clone_Off_30_Purple_10_Red.py TBA 🔴 >30% Off >10% Purple <=10% 🔴
Clone_Off_10_Red.py TBA 🔴 >10% Off <=10% 🔴
Clone_PMIC_Controlled.py TBA 🔴
SoySauce_Blue_30_Pink_10_Red.py TBA 🔴 >30% 🔵 >10% Pink <=10% 🔴
SoySauce_Off_30_Pink_10_Red .py TBA 🔴 >30% Off >10% Pink <=10% 🔴
SoySauce_Off_10_Red.py TBA 🔴 >10% Off <=10% 🔴
SoySauce_PMIC_Controlled.py TBA 🔴
R36S_Green_30_Red.py TBA Orange >30% 🟢🔵 <=30% 🔴
R36S_Green_20_Red.py TBA Orange >20% 🟢🔵 <=20% 🔴
R36S_Green_10_Red.py TBA Orange >10% 🟢🔵 <=10% 🔴
R36S_PMIC_Controlled.py TBA 🔴

Important Notes & Warnings

  • Genuine R36S often use PMIC-controlled LEDs (Green/Orange) → limited userspace control. Scripts focus on Red warning.
  • Soy Sauce DTBs have UHS removed from SD card → better compatibility (no speed loss — see linked test).
  • Audio init issues on some V12 clones → may need sleep/wake cycle (handled in some ogage binaries).
  • If LEDs don't work → check DTB has no conflicting GPIO definitions.
  • Unknown hardware → defaults to clone-like behavior + full script list.
  • Logs: /boot/darkosre_device.log

Contributing / Testing

Untested boards welcome!
Report:

  • Motherboard string (cat /proc/cpuinfo | grep Hardware)
  • Which LED script works best
  • Any GPIO / DTB conflicts

Pull requests for new scripts, DTB tweaks, or ini entries are appreciated.

Thanks to testers: 66dude, darrynmelck, Ace007186 (Discord), and the broader R36S community.

Home

Guides

Help

Arcade Systems

Console Systems

Handheld Systems

Ports and Recompilations

Advanced

In development

The guides below are for ArkOS-G80CA; once they are above this marker, they are relevant.

Clone this wiki locally