diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-05-14 12:15:24 -0700 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2020-05-15 02:49:46 +0300 |
commit | 658089d763c1e9e953f5c06b01d028613408138b (patch) | |
tree | 658c0c14547e36a940f2b0a927c626b3505d939b /core/btdiscovery.cpp | |
parent | 62e95fdc8656a0c8fdb181c3fe0a48e043650a05 (diff) | |
download | subsurface-658089d763c1e9e953f5c06b01d028613408138b.tar.gz |
core/bt: match DC descriptor in lower case
This fixes a rather subtle bug.
In btdiscovery.cpp we are detecting dive computers based on their BT name and
are setting up product+vendor as the key for that lookup. QMap always uses case
sensitive comparisons and a tiny inconsistency snuck into our code.
libdivecomputer names for the Aqualung dive computers i200C / i300C / i550C end
in an upper case C (as matches the official branding), but in btdiscovery.cpp
we have those names with lower case c. And therefore didn't recognize these
dive computers.
Obviously this is easy to fix by fixing those three strings, but I decided that
it was silly to set ourselves up for similar oversights in the future. So
instead I switched the matching of the descriptor to simply be allways all
lower case.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/btdiscovery.cpp')
-rw-r--r-- | core/btdiscovery.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp index b70330410..298c0408c 100644 --- a/core/btdiscovery.cpp +++ b/core/btdiscovery.cpp @@ -83,16 +83,16 @@ static dc_descriptor_t *getDeviceType(QString btName) // number. The model code matches the hex model (so "FQ" is 0x4651, // where 'F' is 46h and 'Q' is 51h in ASCII). vendor = "Aqualung"; - product = "i200c"; + product = "i200C"; } else if (btName.contains(QRegularExpression("^FH\\d{6}$"))) { vendor = "Aqualung"; - product = "i300c"; + product = "i300C"; } else if (btName.contains(QRegularExpression("^FQ\\d{6}$"))) { vendor = "Aqualung"; product = "i770R"; } else if (btName.contains(QRegularExpression("^FR\\d{6}$"))) { vendor = "Aqualung"; - product = "i550c"; + product = "i550C"; } else if (btName.contains(QRegularExpression("^ER\\d{6}$"))) { vendor = "Oceanic"; product = "Pro Plus X"; @@ -111,7 +111,7 @@ static dc_descriptor_t *getDeviceType(QString btName) // check if we found a known dive computer if (!vendor.isEmpty() && !product.isEmpty()) { - dc_descriptor_t *lookup = descriptorLookup.value(vendor + product); + dc_descriptor_t *lookup = descriptorLookup.value(vendor.toLower() + product.toLower()); if (!lookup) qWarning("known dive computer %s not found in descriptorLookup", qPrintable(QString(vendor + product))); return lookup; |