#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/smartphone # # commands: # https://stackoverflow.com/questions/7641939/android-fastboot-waiting-for-devices/11813511 # # notes: # - don't use USB 3.0, i.e. the blue socket # - don't use fastboot with Samsung devices: # https://stackoverflow.com/questions/7641939/android-fastboot-waiting-for-devices/11813511 mount-smartphone () { local tmp_dir=$(mktemp -d ~/sp/XXX.phone) jmtpfs $tmp_dir > /dev/null local dir=sot local src=${tmp_dir}/Internal\ shared\ storage/Pictures/${dir} local dst=~/mm/${dir:l}/pics mkdir -p $dst cp -n ${src}/*.(jpg|jpeg|png|webp) $dst } alias phone=mount-smartphone download-mode () { sudo adb reboot download } abd-server-restart () { sudo adb kill-server sudo adb start-server adb devices } bootloader-reboot () { adb reboot-bootloader } flash-recovery () { local rec=$1 # img file heimdall flash --RECOVERY $rec --no-reboot } push-build () { local build=$1 # zip file sudo adb push $build /sdcard }