mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-03 14:18:45 +00:00
get devices serial by adb devices
This commit is contained in:
parent
e87a15ea0d
commit
aa43900530
1 changed files with 11 additions and 4 deletions
|
@ -44,7 +44,6 @@ void AdbProcess::initSignals()
|
||||||
emit adbProcessResult(AER_ERROR_EXEC);
|
emit adbProcessResult(AER_ERROR_EXEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << ">>>>>>>>" << __FUNCTION__;
|
|
||||||
qDebug() << "adb return " << exitCode << "exit status " << exitStatus;
|
qDebug() << "adb return " << exitCode << "exit status " << exitStatus;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -61,14 +60,22 @@ void AdbProcess::initSignals()
|
||||||
|
|
||||||
connect(this, &QProcess::readyReadStandardError, this,
|
connect(this, &QProcess::readyReadStandardError, this,
|
||||||
[this](){
|
[this](){
|
||||||
qDebug() << ">>>>>>>>" << __FUNCTION__;
|
|
||||||
qDebug() << QString::fromLocal8Bit(readAllStandardError());
|
qDebug() << QString::fromLocal8Bit(readAllStandardError());
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(this, &QProcess::readyReadStandardOutput, this,
|
connect(this, &QProcess::readyReadStandardOutput, this,
|
||||||
[this](){
|
[this](){
|
||||||
qDebug() << ">>>>>>>>" << __FUNCTION__;
|
QString stdOut = QString::fromLocal8Bit(readAllStandardOutput());
|
||||||
qDebug() << QString::fromLocal8Bit(readAllStandardOutput());
|
|
||||||
|
// get devices serial by adb devices
|
||||||
|
QStringList serials;
|
||||||
|
QStringList devicesInfoList = stdOut.split(QRegExp("\r\n|\n"), QString::SkipEmptyParts);
|
||||||
|
for(QString deviceInfo : devicesInfoList) {
|
||||||
|
QStringList deviceInfos = deviceInfo.split(QRegExp("\t"), QString::SkipEmptyParts);
|
||||||
|
if (2 == deviceInfos.count() && 0 == deviceInfos[1].compare("device")) {
|
||||||
|
serials << deviceInfos[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(this, &QProcess::started, this,
|
connect(this, &QProcess::started, this,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue