Skip to content

Update EasePi A2/R2 board configs and device trees for improved hardware support#9907

Draft
ifroncy01 wants to merge 10 commits into
armbian:mainfrom
ifroncy01:main
Draft

Update EasePi A2/R2 board configs and device trees for improved hardware support#9907
ifroncy01 wants to merge 10 commits into
armbian:mainfrom
ifroncy01:main

Conversation

@ifroncy01
Copy link
Copy Markdown
Contributor

@ifroncy01 ifroncy01 commented May 28, 2026

Summary

This PR initializes and matures EasePi-A2 and EasePi-R2 support across board
configs, kernel DTS, boot configuration, peripherals, and BSP packaging.

It includes:

  • Initial EasePi-A2/R2 board configs and mainline-compatible DTS fixes
  • U-Boot and boot tuning refinements for better boot stability
  • Extraction of board-specific files into a unified packages/bsp/easepi/
    layout
  • A robust network rename solution for EasePi-R2 to avoid interface naming
    conflicts
  • Enhanced IR, OLED, Bluetooth, and modem support for both boards

Changes

1. Initialize EasePi-A2 and EasePi-R2 board support

  • Add initial board configs for EasePi-A2 (RK3568) and EasePi-R2 (RK3588)
  • Rename board configs from .csc to .conf
  • Set BOARD_MAINTAINER="ifroncy01"
  • Update board metadata and vendor strings for LinkEase
  • Remove vendor kernel DTS patches and use mainline-friendly DTS fixes
  • Correct DTS model/compatible strings and pinctrl/IR/OLED layout

2. Refine boot and package configuration

  • Update EasePi-R2 U-Boot defconfig for Android/AVB support
  • Remove legacy boot script options and set bootdelay=2
  • Cache A2 OLED daemon binary with SHA-256 verification
  • Add WiFi firmware symlinks and Bluetooth firmware support for A2

3. Improve peripheral support

  • Add OLED 128x32 display service for A2 with I2C detection
  • Add dynamic IR receiver setup for A2
  • Add LIRC-based IR service for R2 with lirc_dev and lirc_i2c
  • Add 4G modem udev rule and Bluetooth hciattach support for both boards

