Fix: port friendly name encoding

This commit is contained in:
Vojtech Kral 2018-07-25 16:54:02 +02:00 committed by bubnikv
parent f729ab4b12
commit a9aca4426c

View File

@ -132,7 +132,7 @@ void FirmwareDialog::priv::find_serial_ports()
this->ports = new_ports; this->ports = new_ports;
port_picker->Clear(); port_picker->Clear();
for (const auto &port : this->ports) for (const auto &port : this->ports)
port_picker->Append(port.friendly_name); port_picker->Append(wxString::FromUTF8(port.friendly_name.data()));
if (ports.size() > 0) { if (ports.size() > 0) {
int idx = port_picker->GetValue().IsEmpty() ? 0 : -1; int idx = port_picker->GetValue().IsEmpty() ? 0 : -1;
for (int i = 0; i < (int)this->ports.size(); ++ i) for (int i = 0; i < (int)this->ports.size(); ++ i)
@ -354,10 +354,11 @@ void FirmwareDialog::priv::perform_upload()
int selection = port_picker->GetSelection(); int selection = port_picker->GetSelection();
if (selection == wxNOT_FOUND) { return; } if (selection == wxNOT_FOUND) { return; }
std::string port_selected = port_picker->GetValue().ToStdString();
const SerialPortInfo &port = this->ports[selection]; const SerialPortInfo &port = this->ports[selection];
// Verify whether the combo box list selection equals to the combo box edit value. // Verify whether the combo box list selection equals to the combo box edit value.
if (this->ports[selection].friendly_name != port_selected) { return; } if (wxString::FromUTF8(this->ports[selection].friendly_name.data()) != port_picker->GetValue()) {
return;
}
const bool extra_verbose = false; // For debugging const bool extra_verbose = false; // For debugging
HexFile metadata(filename.wx_str()); HexFile metadata(filename.wx_str());