From b5bbef195d7c3e9cf395788d60edce8e67c4f834 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Sat, 17 Apr 2021 21:13:39 +0700 Subject: [PATCH] Wait for USB devices to be ready after rebinding drivers (#724) --- scripts/umbrel-os/external-storage/mount | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/umbrel-os/external-storage/mount b/scripts/umbrel-os/external-storage/mount index 08e170f..9b2222b 100755 --- a/scripts/umbrel-os/external-storage/mount +++ b/scripts/umbrel-os/external-storage/mount @@ -184,6 +184,20 @@ main () { echo "Blacklisting USB device IDs against UAS driver..." blacklist_uas + echo "Checking USB devices are back..." + retry_for_usb_devices=1 + while [[ ! -e "${partition_path}" ]]; do + retry_for_usb_devices=$(( $retry_for_usb_devices + 1 )) + if [[ $retry_for_usb_devices -gt 10 ]]; then + echo "USB devices weren't registered after 10 tries..." + echo "Exiting mount script without doing anything" + exit 1 + fi + + echo "Waiting for USB devices..." + sleep 1 + done + echo "Checking if the device is ext4..." if is_partition_ext4 "${partition_path}" ; then