#!/bin/bash # SPDX-License-Identifier: GPL-2.0 # # Copyright (c) 2026 AMLOGIC #!/bin/sh MARK=/run/adbd-last-offline echo "[recover] enter" sleep 1 offline=$(journalctl -u adbd -n 20 --no-pager \ | grep "UsbFfs: offline" \ | tail -1) [ -z "$offline" ] && exit 0 id=$(echo "$offline" | md5sum | cut -d' ' -f1) last=$(cat $MARK 2>/dev/null) echo "[recover] id=$id last=$last" if [ "$id" = "$last" ]; then echo "[recover] already handled" exit 0 fi echo "$id" > $MARK echo "[recover] restart" systemctl restart adbd