CommPort: keep device names seperate

CommPort::name used to prefix the actual device name/path with the actual
device type to make it unique. This is used in DownloadRideDialog to map
the device dropdown list to the actual device.

This patch seperates name + device type to make the hack in SrmDevice a
bit less ugly: srmio doesn't use the built in CommPort abstraction and
needs the unmodified device names. This is still ugly, but I can't come up
with anything better (... for now).
This commit is contained in:
Rainer Clasen
2011-07-20 21:05:14 +02:00
parent da7ae868ed
commit e1f2128e27
6 changed files with 32 additions and 13 deletions

View File

@@ -78,13 +78,11 @@ struct SrmioData : public boost::noncopyable
static bool
dev2path(CommPortPtr dev, QString &path, QString &err)
{
// Read device path out of device name. Sketchy.
QRegExp rx("^Serial: (.+)$");
if (!rx.exactMatch(dev->name())) {
err = "SRM download not supported by device " + dev->name();
if ( dev->type() == "Serial" ) {
err = "SRM download not supported by device " + dev->id();
return false;
}
path = rx.cap(1);
path = dev->name();
return true;
}