From 6dfed02838c04e499e287dcc32c15e655664283d Mon Sep 17 00:00:00 2001 From: Alexey 'Cluster' Avdyukhin Date: Wed, 14 Feb 2018 00:22:16 +0300 Subject: Many changes, updated to madmonkey's hakchi, zImage support, USB host support --- mods/mod_hakchi/hakchi/rootfs/etc/pleasewait.fb | Bin 0 -> 4342 bytes mods/mod_hakchi/hakchi/rootfs/etc/pleasewait.png | Bin 0 -> 5728 bytes .../hakchi/rootfs/etc/preinit.d/b0000_defines | 4 +- .../hakchi/rootfs/etc/preinit.d/b0010_functions | 195 +++++++++++++++++---- .../hakchi/rootfs/etc/preinit.d/b0020_backup | 2 +- .../hakchi/rootfs/etc/preinit.d/b0040_usb | 195 ++++++++++++--------- .../hakchi/rootfs/etc/preinit.d/p0000_config | 5 +- .../hakchi/rootfs/etc/preinit.d/p7010_bootlogo | 1 + .../hakchi/rootfs/etc/preinit.d/p7020_usb | 25 ++- .../hakchi/rootfs/etc/preinit.d/p7070_firmware | 9 +- 10 files changed, 297 insertions(+), 139 deletions(-) create mode 100644 mods/mod_hakchi/hakchi/rootfs/etc/pleasewait.fb create mode 100644 mods/mod_hakchi/hakchi/rootfs/etc/pleasewait.png (limited to 'mods/mod_hakchi/hakchi/rootfs/etc') diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/pleasewait.fb b/mods/mod_hakchi/hakchi/rootfs/etc/pleasewait.fb new file mode 100644 index 00000000..2826ef40 Binary files /dev/null and b/mods/mod_hakchi/hakchi/rootfs/etc/pleasewait.fb differ diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/pleasewait.png b/mods/mod_hakchi/hakchi/rootfs/etc/pleasewait.png new file mode 100644 index 00000000..229e0fd3 Binary files /dev/null and b/mods/mod_hakchi/hakchi/rootfs/etc/pleasewait.png differ diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0000_defines b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0000_defines index 684054df..c774d8c6 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0000_defines +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0000_defines @@ -3,11 +3,13 @@ modpath="/$modname" #mountpoint="/newroot" installpath="$mountpoint/var/lib/$modname" firmwarepath="$installpath/firmware" +extfirmwarepath="$mountpoint/media/$modname/firmware" rootfs="$installpath/rootfs" -squashfs="$installpath/squashfs" +squashfs="$mountpoint/var/squashfs" preinit="$rootfs/etc/preinit" preinitpath="$preinit.d" sftype="" sfregion="" gamepath="" +profilepath="/var/lib/clover/profiles/0" temppath="/tmp" diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions index 7ec99650..cb5c9e15 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions @@ -75,7 +75,10 @@ remount_root(){ mount_move l media mount_move l var + stopTask decodepng + stopTask aplay umount "$mountpoint" + local loopfile="/var${1##$mountpoint/var}" [ -f "$loopfile" ] || loopfile="/media${1##$mountpoint/media}" if ! mount -o loop,ro,noatime "$loopfile" "$mountpoint"; then @@ -97,7 +100,7 @@ checkFirmware(){ } currentFirmware(){ - local firmware="$(losetup | awk '{print $3'})" + local firmware="$(losetup -a | awk '{print $3'})" if ! [ -z "$firmware" ]; then echo "$firmware" return 0 @@ -109,14 +112,28 @@ currentFirmware(){ return 1 } +overmountModules(){ + if [ ! -d "$mountpoint/lib/modules/$(uname -r)" ]; then + if [ -d "$rootfs/lib/modules/$(uname -r)" ]; then + overmount "/lib/modules" + else + echo "no modules for loaded kernel $(uname -r)" + fi + fi +} + loadFirmware(){ [ -z "$(mount | grep -F loop0)" ] || return 1 local firmware="$mountpoint$cfg_firmware" if ! checkFirmware "$firmware"; then [ "$cfg_firmware" == "auto" ] || return 0 - [ -d "$firmwarepath" ] || return 0 - firmware="$(find "$firmwarepath" -type f -name "*.hsqs" | sort | head -n 1)" + [ -d "$extfirmwarepath" ] && \ + firmware="$(find "$extfirmwarepath" -type f -name "*.hsqs" | sort | head -n1)" + if ! checkFirmware "$firmware"; then + [ -d "$firmwarepath" ] && \ + firmware="$(find "$firmwarepath" -type f -name "*.hsqs" | sort | head -n1)" + fi fi checkFirmware "$firmware" || return 0 @@ -125,13 +142,7 @@ loadFirmware(){ remount_root "$firmware" cryptsetup close root-crypt mountSquash - if [ ! -d "$mountpoint/lib/modules/$(uname -r)" ]; then - if [ -d "$rootfs/lib/modules/$(uname -r)" ]; then - overmount "/lib/modules" - else - echo "no modules for loaded kernel $(uname -r)" - fi - fi + overmountModules } shutdown(){ @@ -181,6 +192,8 @@ restore(){ mount_bind(){ if mountpoint -q "$2"; then umount "$2" || umount -f "$2" + else + umount "$2" 2>/dev/null fi mount -o bind "$1" "$2" } @@ -205,7 +218,7 @@ containsGames(){ } linkGames(){ - local games="$mountpoint/media/$modname/games${1##$rootfs$gamepath}" + local games="$mountpoint/media/$modname/games${1##$installpath/games}" [ -d "$games" ] || games="$installpath/games${1##$rootfs$gamepath}" [ -d "$games" ] || games="$1" games="${games##$mountpoint}" @@ -221,7 +234,7 @@ softwareCheck(){ [ "$(cat "$mountpoint/etc/clover/REGION")" == "JPN" ] && sfregion="jpn" [ "$(cat "$mountpoint/etc/clover/REGION")" == "EUR" ] && sfregion="eur" - local feck="$mountpoint/var/lib/clover/profiles/0/home-menu/save/system-save.json" + local feck="$mountpoint$profilepath/home-menu/save/system-save.json" if [ "$sftype" == "snes" ]; then gamepath="/usr/share/games" [ -f "$feck" ] && mv -f "$feck" "$feck.nes" @@ -231,31 +244,35 @@ softwareCheck(){ [ -d "$feck" ] && rm -rf "$feck.snes" && mv "$feck" "$feck.snes" [ -f "$feck.nes" ] && mv -f "$feck.nes" "$feck" fi - + + mkdir -p "$mountpoint$profilepath/$modname" + rm -f "$mountpoint/var/saves" - ln -s "/var/lib/clover/profiles/0" "$mountpoint/var/saves" + ln -s "$profilepath" "$mountpoint/var/saves" } repair_fonts(){ if [ "$sftype" == "nes" ]; then mkdir -p "$1" || return 1 - [ ! -f "$1/title.fnt" ] && (cp $rootfs$gamepath/title.fnt "$1" || cp $squashfs$gamepath/title.fnt "$1") - [ ! -f "$1/copyright.fnt" ] && (cp $rootfs$gamepath/copyright.fnt "$1" || cp $squashfs$gamepath/copyright.fnt "$1") + [ ! -f "$1/title.fnt" ] && copy "$squashfs$gamepath/title.fnt" "$1/" + [ ! -f "$1/copyright.fnt" ] && copy "$squashfs$gamepath/copyright.fnt" "$1/" fi } repair_games(){ [ -w "$1" ] || return 0 + [ -f "$1/.repair.flag" ] || return 0 + cat "$rootfs/etc/pleasewait.fb" | gunzip -c - > "/dev/fb0" local usesymlink='' - ln -s / "$1/symlinktest" && rm "$1/symlinktest" && usesymlink='y' - + ln -s / "$1/symlinktest" 2>/dev/null && rm -f "$1/symlinktest" && usesymlink='y' + ls -1 "$squashfs$gamepath" | grep CLV- | while read code do - local gamedir="$1/$code" + local gamedir=$(find "$1" -name $code -type d) local squashgamedir="$squashfs$gamepath/$code" - + [ -d "$gamedir" ] || continue - + if [ ! -f "$gamedir/$code.desktop" ]; then cp "$squashgamedir/$code.desktop" "$gamedir/" [ "$sftype" == "nes" ] && \ @@ -263,10 +280,10 @@ repair_games(){ [ "$sftype" == "snes" ] && \ sed -i -e 's#/usr/bin/clover-canoe-shvc#/bin/clover-canoe-shvc-wr#g' "$gamedir/$code.desktop" fi - - [ -d "$gamedir/autoplay/" ] && ([ "$(ls -A "$gamedir/autoplay/")" ] || rm -r "$gamedir/autoplay/") - [ -d "$gamedir/pixelart/" ] && ([ "$(ls -A "$gamedir/pixelart/")" ] || rm -r "$gamedir/pixelart/") - + + [ -d "$gamedir/autoplay/" ] && ([ "$(ls -A "$gamedir/autoplay/")" ] || rm -rf "$gamedir/autoplay/") + [ -d "$gamedir/pixelart/" ] && ([ "$(ls -A "$gamedir/pixelart/")" ] || rm -rf "$gamedir/pixelart/") + find "$squashgamedir" -maxdepth 1 | sed -n '1!p' | while read squashfile do if [ "$usesymlink" == "y" ]; then @@ -276,19 +293,58 @@ repair_games(){ fi done done - sync - return 0 + + ls -1 "$1" | while read f; do repair_fonts "$1/$f"; done + + rm -f "$1/.repair.flag" && sync && reboot +} + +checkGamepath(){ + containsGames "$1" && echo "$1" && return 0 + containsGames "$1/000" && echo "$1" && return 0 + return 1 +} + +checkPath(){ + [ -d "$1" ] && echo "$1" && return 0 + return 1 +} + +findGameSyncStorage(){ + checkPath "$mountpoint/media/hakchi/games" && return 0 + mkdir -p "$installpath/games" + checkPath "$installpath/games" && return 0 + return 1 +} + +findGameStorage(){ + checkGamepath "$mountpoint/media/hakchi/games/$sftype-$sfregion" && return 0 + checkGamepath "$mountpoint/media/hakchi/games/$sftype" && return 0 + checkGamepath "$mountpoint/media/hakchi/games" && return 0 + + checkGamepath "$installpath/games/$sftype-$sfregion" && return 0 + checkGamepath "$installpath/games/$sftype" && return 0 + checkGamepath "$installpath/games" && return 0 + return 1 } overmount_games(){ - local menu_code="000" - [ -f "$installpath/menu" ] && menu_code="$(cat "$installpath/menu")" - containsGames "$rootfs$gamepath/$menu_code" || menu_code="" + local gameStorage="$(findGameStorage)" || return 0 + local state_path="$mountpoint$profilepath/$modname" + local state_file="$state_path/menu" + local menu_code="$1" + [ -z "$1" ] && menu_code="000" + [ -z "$1" ] && [ -f "$state_file" ] && menu_code="$(cat "$state_file")" + containsGames "$gameStorage/$menu_code" || menu_code="" echo "menu code: $menu_code" - if containsGames "$rootfs$gamepath/$menu_code"; then - overmount "$gamepath/$menu_code" "$gamepath" && repair_games "$rootfs$gamepath/$menu_code" && linkGames "$rootfs$gamepath/$menu_code" && return 0 + if containsGames "$gameStorage/$menu_code"; then + mount_bind "$gameStorage/$menu_code" "$mountpoint/$gamepath" && \ + repair_games "$gameStorage" + repair_fonts "$gameStorage/$menu_code" && \ + linkGames "$gameStorage/$menu_code" && \ + return 0 else - echo "no romz found at: $rootfs$gamepath/$menu_code" + echo "no romz found at: $gameStorage/$menu_code" fi linkGames "$gamepath" return 1 @@ -330,15 +386,86 @@ printSoftwareInfo(){ echo "region=$sfregion" } +stopTask(){ + local tokill="false" + if [ "$1" = "-f" ]; then + tokill="true" + shift + fi + local pid="$(pidof "$1")" + [ -z "$pid" ] && return 0 + "$tokill" && kill "$pid" + wait "$pid" +} + +waitTask(){ + local A="stopTask ${1+"$@"}" + trap "$A" EXIT +} + showImage(){ - image="$(eval echo "$1")" + local image="$(eval echo "$1")" [ -f "$image" ] || image="$rootfs$1" [ -f "$image" ] || image="$squashfs$1" [ -f "$image" ] || return 1 decodepng "$image" > "/dev/fb0" & + waitTask decodepng + return 0 +} + +playSound(){ + local wavfile="$(eval echo "$1")" + [ -f "$wavfile" ] || wavfile="$rootfs$1" + [ -f "$wavfile" ] || wavfile="$squashfs$1" + [ -f "$wavfile" ] || return 1 + aplay -q "$wavfile" & + waitTask aplay return 0 } hwmon(){ cat "/sys/devices/virtual/hwmon/hwmon1/temp1_input" } + +usedBlockSpace(){ + local path="$1" + [ -e "$path" ] || path="$rootfs" + local line="$(df -k "$path" | tail -n1)" + local used="$(echo "$line" | awk '{print $3}')" + local available="$(echo "$line" | awk '{print $4}')" + local total="$(($used+$available))" + echo "$used $total" +} + +freeBlockSpace(){ + local path="$1" + [ -e "$path" ] || path="$rootfs" + df -k "$path" | tail -n1 | awk '{print $4}' +} + +usedSpace(){ +# Warning: SLOW + local path="$1" + [ -e "$path" ] || path="$rootfs" + du -ksx "$path" | awk '{print $1}' +} + +usedBy(){ + case "$1" in + games) + usedSpace "$(findGameSyncStorage)" + ;; + saves) + usedSpace "$profilepath" + ;; + mods) + usedSpace "$rootfs" + ;; + firmware) + usedSpace "$firmwarepath" + ;; + *) + echo "Usage: usedBy {games|saves|mods|firmware}" + return 1 + esac +} diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0020_backup b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0020_backup index 8377e1d7..6819ccdd 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0020_backup +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0020_backup @@ -14,7 +14,7 @@ backup_nandb(){ if [ ! -f "$nandb_filename" ]; then echo "backup $nandb_filename" dd if=/dev/mapper/root-crypt bs=4k \ - count=$((($(hexdump -e '1/4 "%u"' -s $((0x28)) -n 4 /dev/mapper/root-crypt)+0xfff)/0x1000)) \ + count="$((($(hexdump -e '1/4 "%u"' -s $((0x28)) -n 4 /dev/mapper/root-crypt)+0xfff)/0x1000))" \ > "$nandb_filename" && \ md5sum "$nandb_filename" > "$nandb_filename.md5" fi diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0040_usb b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0040_usb index 786d6f36..ddfffdb4 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0040_usb +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0040_usb @@ -1,81 +1,114 @@ -disableUsbDevice(){ - #disable usb - echo 0 > "/sys/devices/sunxi_usb/usb_role" -} - -switchToUsbDevice(){ - echo Switching to USB device mode - disableUsbDevice - - # enable device mode - echo 2 > "/sys/devices/sunxi_usb/usb_role" - - # make sure the usb gadgets are disabled - echo 0 > "/sys/devices/virtual/android_usb/android0/enable" -} - -switchToUsbHost(){ - echo Switching to USB host mode - # make sure the usb gadgets are disabled - echo 0 > "/sys/devices/virtual/android_usb/android0/enable" - - disableUsbDevice - - # enable host mode - echo 1 > "/sys/devices/sunxi_usb/usb_role" -} - -checkUsbStorage(){ - local disk="/dev/sda1" - - local timeout=5 - while [ $timeout -gt 0 ] && ! [ -b "$disk" ]; do - echo "waiting for media $timeout" - let timeout=timeout-1 - sleep 1 - done - - [ -b "$disk" ] || return 1 - - local ro="defaults,nosuid,nodev,noatime,ro" - local rw="defaults,nosuid,nodev,noatime,rw" - mount -o $ro "$disk" "$mountpoint/media" || return 1 - - local saves="$modname/saves" - - if [ -d "$mountpoint/media/$saves" ] || [ -d "$mountpoint/media/$modname/transfer" ] || [ "$cfg_usb_rw" == "y" ]; then - mount -o remount,$rw "$disk" - fi - [ -d "$mountpoint/media/$saves" ] && mount_bind "$mountpoint/media/$saves" "$mountpoint/var/lib/clover/profiles/0" - - local bootlogo0="boot.png" - local bootlogo1="$mountpoint/media/$modname/$bootlogo0" - local bootlogo2="$rootfs/etc/$bootlogo0" - if [ -f "$bootlogo1" ]; then - rsync -ac "$bootlogo1" "$bootlogo2" - showImage "$bootlogo2" - cfg_boot_logo='' - else - [ -f "$bootlogo2" ] && rm "$bootlogo2" && source "$preinit.d/p7010_bootlogo" - fi - - return 0 -} - -checkUsbGamepath(){ - local disk="/dev/sda1" - [ -b "$disk" ] || return 1 - - local games="$modname/games" - if containsGames "$mountpoint/media/$games"; then - if ! mkdir -p "$rootfs$gamepath"; then - rm -rf "$rootfs$gamepath" - mkdir -p "$rootfs$gamepath" || return 1 - fi - mount_bind "$mountpoint/media/$games" "$rootfs$gamepath" - return 0 - else - echo "no romz found at: $disk:/$games" - return 1 - fi -} +disableUsbDevice(){ + #disable usb + [ -f "/sys/devices/sunxi_usb/usb_role" ] || return 1 + echo 0 > "/sys/devices/sunxi_usb/usb_role" +} + +switchToUsbDevice(){ + [ -f "/sys/devices/sunxi_usb/usb_role" ] || return 1 + disableUsbDevice + # enable device mode + echo 2 > "/sys/devices/sunxi_usb/usb_role" + # make sure the usb gadgets are disabled + echo 0 > "/sys/devices/virtual/android_usb/android0/enable" +} + +switchToUsbHost(){ + [ -f "/sys/devices/sunxi_usb/usb_role" ] || return 1 + # make sure the usb gadgets are disabled + [ -f "/sys/devices/virtual/android_usb/android0/enable" ] && \ + echo 0 > "/sys/devices/virtual/android_usb/android0/enable" + disableUsbDevice + # enable host mode + echo 1 > "/sys/devices/sunxi_usb/usb_role" +} + +getUsbStorageIds(){ + find "/dev/bus/usb" -type c | while read device + do + hexdump -n 1 -s 32 "$device" -C | grep -e '^00000020 08' && echo "$device" + done +} + +waitForUsbDevice(){ + [ -z "$(getUsbStorageIds)" ] && return 1 + local blockDevice="$1" + local timeout=5 + while [ $timeout -gt 0 ] && ! [ -b "$blockDevice" ]; do + echo "waiting for media $timeout" + let timeout=timeout-1 + sleep 1 + done + [ -b "$blockDevice" ] +} + +checkStorageDevice(){ + local blockDevice="$1" + [ -b "$blockDevice" ] || return 1 + + local ro="defaults,nosuid,nodev,noatime,ro" + local rw="defaults,nosuid,nodev,noatime,rw" + local games="$modname/games" + local saves="$modname/saves" + + if ! [ "$cfg_usb_rw" == "y" ]; then + mount -o $ro "$blockDevice" "$mountpoint/media" || return 1 + fi + + local need_repair="" + [ -d "$mountpoint/media/$games" ] && ! [ -z "$(find $mountpoint/media/$games -name .repair.flag -maxdepth 2)" ] && need_repair=y + + if [ -d "$mountpoint/media/$saves" ] || [ -d "$mountpoint/media/$modname/transfer" ] || [ "$cfg_usb_rw" == "y" ] || [ "$need_repair" == "y" ]; then + umount "$mountpoint/media" 2>/dev/null + mount -o $rw "$blockDevice" "$mountpoint/media" || return 1 + fi + + if ! [ -d "$mountpoint/media/$modname" ]; then + umount "$mountpoint/media" + return 1 + fi + + [ -d "$mountpoint/media/$saves" ] && mount_bind "$mountpoint/media/$saves" "$mountpoint$profilepath" + + local bootlogo0="boot.png" + local bootlogo1="$mountpoint/media/$modname/$bootlogo0" + local bootlogo2="$rootfs/etc/$bootlogo0" + if [ -f "$bootlogo1" ]; then + rsync -ac "$bootlogo1" "$bootlogo2" + showImage "$bootlogo2" + cfg_boot_logo='' + else + [ -f "$bootlogo2" ] && rm -f "$bootlogo2" && source "$preinit.d/p7010_bootlogo" + fi + + local bootsound0="boot.wav" + local bootsound1="$mountpoint/media/$modname/$bootsound0" + local bootsound2="$rootfs/etc/$bootsound0" + if [ -f "$bootsound1" ]; then + [ -f "$bootsound2" ] || playSound "$bootsound1" + rsync -ac "$bootsound1" "$bootsound2" + else + rm -f "$bootsound2" + fi + + return 0 +} + +checkExtStorage(){ + local di + local d + local p + local blockDevice="/dev/sd" + waitForUsbDevice "${blockDevice}a1" + for di in $(seq 97 99); do + d="$(printf "\\$(printf %o $di)\n")" + for p in $(seq 1 9); do + checkStorageDevice "$blockDevice$d$p" && return 0 + done + done + blockDevice="/dev/mmcblk0p" + for p in $(seq 1 9); do + checkStorageDevice "$blockDevice$p" && return 0 + done + return 1 +} diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p0000_config b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p0000_config index 7e99591c..00917bff 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p0000_config +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p0000_config @@ -1,3 +1,6 @@ cfg_boot_stock='n' +cfg_disable_armet='y' cfg_firmware='auto' -cfg_usb_host='n' +cfg_nes_extra_args='' +cfg_snes_extra_args='' +cfg_usb_host='y' diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7010_bootlogo b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7010_bootlogo index 9675ad27..4a5e3f18 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7010_bootlogo +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7010_bootlogo @@ -1 +1,2 @@ showImage "$cfg_boot_logo" || showImage "$rootfs/etc/boot.png" || showImage "$rootfs/etc/$modname.png" +playSound "$rootfs/etc/boot.wav" diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7020_usb b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7020_usb index 6f299d7f..43b27c24 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7020_usb +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7020_usb @@ -1,13 +1,12 @@ -if [ "$cfg_usb_host" != "y" ]; then - switchToUsbDevice -else - # the usb driver needs some time to initialize - sleep 1 - - if [ -z "$(lsusb | grep -v "1d6b:0001")" ]; then - switchToUsbDevice - else - checkUsbStorage - fi - -fi +if [ "$cfg_usb_host" != "y" ]; then + switchToUsbDevice +else + switchToUsbHost + # the usb driver needs some time to initialize + sleep 1 + if [ -z "$(lsusb | grep -v "1d6b:0001")" ]; then + switchToUsbDevice + fi +fi + +checkExtStorage diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7070_firmware b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7070_firmware index e14653c0..ba531140 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7070_firmware +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7070_firmware @@ -2,12 +2,5 @@ mod_repair_etc softwareCheck -checkUsbGamepath -if [ ! -d "$mountpoint/lib/modules/$(uname -r)" ]; then - if [ -d "$rootfs/lib/modules/$(uname -r)" ]; then - overmount "/lib/modules" - else - echo "no modules for loaded kernel $(uname -r)" - fi -fi +overmountModules -- cgit v1.2.3