mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 08:00:06 +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()
|
||||
{
|
||||
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()
|
||||
|
|
@ -225,7 +235,8 @@ void SerialPortDialog::Impl::UpdateModel()
|
|||
static const QStringList headerLabels {
|
||||
tr("Port"), tr("Description"), tr("Device")};
|
||||
#else
|
||||
static const QStringList headerLabels {tr("Port"), tr("Description")};
|
||||
static const QStringList headerLabels {
|
||||
tr("Port"), tr("Location"), tr("Description")};
|
||||
#endif
|
||||
|
||||
// Clear existing serial ports
|
||||
|
|
@ -260,8 +271,11 @@ void SerialPortDialog::Impl::UpdateModel()
|
|||
new QStandardItem(description),
|
||||
new QStandardItem(device)});
|
||||
#else
|
||||
root->appendRow(
|
||||
{new QStandardItem(portName), new QStandardItem(description)});
|
||||
const QString systemLocation = port.second.systemLocation();
|
||||
|
||||
root->appendRow({new QStandardItem(portName),
|
||||
new QStandardItem(systemLocation),
|
||||
new QStandardItem(description)});
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue