|
@@ -164,9 +164,10 @@ DWORD CSATDevices::WorkThread(LPVOID lpVoid)
|
|
|
if ( it->nType == SATDEV::Reticle ) {
|
|
|
if ( it->nStatus == SATDEV::Offline ) {
|
|
|
// offline只能reconnect才能重连;
|
|
|
- std::string str = "adb reconnect ";
|
|
|
- str.append(it->strName);
|
|
|
+ std::string str = "adb reconnect offline";
|
|
|
WinExec(str.c_str(), SW_HIDE);
|
|
|
+ // 重连后,break此次循环;
|
|
|
+ break;
|
|
|
}
|
|
|
else if ( it->nStatus == SATDEV::Dropline ) {
|
|
|
std::string str = "adb connect ";
|
|
@@ -174,10 +175,18 @@ DWORD CSATDevices::WorkThread(LPVOID lpVoid)
|
|
|
WinExec(str.c_str(), SW_HIDE);
|
|
|
}
|
|
|
} else if ( it->nType == SATDEV::Usb ) {
|
|
|
+#if 0
|
|
|
+ // offline只能reconnect才能重连;
|
|
|
+ std::string str = "adb reconnect offline";
|
|
|
+ WinExec(str.c_str(), SW_HIDE);
|
|
|
+#else
|
|
|
// 如果是usb的话,可能要kill-server,再全部重连接;
|
|
|
WinExec("adb kill-server", SW_HIDE);
|
|
|
// 重连所有;
|
|
|
ReConnectAllDevices();
|
|
|
+ // 重连后,break此次循环;
|
|
|
+#endif
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
it++;
|
|
@@ -323,7 +332,9 @@ void CSATDevices::GetCurrentDevices(std::vector<SATDEV::STDevice> &vtDevices)
|
|
|
// offline设备也要加入,不区分usb或reticle;
|
|
|
for ( std::vector<std::string>::iterator it = vtLine.begin(); it != vtLine.end(); it++ ) {
|
|
|
//if ( _tcsicmp("List of devices attached ", it->c_str()) == 0 )
|
|
|
- if ( it->find("List of devices attached") != std::string::npos )
|
|
|
+ if ( it->find("List of devices attached") != std::string::npos ||
|
|
|
+ it->find("* daemon started successfully") != std::string::npos ||
|
|
|
+ it->find("* daemon not running; starting now at tcp:") != std::string::npos )
|
|
|
continue;
|
|
|
SATDEV::STDevice stDevice;
|
|
|
// 设备类型;
|
|
@@ -339,6 +350,12 @@ void CSATDevices::GetCurrentDevices(std::vector<SATDEV::STDevice> &vtDevices)
|
|
|
stDevice.nStatus = SATDEV::Offline;
|
|
|
// 获取设备名;
|
|
|
stDevice.strName = it->substr(0, npos);
|
|
|
+ // 如果是网络,去掉5555;
|
|
|
+ if ( stDevice.nType == SATDEV::Reticle ) {
|
|
|
+ npos = stDevice.strName.find(":5555");
|
|
|
+ stDevice.strName = stDevice.strName.substr(0, npos);
|
|
|
+ }
|
|
|
+
|
|
|
// 新设备否(一般用于usb设备)
|
|
|
IsNewDevices(stDevice);
|
|
|
// 压入容器保存;
|