mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2025-03-01 20:41:32 +08:00
Misc
select available PM3 hardware port when updating the serial port list remove extra empty lines in raw command output by replacing appendPlainText() with insertPlainText() rather than starting the client with QProcess::Text
This commit is contained in:
parent
a9b19f92d6
commit
757fdcfc21
@ -28,7 +28,8 @@ void PM3Process::connectPM3(const QString& path, const QStringList args)
|
||||
currArgs = args;
|
||||
|
||||
// using "-f" option to make the client output flushed after every print.
|
||||
start(path, args, QProcess::Unbuffered | QProcess::ReadWrite | QProcess::Text);
|
||||
// single '\r' might appears. Don't use QProcess::Text there or '\r' is ignored.
|
||||
start(path, args, QProcess::Unbuffered | QProcess::ReadWrite);
|
||||
if(waitForStarted(10000))
|
||||
{
|
||||
waitForReadyRead(10000);
|
||||
|
@ -108,7 +108,8 @@ void MainWindow::on_portSearchTimer_timeout()
|
||||
{
|
||||
QStringList newPortList; // for actural port name
|
||||
QStringList newPortNameList; // for display name
|
||||
// QStringList portList;
|
||||
const QString hint = " *";
|
||||
|
||||
foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
|
||||
{
|
||||
// qDebug() << info.isNull() << info.portName() << info.description() << info.serialNumber() << info.manufacturer();
|
||||
@ -116,7 +117,7 @@ void MainWindow::on_portSearchTimer_timeout()
|
||||
{
|
||||
QString idString = (info.description() + info.serialNumber() + info.manufacturer()).toUpper();
|
||||
QString portName = info.portName();
|
||||
const QString hint = " *";
|
||||
|
||||
newPortList << portName;
|
||||
if(info.hasProductIdentifier() && info.hasVendorIdentifier() && info.vendorIdentifier() == 0x9AC4 && info.productIdentifier() == 0x4B8F)
|
||||
portName += hint;
|
||||
@ -129,8 +130,15 @@ void MainWindow::on_portSearchTimer_timeout()
|
||||
{
|
||||
portList = newPortList;
|
||||
ui->PM3_portBox->clear();
|
||||
int selectId = -1;
|
||||
for(int i = 0; i < portList.size(); i++)
|
||||
{
|
||||
ui->PM3_portBox->addItem(newPortNameList[i], newPortList[i]);
|
||||
if(selectId == -1 && newPortNameList[i].endsWith(hint))
|
||||
selectId = i;
|
||||
}
|
||||
if(selectId != -1)
|
||||
ui->PM3_portBox->setCurrentIndex(selectId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,7 +255,8 @@ void MainWindow::on_PM3_disconnectButton_clicked()
|
||||
void MainWindow::refreshOutput(const QString& output)
|
||||
{
|
||||
// qDebug() << "MainWindow::refresh:" << output;
|
||||
ui->Raw_outputEdit->appendPlainText(output);
|
||||
ui->Raw_outputEdit->moveCursor(QTextCursor::End);
|
||||
ui->Raw_outputEdit->insertPlainText(output);
|
||||
ui->Raw_outputEdit->moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user