4. Refactor BSP packaging and board files

  • Extract embedded board content into packages/bsp/easepi/
  • Introduce A2/R2-specific BSP files for IR, OLED, Bluetooth, and network handling
  • Add common IR diagnostic and helper scripts
  • Reduce duplicated inline board config content in config/boards/*.conf

5. Add robust network rename solution for EasePi-R2

  • Replace fragile static udev rules with easepi-net-rename.service and
    easepi-net-rename.sh
  • Use a three-way rename algorithm to avoid kernel naming conflicts
  • Preserve interface naming using DT eth_order, sysfs, and /etc/eth_order
    fallback

Affected files

config/boards/easepi-a2.conf
config/boards/easepi-r2.conf
config/defconfig/easepi-r2-rk3588_defconfig
packages/bsp/easepi/easepi-a2/*
packages/bsp/easepi/easepi-r2/*
packages/bsp/easepi/easepi-fix-infrared.sh
packages/bsp/easepi/easepi_remote
patch/kernel/archive/rockchip64-6.18/dt/rk3568-easepi-a2.dts
patch/kernel/archive/rockchip64-6.18/dt/rk3588-easepi-r2.dts
patch/kernel/archive/rockchip64-7.0/dt/rk3568-easepi-a2.dts
patch/kernel/archive/rockchip64-7.0/dt/rk3588-easepi-r2.dts
patch/kernel/archive/rockchip64-7.1/dt/rk3568-easepi-a2.dts
patch/kernel/archive/rockchip64-7.1/dt/rk3588-easepi-r2.dts

Testing

  • EasePi-A2 (RK3568): built successfully on 6.18, 7.0, 7.1, vendor 6.1 kernels
  • EasePi-R2 (RK3588): built successfully on 6.18, 7.0, 7.1, vendor 6.1 kernels
  • Verified DTS fixes, network rename stability, and BSP refactor correctness

Notes

This PR is focused on stabilizing EasePi board support, improving board
packaging, and replacing embedded config blocks with a maintainable BSP
structure.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added infrared (IR) remote receiver support with keymap configuration.
    • Added OLED display initialization and monitoring service.
    • Added network interface naming for multi-Ethernet configurations.
    • Improved Bluetooth HCI initialization and configuration.
  • Chores

    • Updated device tree compatibility identifiers for EasePi boards.
    • Refactored peripheral initialization scripts and systemd services.
    • Updated U-Boot bootloader configuration for EasePi R2.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 451395ef-e136-4256-a58a-668bf782ee36

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Board configs for EasePi A2/R2 were refactored (vendor/maintainer updated). New BSP packages and systemd helpers for Bluetooth, IR, OLED, and network renaming were added. Device-tree edits prepend LinkEase compatible strings and reorganize A2 pinctrl/OTP/IR/NPU overrides. U-Boot defconfig for RK3588 EasePi-R2 updated.

Changes

EasePi BSP, board configs, and device-tree updates

Layer / File(s) Summary
EasePi A2 board config refactor
config/boards/easepi-a2.conf
Board vendor/maintainer updated; peripherals extension simplified; BSP-install tweak functions added; pre/post customize flows refactored and OLED binary download/installation implemented.
EasePi R2 board config refactor
config/boards/easepi-r2.conf
Board vendor/maintainer updated; peripherals extension simplified; BSP-install tweaks added for Bluetooth, network rename, and common peripherals; inline generation replaced by BSP assets.
BSP package files — EasePi A2
packages/bsp/easepi/easepi-a2/*
Add bluetooth-hciattach.service + script, i2c-dev.conf, infrared.conf, ir-keymap.service, ir-setup.sh, oled.service, oled_init.sh, and easepi-fix-infrared.sh.
BSP package files — EasePi R2
packages/bsp/easepi/easepi-r2/*
Add udev rule, bluetooth-hciattach.service + script, easepi-net-rename.service + script, eth_order, infrared.conf, ir-keymap.service, and easepi_remote keymap.
A2 device-tree: pinctrl, IR, OTP and IP overrides
patch/kernel/archive/*/dt/rk3568-easepi-a2.dts, patch/kernel/rk35xx-vendor-6.1/dt/rk3568-easepi-a2.dts
Prepend linkease,easepi-a2 to root compatible; add gpio-ir-receiver node and ir_receiver_pin; relocate/add pinctrl groups (nvme/oled/bluetooth); remove inline VPU/NPU/crypto blocks and NPU override/status; consolidate OTP nvmem (7.1); disable &pwm3 for GPIO IR.
R2 device-tree: compatible string prepends
patch/kernel/archive/*/dt/rk3588-easepi-r2.dts
Prepend linkease,easepi-r2 to root compatible lists across archive versions and vendor tree.
U-Boot defconfig — EasePi-R2 RK3588
patch/u-boot/legacy/u-boot-radxa-rk35xx/defconfig/easepi-r2-rk3588_defconfig
Enable Android/AVB/SPL options, adjust command set, add MTD/SPI/PCIe/NVMe and DRM/display options, and update image/security flags.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • armbian/build#9880: Similar device-tree compatible-string and EasePi A2/R2 peripheral wiring changes.

Suggested reviewers

  • igorpecovnik
  • joekhoobyar
  • iav
  • rpardini
  • paolosabatino
  • prahal
  • JohnTheCoolingFan
  • SuperKali
  • TheSnowfield
  • amazingfate
  • catalinii
  • krachlatte
  • lanefu
  • pyavitz
  • chainsx

"🐰 I hopped through device trees and scripts so spry,
Moved pins, added services, and made compat strings fly.
OTP cells tidy, IR now by GPIO,
BSP packages in place, all neat and ready-to-go!
A tiny carrot for reviewers — thanks, bye!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main change: updating EasePi A2/R2 board configurations and device trees for improved hardware support, which aligns with the comprehensive refactoring across board configs, device trees, and BSP packages described in the PR objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added size/large PR with 250 lines or more 05 Milestone: Second quarter release Needs review Seeking for review labels May 28, 2026
@ifroncy01 ifroncy01 requested a review from jjm2473 May 29, 2026 15:42
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
patch/kernel/archive/rockchip64-7.0/dt/rk3568-easepi-a2.dts (1)

802-807: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing &sdio_pwrseq WL_REG_ON reset-gpios override in kernel 7.0 WiFi power sequencing

In patch/kernel/archive/rockchip64-7.0/dt/rk3568-easepi-a2.dts, sdio_pwrseq: sdio-pwrseq only sets pinctrl-0 = <&wifi_enable_h> and &sdmmc2 references it via mmc-pwrseq = <&sdio_pwrseq>;, but there is no &sdio_pwrseq override providing reset-gpios (and post-power-on-delay-ms) like the 6.18 and 7.1 variants. Without reset-gpios, mmc-pwrseq-simple can’t reliably drive WL_REG_ON for the WiFi module.

🐛 Proposed fix: add WL_REG_ON override to match 6.18/7.1
 &gmac1 {
 	status = "disabled";
 };
 
+// Configure WL_REG_ON pin
+&sdio_pwrseq {
+	status = "okay";
+	reset-gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_LOW>;
+	post-power-on-delay-ms = <200>;
+};
+
 // bluetooth - mainline kernel serdev on uart8 (GPIO2 pins = hardware connection)
 &uart8 {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@patch/kernel/archive/rockchip64-7.0/dt/rk3568-easepi-a2.dts` around lines 802
- 807, The sdio pwrseq node lacks the WL_REG_ON reset-gpios (and
post-power-on-delay-ms) override so mmc-pwrseq-simple cannot toggle WiFi power;
update the existing sdio_pwrseq/sdio-pwrseq node referenced by &sdmmc2
(mmc-pwrseq = <&sdio_pwrseq>) to add a reset-gpios property that targets the
WL_REG_ON GPIO and include the same post-power-on-delay-ms value used in the
6.18/7.1 variants so the WiFi module is reliably driven on during power
sequencing.
🧹 Nitpick comments (1)
packages/bsp/easepi/easepi-r2/easepi-net-rename.service (1)

1-12: 💤 Low value

Wants=network-pre.target is likely unnecessary.

The Before=network-pre.target correctly ensures this service runs before networking starts. However, Wants=network-pre.target causes this service to try to pull in network-pre.target, which is typically unnecessary since network-pre.target is already wanted by network.target. The WantedBy=sysinit.target is sufficient to ensure this runs early in boot.

Consider removing the Wants= line for clarity:

Suggested simplification
 [Unit]
 Description=EasePi-R2 Network Interface Rename
 Before=network-pre.target
-Wants=network-pre.target

 [Service]
 Type=oneshot
 ExecStart=/usr/local/sbin/easepi-net-rename.sh
 RemainAfterExit=yes

 [Install]
 WantedBy=sysinit.target
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bsp/easepi/easepi-r2/easepi-net-rename.service` around lines 1 - 12,
Remove the unnecessary Wants=network-pre.target unit dependency: keep
Before=network-pre.target to ensure ordering and leave WantedBy=sysinit.target
to ensure early boot activation, but delete the Wants=network-pre.target line so
the service does not attempt to pull in network-pre.target.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bsp/easepi/easepi-a2/bluetooth-hciattach.service`:
- Around line 1-10: The unit currently lacks ordering relative to BlueZ: update
the bluetooth-hciattach.service [Unit] section to ensure it is ordered before
BlueZ by adding a Before=bluetooth.service directive (and optionally
Wants=bluetooth.service if you want systemd to pull in BlueZ); modify the
bluetooth-hciattach.service unit (the same file containing Description,
After=network.target and ExecStart=/usr/local/sbin/bluetooth-hciattach.sh) to
include Before=bluetooth.service so systemd starts this unit prior to
bluetooth.service.

In `@packages/bsp/easepi/easepi-a2/ir-keymap.service`:
- Around line 1-10: The unit starts ir-setup.sh too early and can succeed before
RC devices exist; update the service to wait for RC device enumeration by adding
an ExecStartPre that polls for /sys/class/rc or /dev/lirc* (e.g.
ExecStartPre=/bin/sh -c 'for i in $(seq 1 30); do [ -e /sys/class/rc ] && [
"$(ls -A /sys/class/rc)" ] && exit 0 || sleep 1; done; exit 1') so ExecStart
(/usr/local/ir/ir-setup.sh) only runs after RC entries appear; keep Type=oneshot
and the existing ExecStart, and ensure the timeout/loop length suits boot
timing.

In `@packages/bsp/easepi/easepi-a2/ir-setup.sh`:
- Around line 1-16: The script currently treats failures from the two
/usr/bin/ir-keytable calls as non-fatal and always exits 0; update ir-setup.sh
to propagate errors by enabling strict failure handling (e.g., add "set -euo
pipefail" at the top) or explicitly check the exit status of the two commands
(the /usr/bin/ir-keytable -c -w /etc/rc_keymaps/easepi_remote and
/usr/bin/ir-keytable -p nec calls) inside the for loop and exit with a non-zero
status if either fails, ensuring the loop returns success only when both
commands succeed for a detected device.

In `@packages/bsp/easepi/easepi-a2/oled.service`:
- Around line 1-14: The unit currently uses ConditionPathExists=/dev/i2c-3 which
makes systemd skip the unit if the device is absent at activation; change the
unit to actually pull in the device so it starts when the I2C bus appears by
replacing ConditionPathExists with a dependency on the device unit: add
Wants=dev-i2c-3.device and After=dev-i2c-3.device (and optionally
BindsTo=dev-i2c-3.device if you want the service to stop when the device
disappears), leaving ExecStart=/usr/local/oled/oled --silent and Restart
settings intact so the service will be started automatically when /dev/i2c-3
appears.

In `@packages/bsp/easepi/easepi-r2/easepi-net-rename.sh`:
- Around line 19-33: In rename_only, quote all variable expansions passed to
rename_iface and fix the arithmetic expansion: replace calls like rename_iface
$toiface rename_tmp, rename_iface $iface $toiface, and rename_iface rename_tmp
$iface with quoted versions using "$toiface", "rename_tmp", and "$iface", and
change index=$(( $index + 1 )) to index=$((index + 1)); keep the function name
rename_only and the helper rename_iface unchanged so callers still match.

---

Outside diff comments:
In `@patch/kernel/archive/rockchip64-7.0/dt/rk3568-easepi-a2.dts`:
- Around line 802-807: The sdio pwrseq node lacks the WL_REG_ON reset-gpios (and
post-power-on-delay-ms) override so mmc-pwrseq-simple cannot toggle WiFi power;
update the existing sdio_pwrseq/sdio-pwrseq node referenced by &sdmmc2
(mmc-pwrseq = <&sdio_pwrseq>) to add a reset-gpios property that targets the
WL_REG_ON GPIO and include the same post-power-on-delay-ms value used in the
6.18/7.1 variants so the WiFi module is reliably driven on during power
sequencing.

---

Nitpick comments:
In `@packages/bsp/easepi/easepi-r2/easepi-net-rename.service`:
- Around line 1-12: Remove the unnecessary Wants=network-pre.target unit
dependency: keep Before=network-pre.target to ensure ordering and leave
WantedBy=sysinit.target to ensure early boot activation, but delete the
Wants=network-pre.target line so the service does not attempt to pull in
network-pre.target.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5149c83c-b508-491e-840c-d13abfd04818

📥 Commits

Reviewing files that changed from the base of the PR and between 4674258 and cf8012b.

📒 Files selected for processing (29)
  • config/boards/easepi-a2.conf
  • config/boards/easepi-r2.conf
  • packages/bsp/easepi/easepi-a2/bluetooth-hciattach.service
  • packages/bsp/easepi/easepi-a2/bluetooth-hciattach.sh
  • packages/bsp/easepi/easepi-a2/i2c-dev.conf
  • packages/bsp/easepi/easepi-a2/infrared.conf
  • packages/bsp/easepi/easepi-a2/ir-keymap.service
  • packages/bsp/easepi/easepi-a2/ir-setup.sh
  • packages/bsp/easepi/easepi-a2/oled.service
  • packages/bsp/easepi/easepi-a2/oled_init.sh
  • packages/bsp/easepi/easepi-fix-infrared.sh
  • packages/bsp/easepi/easepi-r2/71-rndis-net.rules
  • packages/bsp/easepi/easepi-r2/bluetooth-hciattach.service
  • packages/bsp/easepi/easepi-r2/bluetooth-hciattach.sh
  • packages/bsp/easepi/easepi-r2/easepi-net-rename.service
  • packages/bsp/easepi/easepi-r2/easepi-net-rename.sh
  • packages/bsp/easepi/easepi-r2/eth_order
  • packages/bsp/easepi/easepi-r2/infrared.conf
  • packages/bsp/easepi/easepi-r2/ir-keymap.service
  • packages/bsp/easepi/easepi_remote
  • patch/kernel/archive/rockchip64-6.18/dt/rk3568-easepi-a2.dts
  • patch/kernel/archive/rockchip64-6.18/dt/rk3588-easepi-r2.dts
  • patch/kernel/archive/rockchip64-7.0/dt/rk3568-easepi-a2.dts
  • patch/kernel/archive/rockchip64-7.0/dt/rk3588-easepi-r2.dts
  • patch/kernel/archive/rockchip64-7.1/dt/rk3568-easepi-a2.dts
  • patch/kernel/archive/rockchip64-7.1/dt/rk3588-easepi-r2.dts
  • patch/kernel/rk35xx-vendor-6.1/dt/rk3568-easepi-a2.dts
  • patch/kernel/rk35xx-vendor-6.1/dt/rk3588-easepi-r2.dts
  • patch/u-boot/legacy/u-boot-radxa-rk35xx/defconfig/easepi-r2-rk3588_defconfig
💤 Files with no reviewable changes (2)
  • patch/kernel/rk35xx-vendor-6.1/dt/rk3568-easepi-a2.dts
  • patch/kernel/rk35xx-vendor-6.1/dt/rk3588-easepi-r2.dts
✅ Files skipped from review due to trivial changes (4)
  • packages/bsp/easepi/easepi-r2/71-rndis-net.rules
  • packages/bsp/easepi/easepi-r2/bluetooth-hciattach.sh
  • packages/bsp/easepi/easepi-r2/eth_order
  • packages/bsp/easepi/easepi-r2/bluetooth-hciattach.service
🚧 Files skipped from review as they are similar to previous changes (2)
  • patch/kernel/archive/rockchip64-7.0/dt/rk3588-easepi-r2.dts
  • patch/kernel/archive/rockchip64-6.18/dt/rk3588-easepi-r2.dts

Comment on lines +1 to +10
[Unit]
Description=EasePi-A2 Bluetooth HCIAttach fix
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
ExecStart=/usr/local/sbin/bluetooth-hciattach.sh

[Install]
WantedBy=multi-user.target No newline at end of file
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Order bluetooth-hciattach.service before bluetooth.service.

Vendor images enable both units independently, so systemd can start BlueZ before this script has created hci0. That leaves Bluetooth up without an adapter until something restarts bluetooth.service.

Suggested fix
 [Unit]
 Description=EasePi-A2 Bluetooth HCIAttach fix
-After=network.target
+Before=bluetooth.service
 StartLimitIntervalSec=0
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[Unit]
Description=EasePi-A2 Bluetooth HCIAttach fix
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
ExecStart=/usr/local/sbin/bluetooth-hciattach.sh
[Install]
WantedBy=multi-user.target
[Unit]
Description=EasePi-A2 Bluetooth HCIAttach fix
Before=bluetooth.service
StartLimitIntervalSec=0
[Service]
Type=simple
ExecStart=/usr/local/sbin/bluetooth-hciattach.sh
[Install]
WantedBy=multi-user.target
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bsp/easepi/easepi-a2/bluetooth-hciattach.service` around lines 1 -
10, The unit currently lacks ordering relative to BlueZ: update the
bluetooth-hciattach.service [Unit] section to ensure it is ordered before BlueZ
by adding a Before=bluetooth.service directive (and optionally
Wants=bluetooth.service if you want systemd to pull in BlueZ); modify the
bluetooth-hciattach.service unit (the same file containing Description,
After=network.target and ExecStart=/usr/local/sbin/bluetooth-hciattach.sh) to
include Before=bluetooth.service so systemd starts this unit prior to
bluetooth.service.

Comment thread packages/bsp/easepi/easepi-a2/ir-keymap.service Outdated
Comment on lines +1 to +16
#!/bin/bash
# EasePi A2 IR device setup script

echo "Detecting IR devices..."

for dev in /dev/lirc* /sys/class/rc/*; do
if [ -e "$dev" ]; then
echo "Found IR device: $dev"
/usr/bin/ir-keytable -c -w /etc/rc_keymaps/easepi_remote
/usr/bin/ir-keytable -p nec
exit 0
fi
done

echo "No IR device found (check device tree configuration)"
exit 0 No newline at end of file
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Propagate ir-keytable failures instead of reporting success.

If either ir-keytable call fails, this script still reaches exit 0, so ir-keymap.service looks healthy while the remote stays unconfigured. Add strict error handling here.

Suggested fix
 #!/bin/bash
+set -e
 # EasePi A2 IR device setup script

Based on learnings, in Armbian shell scripts failures should stop execution unless explicitly handled.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#!/bin/bash
# EasePi A2 IR device setup script
echo "Detecting IR devices..."
for dev in /dev/lirc* /sys/class/rc/*; do
if [ -e "$dev" ]; then
echo "Found IR device: $dev"
/usr/bin/ir-keytable -c -w /etc/rc_keymaps/easepi_remote
/usr/bin/ir-keytable -p nec
exit 0
fi
done
echo "No IR device found (check device tree configuration)"
exit 0
#!/bin/bash
set -e
# EasePi A2 IR device setup script
echo "Detecting IR devices..."
for dev in /dev/lirc* /sys/class/rc/*; do
if [ -e "$dev" ]; then
echo "Found IR device: $dev"
/usr/bin/ir-keytable -c -w /etc/rc_keymaps/easepi_remote
/usr/bin/ir-keytable -p nec
exit 0
fi
done
echo "No IR device found (check device tree configuration)"
exit 0
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bsp/easepi/easepi-a2/ir-setup.sh` around lines 1 - 16, The script
currently treats failures from the two /usr/bin/ir-keytable calls as non-fatal
and always exits 0; update ir-setup.sh to propagate errors by enabling strict
failure handling (e.g., add "set -euo pipefail" at the top) or explicitly check
the exit status of the two commands (the /usr/bin/ir-keytable -c -w
/etc/rc_keymaps/easepi_remote and /usr/bin/ir-keytable -p nec calls) inside the
for loop and exit with a non-zero status if either fails, ensuring the loop
returns success only when both commands succeed for a detected device.

Comment thread packages/bsp/easepi/easepi-a2/oled.service
Comment on lines +19 to +33
rename_only() {
local index=0
local iface toiface
while [[ -n "$1" ]]; do
toiface="eth$index"
iface=$1
if [[ -n "$iface" && "$iface" != "$toiface" ]]; then
rename_iface $toiface rename_tmp 2>/dev/null
rename_iface $iface $toiface
rename_iface rename_tmp $iface 2>/dev/null
fi
index=$(( $index + 1 ))
shift
done
}
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Missing quotes around variable expansions in rename_only.

The function calls pass unquoted variables which could cause issues if interface names ever contain spaces or special characters. While unlikely for network interface names, proper quoting is a shell best practice.

Suggested fix with proper quoting
 rename_only() {
 	local index=0
 	local iface toiface
 	while [[ -n "$1" ]]; do
 		toiface="eth$index"
 		iface=$1
 		if [[ -n "$iface" && "$iface" != "$toiface" ]]; then
-			rename_iface $toiface rename_tmp 2>/dev/null
-			rename_iface $iface $toiface
-			rename_iface rename_tmp $iface 2>/dev/null
+			rename_iface "$toiface" rename_tmp 2>/dev/null
+			rename_iface "$iface" "$toiface"
+			rename_iface rename_tmp "$iface" 2>/dev/null
 		fi
-		index=$(( $index + 1 ))
+		index=$(( index + 1 ))
 		shift
 	done
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
rename_only() {
local index=0
local iface toiface
while [[ -n "$1" ]]; do
toiface="eth$index"
iface=$1
if [[ -n "$iface" && "$iface" != "$toiface" ]]; then
rename_iface $toiface rename_tmp 2>/dev/null
rename_iface $iface $toiface
rename_iface rename_tmp $iface 2>/dev/null
fi
index=$(( $index + 1 ))
shift
done
}
rename_only() {
local index=0
local iface toiface
while [[ -n "$1" ]]; do
toiface="eth$index"
iface=$1
if [[ -n "$iface" && "$iface" != "$toiface" ]]; then
rename_iface "$toiface" rename_tmp 2>/dev/null
rename_iface "$iface" "$toiface"
rename_iface rename_tmp "$iface" 2>/dev/null
fi
index=$(( index + 1 ))
shift
done
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bsp/easepi/easepi-r2/easepi-net-rename.sh` around lines 19 - 33, In
rename_only, quote all variable expansions passed to rename_iface and fix the
arithmetic expansion: replace calls like rename_iface $toiface rename_tmp,
rename_iface $iface $toiface, and rename_iface rename_tmp $iface with quoted
versions using "$toiface", "rename_tmp", and "$iface", and change index=$((
$index + 1 )) to index=$((index + 1)); keep the function name rename_only and
the helper rename_iface unchanged so callers still match.

@ifroncy01 ifroncy01 marked this pull request as draft May 29, 2026 16:18
@ifroncy01 ifroncy01 added Work in progress Unfinished / work in progress and removed Needs review Seeking for review labels May 29, 2026
@github-actions github-actions Bot added the Needs review Seeking for review label May 30, 2026
refactor(easepi): unify BSP structure and simplify peripheral configs

This commit consolidates recent EasePi BSP refactoring into a single coherent change:

**Directory Structure Improvements:**
- Moved shared IR components (easepi-fix-infrared.sh, easepi_remote) from root to common/
- Renamed easepi-net-rename.sh to easepi-eth-order.sh for clearer intent
- Restructured common/ directory with clear separation of concerns

**Network Interface Ordering:**
- Created easepi-eth-order.sh: generic mechanism for reordering Ethernet interfaces
- Created easepi-eth-order.service: systemd service for automatic ordering
- Interface naming/ordering is now config-driven via eth_order file
- Supports three sources: device tree, /etc/eth_order, or udev rules

**OLED Simplification:**
- Removed oled_init.sh diagnostic script (no longer needed)
- Kept only oled.service + binary for clean runtime logic

**Code Quality:**
- Converted all Chinese comments to English
- Added clear documentation in scripts explaining architecture
- Updated board configs to reference new file locations

**Device-Specific vs Common Separation:**
- common/: universal components (BT, IR, ETH ordering)
- easepi-a2/: A2-specific (OLED, BT params, I2C)
- easepi-r2/: R2-specific (ETH order config, 4G modem rules)

feat(easepi): unify IR and Bluetooth configs with shared BSP directory

- Create packages/bsp/easepi/common/ for shared IR and Bluetooth files
- Add per-board easepi-bt.conf to configure BT UART device
- A2 uses /dev/ttyS8, R2 uses /dev/ttyS9
- Remove duplicate files from individual board directories
- Improve maintainability with shared logic
- Both boards keep their unique features (OLED, network rename, etc.)

Co-authored-by: traeagent <traeagent@users.noreply.github.com>
Update board configuration files for EasePi A2 and R2 to reflect recent BSP refactoring and configuration changes.

Summary:
 config/boards/easepi-a2.conf | 6 +-----
 config/boards/easepi-r2.conf | 6 +-----
 2 files changed, 2 insertions(+), 10 deletions(-)

Changed files:
config/boards/easepi-a2.conf
config/boards/easepi-r2.conf
Comment thread config/boards/easepi-a2.conf Outdated
Comment thread patch/kernel/archive/rockchip64-6.18/dt/rk3588-easepi-r2.dts Outdated
Comment thread patch/kernel/archive/rockchip64-6.18/dt/rk3568-easepi-a2.dts Outdated
Comment thread patch/kernel/archive/rockchip64-6.18/dt/rk3568-easepi-a2.dts Outdated
Comment thread patch/kernel/archive/rockchip64-6.18/dt/rk3588-easepi-r2.dts Outdated
if [ -n "$iface" ]; then
break
fi
sleep 0.5
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

sleep is unnecessary because if a new interface is present, it will be handled by udev. This script only needs to correct the network interface name before the udev service starts.

Comment thread packages/bsp/easepi/eth-order.service
Comment thread config/boards/easepi-r2.conf Outdated
ifroncy01 and others added 6 commits May 30, 2026 19:07
- Rename BSP files to bt-*, ir-*, eth-* prefixes
- Move common files out of 'common' directory
- Simplify hook functions for both boards
- Use PACKAGE_LIST_BOARD instead of add_packages_to_image hooks
- Add OLED binary directly to easepi-a2 BSP
- Consistent naming with easepi_a2/easepi_r2 underscore patterns
- Reorganize hooks into modular sections (OLED, IR, BT, Ethernet)
- Fix display_alert ordering in OLED install function
- Clean up old files
- Remove incorrect BOOT_ENV_FILE='armbianEnv.txt' from both boards
- The correct variable is BOOTENV_FILE, which is already set by family config to rk35xx.txt for rk3568/rk3588
Co-authored-by: Liangbin Lian <1129525450@qq.com>
Co-authored-by: Liangbin Lian <1129525450@qq.com>
Co-authored-by: Liangbin Lian <1129525450@qq.com>
- Remove unused custom properties (eth_order, kdebug, power-key-factory-reset) from device trees
- Remove rockchip-system-monitor node from r2 device tree
- Rename 71-rndis-net.rules to 71-net.rules and add Ethernet interface naming rules for r2
- Update eth-order.service to use After=systemd-udev-settle.service instead of Before/Wants network-pre.target
chosen {
stdout-path = "serial2:1500000n8";
power-key-factory-reset;
power-key-dbclick;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
power-key-dbclick;

Comment on lines 19 to 20
hwmodel_id = "A2";
hw_support = "hdmi";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
hwmodel_id = "A2";
hw_support = "hdmi";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release BSP Board Support Packages Framework Framework components Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review Patches Patches related to kernel, U-Boot, ... size/large PR with 250 lines or more Work in progress Unfinished / work in progress

Development

Successfully merging this pull request may close these issues.

4 participants