mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-01-22 01:30:35 -05:00
hiby: r1_patcher: add hotplug support
Change-Id: I8b82842f26ac6444b32e166308b7c5deb17fab7a
This commit is contained in:
parent
b25f59a98a
commit
da5d6f8bf3
1 changed files with 39 additions and 0 deletions
|
|
@ -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
|
||||
################################################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue