From 424a2867551e529e28db1ff237128d0d610cfc76 Mon Sep 17 00:00:00 2001 From: Douglas Teles Date: Mon, 11 May 2026 19:02:46 -0300 Subject: [PATCH] Fix rumble motor enable pin behavior for R36S revisions and adjust automount script for internal storage handling --- .../dts/rockchip/rk3326-gameconsole-r36s.dts | 22 ++++++++ .../packages/archr/sources/scripts/automount | 50 +++++++++++++++---- ...RTL8188EU-firmware-upload-block-size.patch | 34 +++++++++++++ 3 files changed, 97 insertions(+), 9 deletions(-) create mode 100644 projects/ArchR/packages/linux/patches/6.12-LTS/0050-wifi-rtl8xxxu-Fix-RTL8188EU-firmware-upload-block-size.patch diff --git a/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r36s.dts b/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r36s.dts index 86309e8534..72aff5fb19 100644 --- a/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r36s.dts +++ b/projects/ArchR/devices/RK3326/linux/dts/rockchip/rk3326-gameconsole-r36s.dts @@ -179,6 +179,28 @@ }; }; +/* + * Force the rumble motor enable pin (gpio0 PB7, shared with pwm0 function) + * to drive LOW at gpiolib probe time. Without this, some R36S revisions + * (notably V21 P4 — see archr-linux/Arch-R#25) come out of reset with the + * pin in a high-impedance / pulled-up state, the rumble transistor latches + * on and the motor runs continuously through boot. + * + * The hog acquires the pin before the PWM driver, which means rumble is + * effectively disabled on every R36S that uses this DTS. Trade-off: a few + * boards lose rumble support, but every board stops vibrating non-stop. + * If a future R36S variant needs working rumble, gate this with a board + * compatible check instead of removing it outright. + */ +&gpio0 { + rumble-en-hold-low { + gpio-hog; + gpios = ; + output-low; + line-name = "rumble_en_hold_low"; + }; +}; + &pinctrl { btns { btn_pins: btn-pins { diff --git a/projects/ArchR/packages/archr/sources/scripts/automount b/projects/ArchR/packages/archr/sources/scripts/automount index f6492d64d4..1354242f65 100755 --- a/projects/ArchR/packages/archr/sources/scripts/automount +++ b/projects/ArchR/packages/archr/sources/scripts/automount @@ -65,22 +65,54 @@ function start_ms() { fi MS_ENABLED=$(get_setting system.merged.storage) + if [ "${1}" = "internal" ] + then + # No external SD detected — /storage/roms (the real internal ROMs + # directory) is already the right thing for EmulationStation. + log $0 "No external SD; /storage/roms used directly" + return 0 + fi + if [ -e "/storage/.ms_unsupported" ] || \ [ ! "${MS_ENABLED}" = 1 ] then - # Single SD: /storage/roms is used directly (no bind mount needed) - log $0 "Using /storage/roms directly" + # External SD present but overlay isn't usable (FAT/exFAT/NTFS) or + # merged storage was disabled by the user. Bind-mount the external + # roms over /storage/roms so ES sees them. The internal /storage/roms + # content is shadowed for as long as the external SD is mounted; it + # comes back next boot if the user pulls the card. + if [ -d "/storage/games-external/roms" ] + then + log $0 "Bind-mounting /storage/games-external/roms over ${MS_PATH}" + mount --bind /storage/games-external/roms ${MS_PATH} + else + log $0 "External SD has no roms/ directory; leaving /storage/roms intact" + fi else - log $0 "Enabling merged storage of /storage/games-${LOWER} and /storage/games-${UPPER} to ${MS_PATH}." + log $0 "Enabling merged storage of games-${LOWER} and games-${UPPER} on ${MS_PATH}." - for DIR in /storage/games-${UPPER}/.tmp/games-workdir /storage/games-${LOWER}/roms /storage/games-${UPPER}/roms + # `LOWER`/`UPPER` may refer to "internal" — which now lives at + # /storage/roms directly. Resolve "internal" to the real /storage/roms + # path; bind-mount it to a working location so overlayfs doesn't try + # to use the same path as both lowerdir and mount point (which would + # fail with -EBUSY). + local LOWER_DIR UPPER_DIR + [ "${LOWER}" = "internal" ] && LOWER_DIR="/storage/.games-internal-bind/roms" || LOWER_DIR="/storage/games-${LOWER}/roms" + [ "${UPPER}" = "internal" ] && UPPER_DIR="/storage/.games-internal-bind/roms" || UPPER_DIR="/storage/games-${UPPER}/roms" + + if [ "${LOWER}" = "internal" ] || [ "${UPPER}" = "internal" ] + then + mkdir -p /storage/.games-internal-bind/roms + mountpoint -q /storage/.games-internal-bind/roms || \ + mount --bind /storage/roms /storage/.games-internal-bind/roms + fi + + for DIR in /storage/games-${UPPER}/.tmp/games-workdir "${LOWER_DIR}" "${UPPER_DIR}" do - if [ ! -d "${DIR}" ] - then - mkdir -p "${DIR}" - fi + [ -d "${DIR}" ] || mkdir -p "${DIR}" done - mount overlay -t overlay -o lowerdir=/storage/games-${LOWER}/roms,upperdir=/storage/games-${UPPER}/roms,workdir=/storage/games-${UPPER}/.tmp/games-workdir ${MS_PATH} + + mount overlay -t overlay -o lowerdir=${LOWER_DIR},upperdir=${UPPER_DIR},workdir=/storage/games-${UPPER}/.tmp/games-workdir ${MS_PATH} fi } diff --git a/projects/ArchR/packages/linux/patches/6.12-LTS/0050-wifi-rtl8xxxu-Fix-RTL8188EU-firmware-upload-block-size.patch b/projects/ArchR/packages/linux/patches/6.12-LTS/0050-wifi-rtl8xxxu-Fix-RTL8188EU-firmware-upload-block-size.patch new file mode 100644 index 0000000000..8ef4b5b1a3 --- /dev/null +++ b/projects/ArchR/packages/linux/patches/6.12-LTS/0050-wifi-rtl8xxxu-Fix-RTL8188EU-firmware-upload-block-size.patch @@ -0,0 +1,34 @@ +From 93b3a45645f13290745ef58bf99ad0877af29381 Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Mon, 23 Dec 2024 17:01:57 +0200 +Subject: [PATCH 36/41] wifi: rtl8xxxu: Fix RTL8188EU firmware upload block + size + +A user reports that the firmware upload consistently fails when it's +uploaded in chunks of 128 bytes, but it works when uploaded in chunks +of 196 bytes. The official driver uses 196 bytes also. + +Link: https://github.com/a5a5aa555oo/rtl8xxxu/issues/2 +Signed-off-by: Bitterblue Smith +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/cba8e2f2-32c4-4174-90ba-0219f29dbdde@gmail.com +--- + drivers/net/wireless/realtek/rtl8xxxu/8188e.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/realtek/rtl8xxxu/8188e.c b/drivers/net/wireless/realtek/rtl8xxxu/8188e.c +index 3d04df0f5bf4..766a7a7c7d28 100644 +--- a/drivers/net/wireless/realtek/rtl8xxxu/8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/8188e.c +@@ -1860,7 +1860,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = { + .set_crystal_cap = rtl8188f_set_crystal_cap, + .cck_rssi = rtl8188e_cck_rssi, + .led_classdev_brightness_set = rtl8188eu_led_brightness_set, +- .writeN_block_size = 128, ++ .writeN_block_size = 196, + .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), + .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), + .has_tx_report = 1, +-- +2.43.0 +