mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 17:57:01 +08:00
fix: adb lite 无法连接
This commit is contained in:
@@ -783,31 +783,31 @@ bool asst::AdbController::connect(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (need_connect) {
|
||||
m_adb.connect = cmd_replace(adb_cfg.connect);
|
||||
m_adb.release = cmd_replace(adb_cfg.release);
|
||||
auto connect_ret =
|
||||
call_command(m_adb.connect, 60LL * 1000, false /* adb 连接时不允许重试 */);
|
||||
bool is_connect_success = false;
|
||||
if (connect_ret) {
|
||||
auto& connect_str = connect_ret.value();
|
||||
// 检查连接字符串是否包含 "connected"
|
||||
is_connect_success = connect_str.find("connected") != std::string::npos;
|
||||
// NOTE:这玩意啥都没干,有什么用吗?
|
||||
if (connect_str.find("daemon started successfully") != std::string::npos
|
||||
&& connect_str.find("daemon still not running") == std::string::npos) {
|
||||
}
|
||||
}
|
||||
if (!is_connect_success) {
|
||||
json::value info = get_info_json()
|
||||
| json::object {
|
||||
{ "what", "ConnectFailed" },
|
||||
{ "why", "Connection command failed to exec" },
|
||||
};
|
||||
callback(AsstMsg::ConnectionInfo, info);
|
||||
return false;
|
||||
// TODO: adb lite server 尚未实现,第一次连接需要执行一次 adb.exe 启动 daemon
|
||||
m_adb.connect = cmd_replace(adb_cfg.connect);
|
||||
m_adb.release = cmd_replace(adb_cfg.release);
|
||||
auto connect_ret =
|
||||
call_command(m_adb.connect, 60LL * 1000, false /* adb 连接时不允许重试 */);
|
||||
bool is_connect_success = false;
|
||||
if (connect_ret) {
|
||||
auto& connect_str = connect_ret.value();
|
||||
// 检查连接字符串是否包含 "connected"
|
||||
is_connect_success = connect_str.find("connected") != std::string::npos;
|
||||
// NOTE:这玩意啥都没干,有什么用吗?
|
||||
if (connect_str.find("daemon started successfully") != std::string::npos
|
||||
&& connect_str.find("daemon still not running") == std::string::npos) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_connect_success && need_connect) {
|
||||
json::value info = get_info_json()
|
||||
| json::object {
|
||||
{ "what", "ConnectFailed" },
|
||||
{ "why", "Connection command failed to exec" },
|
||||
};
|
||||
callback(AsstMsg::ConnectionInfo, info);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (need_exit()) {
|
||||
|
||||
Reference in New Issue
Block a user