mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-07-31 12:58:39 +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);
|
||||
}
|
||||
|
||||
qDebug() << ">>>>>>>>" << __FUNCTION__;
|
||||
qDebug() << "adb return " << exitCode << "exit status " << exitStatus;
|
||||
});
|
||||
|
||||
|
@ -61,14 +60,22 @@ void AdbProcess::initSignals()
|
|||
|
||||
connect(this, &QProcess::readyReadStandardError, this,
|
||||
[this](){
|
||||
qDebug() << ">>>>>>>>" << __FUNCTION__;
|
||||
qDebug() << QString::fromLocal8Bit(readAllStandardError());
|
||||
});
|
||||
|
||||
connect(this, &QProcess::readyReadStandardOutput, this,
|
||||
[this](){
|
||||
qDebug() << ">>>>>>>>" << __FUNCTION__;
|
||||
qDebug() << QString::fromLocal8Bit(readAllStandardOutput());
|
||||
QString stdOut = 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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue