mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:10:04 +00:00
Use serial port location on Linux instead of port name
This commit is contained in:
parent
2029806a5f
commit
0683cd2326
1 changed files with 18 additions and 4 deletions
|
|
@ -168,7 +168,17 @@ SerialPortDialog::~SerialPortDialog()
|
||||||
|
|
||||||
std::string SerialPortDialog::serial_port()
|
std::string SerialPortDialog::serial_port()
|
||||||
{
|
{
|
||||||
return p->selectedSerialPort_;
|
std::string serialPort = p->selectedSerialPort_;
|
||||||
|
|
||||||
|
#if !defined(_WIN32)
|
||||||
|
auto it = p->portInfoMap_.find(p->selectedSerialPort_);
|
||||||
|
if (it != p->portInfoMap_.cend())
|
||||||
|
{
|
||||||
|
serialPort = it->second.systemLocation().toStdString();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return serialPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SerialPortDialog::baud_rate()
|
int SerialPortDialog::baud_rate()
|
||||||
|
|
@ -225,7 +235,8 @@ void SerialPortDialog::Impl::UpdateModel()
|
||||||
static const QStringList headerLabels {
|
static const QStringList headerLabels {
|
||||||
tr("Port"), tr("Description"), tr("Device")};
|
tr("Port"), tr("Description"), tr("Device")};
|
||||||
#else
|
#else
|
||||||
static const QStringList headerLabels {tr("Port"), tr("Description")};
|
static const QStringList headerLabels {
|
||||||
|
tr("Port"), tr("Location"), tr("Description")};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clear existing serial ports
|
// Clear existing serial ports
|
||||||
|
|
@ -260,8 +271,11 @@ void SerialPortDialog::Impl::UpdateModel()
|
||||||
new QStandardItem(description),
|
new QStandardItem(description),
|
||||||
new QStandardItem(device)});
|
new QStandardItem(device)});
|
||||||
#else
|
#else
|
||||||
root->appendRow(
|
const QString systemLocation = port.second.systemLocation();
|
||||||
{new QStandardItem(portName), new QStandardItem(description)});
|
|
||||||
|
root->appendRow({new QStandardItem(portName),
|
||||||
|
new QStandardItem(systemLocation),
|
||||||
|
new QStandardItem(description)});
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue