Files
workphone-sdk/sdk/scripts/start_device.sh

55 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 设备启动脚本
echo "=== 工作手机 - 设备启动工具 ==="
echo ""
# 检查ADB
if ! command -v adb &> /dev/null; then
echo "❌ ADB未找到请安装Android SDK Platform Tools"
exit 1
fi
# 检查设备
echo "检查已连接设备..."
DEVICES=$(adb devices | grep -v "List" | grep "device" | wc -l | tr -d ' ')
if [ "$DEVICES" -gt 0 ]; then
echo "✅ 发现 $DEVICES 个设备:"
adb devices
echo ""
echo "设备已就绪!"
exit 0
fi
echo "⚠️ 未发现设备"
echo ""
echo "请选择启动方式:"
echo "1. 打开Android Studio Device Manager"
echo "2. 检查USB连接"
echo "3. 查看设备启动指南"
echo ""
read -p "请输入选项 (1-3): " choice
case $choice in
1)
echo "正在打开Android Studio..."
open -a "Android Studio" 2>/dev/null || echo "请手动打开Android Studio → Device Manager"
;;
2)
echo "检查USB设备..."
system_profiler SPUSBDataType 2>/dev/null | grep -i "android\|phone" || echo "未检测到Android设备"
echo ""
echo "请确保:"
echo "1. USB线已连接"
echo "2. 手机已开启USB调试"
echo "3. 已授权此电脑"
;;
3)
open "sdk/docs/设备启动指南.md" 2>/dev/null || echo "请查看sdk/docs/设备启动指南.md"
;;
*)
echo "无效选项"
;;
esac