hiby: r1_patcher: add hotplug support

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit da5d6f8bf32fd9245b133f6980dbbb6c4455c197
Author: Roman Artiukhin <[email protected]>
Date:   Mon Jan 19 18:57:42 2026 +0200

    hiby: r1_patcher: add hotplug support
    
    Change-Id: I8b82842f26ac6444b32e166308b7c5deb17fab7a

diff --git a/tools/r1_patcher/r1_patcher.sh b/tools/r1_patcher/r1_patcher.sh
index 973ca28179..2daf2ac0e2 100755
--- a/tools/r1_patcher/r1_patcher.sh
+++ b/tools/r1_patcher/r1_patcher.sh
@@ -58,6 +58,45 @@ chmod 0755 "$workingdir_in/rootfs/extracted/usr/bin/bootloader.r1"
 cp hiby_player.sh $workingdir_in/rootfs/extracted/usr/bin/
 chmod 0755 $workingdir_in/rootfs/extracted/usr/bin/hiby_player.sh
 
+################################################################################
+### Rockbox Hotplug Logic
+################################################################################
+
+# 1. Create hotplug helper script
+cat << 'EOF' > $workingdir_in/rootfs/extracted/usr/bin/rb_hotplug.sh
+#!/bin/sh
+MNT_SD="/data/mnt/sd_0"
+MNT_USB="/data/mnt/usb"
+
+case "$MDEV" in
+    mmcblk*) MNT="$MNT_SD" ;;
+    sd*)     MNT="$MNT_USB" ;;
+    *)       exit 0 ;;
+esac
+
+case "$ACTION" in
+    add|"")
+        mkdir -p "$MNT"
+        mount -t auto -o flush,noatime "/dev/$MDEV" "$MNT"
+        ;;
+    remove)
+        umount -l "$MNT"
+        ;;
+esac
+EOF
+chmod 0755 $workingdir_in/rootfs/extracted/usr/bin/rb_hotplug.sh
+
+# 2. Check mdev.conf and append rules only if missing
+MDEV_CONF="$workingdir_in/rootfs/extracted/etc/mdev.conf"
+
+if ! grep -q "mmcblk" "$MDEV_CONF"; then
+    echo "mmcblk[0-9]p[0-9] 0:0 660 */usr/bin/rb_hotplug.sh" >> "$MDEV_CONF"
+fi
+
+if ! grep -q "sd\[a-z\]" "$MDEV_CONF"; then
+    echo "sd[a-z][0-9]      0:0 660 */usr/bin/rb_hotplug.sh" >> "$MDEV_CONF"
+fi
+
 ################################################################################
 ### rebuild
 ################################################################################
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.