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>
This commit is contained in:
Dirk Hohndel 2020-05-14 12:15:24 -07:00 committed by Lubomir I. Ivanov
parent 62e95fdc86
commit 658089d763
5 changed files with 13 additions and 11 deletions

View file

@ -908,7 +908,7 @@ void ConfigureDiveComputerDialog::getDeviceData()
device_data.vendor = copy_qstring(selected_vendor);
device_data.product = copy_qstring(selected_product);
device_data.descriptor = descriptorLookup.value(selected_vendor + selected_product);
device_data.descriptor = descriptorLookup.value(selected_vendor.toLower() + selected_product.toLower());
device_data.deviceid = device_data.diveid = 0;
qPrefDiveComputer::set_device(device_data.devname);