Fix a bug

Trying to fix #22
Open client with QProcess::Text for proper newline character(s)
On Raspbian, the isBusy() function will always return false, even the serial port is actually connected.
This commit is contained in:
wh201906
2021-09-05 21:35:03 +08:00
parent 02a8fe03e3
commit 12a0837c50
5 changed files with 25 additions and 19 deletions
+2 -2
View File
@@ -70,10 +70,10 @@ void LF::getConfig()
result = util->execCMDWithOutput("hw status", 400); // not all output from "hw status will be processed".
result = result.right(result.length() - result.indexOf("LF Sampling config"));
offset = result.indexOf("samples to skip");
offset = result.indexOf("\r\n", offset);
offset = result.indexOf("\n", offset);
result = result.mid(0, offset + 2);
qDebug() << "LF CONFIG GET\n" << result;
resultList = result.split("\r\n");
resultList = result.split("\n");
for(int i = 0; i < resultList.length(); i++)
{
for(int j = 0; j < symbolList.length(); j++)
+3 -3
View File
@@ -794,7 +794,7 @@ void Mifare::setParameterC()
QMessageBox::information(parent, tr("Info"), tr("Failed to read card."));
else
{
result.replace("\r\n", "");
result.replace("\n", "");
result.replace(QRegularExpression("\\[.\\]"), "");
result.replace("UID", "");
result.replace("ATQA", "");
@@ -1071,7 +1071,7 @@ bool Mifare::data_loadDataFile(const QString& filename)
else
{
QString tmp = buff.left(cardType.block_size * 34);
QStringList tmpList = tmp.split("\r\n");
QStringList tmpList = tmp.split("\n");
for(int i = 0; i < cardType.block_size; i++)
{
dataList->replace(i, tmpList[i].toUpper());
@@ -1174,7 +1174,7 @@ bool Mifare::data_saveDataFile(const QString& filename, bool isBin)
for(int i = 0; i < cardType.block_size; i++)
{
buff += dataList->at(i);
buff += "\r\n";
buff += "\n";
}
}
bool ret = file.write(buff) != -1;