remay / tmf-hudl

Custom ROM for the Tesco Hudl 1 - Keep your Hudl working after 26th June 2020
https://rob.themayfamily.me.uk/hudl
MIT License
17 stars 1 forks source link

Add capability to hudl-flash.sh to automate move to 'flash' mode #15

Open remay opened 3 years ago

remay commented 3 years ago

If the Huddle has USB debugging enabled and the host has adb installed then hudl-flash.sh should use adb reboot bootloader to put the attached Hudl into the state ready to flash.

remay commented 3 years ago

'command -v adb` to discover the path to adb, if it is installed (builtin in both bash (ubuntu) and ash (tce), our 2 targets)

remay commented 3 years ago
try_adb=1
echo "Waiting for a connected Hudl in flash mode ..."
while ! lsusb -d 2207:310b 1>/dev/null 2>&1
do
        lsusb -d 0e79: 1>/dev/null 2>&1
        if [ $? -eq 0 ]
        then
                if [ $try_adb -eq 1 ]
                then
                        # See if we can use adb to put us in flash mode: 
                        echo "Trying to reboot Hudl into flash mode using adb (needs USB debugging enabled)."
                        echo "If this fails then do it manually by holding vol+ and pressing reset."
                        adb reboot bootloader
                        # TODO Should check for availability of adb command, and shoudl catch failure here
                        sleep 5
                fi
                try_adb=0
        fi
done
echo "Hudl in flash mode, starting to flash ..."