Skip to content

Commit

Permalink
Read PID's as Hex
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelballantyne authored Jan 31, 2025
1 parent 5e2d2d4 commit 1f0fdad
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions qhookermain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ void qhookerMain::SerialInit()
// Check for duplicates
if (assignedPids.contains(pid)) {
duplicateProductIds = true;
qWarning() << "Duplicate Product ID" << pid
<< "found on device" << info.portName();
qWarning() << "Duplicate Product ID"
<< "0x" + QString::number(pid, 16).toUpper()
<< "found on device" << info.portName();
} else {
assignedPids.insert(pid);
}
Expand All @@ -166,9 +167,12 @@ void qhookerMain::SerialInit()
serialPort[i].setStopBits(QSerialPort::OneStop);
serialPort[i].setFlowControl(QSerialPort::NoFlowControl);

qInfo() << "Assigning" << info.portName()
<< "with PID" << pid
<< "to port no." << (i + 1);
qInfo() << "Assigning"
<< info.portName()
<< "with PID"
<< "0x" + QString::number(pid, 16).toUpper()
<< "to port no."
<< (i + 1);
}

if (duplicateProductIds) {
Expand Down Expand Up @@ -436,11 +440,11 @@ void qhookerMain::PrintDeviceInfo(const QList<QSerialPortInfo> &devices)
qInfo() << "Port Name:" << info.portName();
qInfo() << "Vendor Identifier:"
<< (info.hasVendorIdentifier()
? QString::number(info.vendorIdentifier(), 16)
? "0x" + QString::number(info.vendorIdentifier(), 16).toUpper()
: "N/A");
qInfo() << "Product Identifier:"
<< (info.hasProductIdentifier()
? QString::number(info.productIdentifier()) // decimal instead of base-16
? "0x" + QString::number(info.productIdentifier(), 16).toUpper()
: "N/A");
qInfo() << "========================================";
}
Expand Down

0 comments on commit 1f0fdad

Please sign in to comment.