Currently, the device name normalization process in libdivecomputer has some limitations when matching Bluetooth device names to device descriptors:
-
Device descriptors use short names (e.g. "D5") while Bluetooth devices broadcast longer names with manufacturer prefix and serial numbers (e.g. "Suunto D5 12345678")
-
The find_matching_descriptor() function fails to match these longer names because it looks for exact matches with the product names in the descriptor list
-
The fallback string parsing in normalizeDeviceType() is basic and may not handle all manufacturer naming patterns correctly
Example cases:
- Suunto: "Suunto D5 12345678" should match descriptor "D5"
- Shearwater: "Petrel 2 1234" should match "Petrel 2"
- Mares: "Mares Genius 5678" should match "Genius"
Suggested improvements:
-
Add manufacturer-specific name parsing rules that understand common patterns:
- Known manufacturer prefixes ("Suunto ", "Mares ", etc.)
- Serial number patterns (trailing digits/hex)
- Model variants (e.g. "2", "Air", "Pro")
-
Update the descriptor matching to:
- Try exact matches first
- Then try matching without manufacturer prefix
- Then try matching the normalized name
- Consider fuzzy matching for close matches
-
Add test cases for various real-world device name formats
This would improve the reliability of device identification, especially for Bluetooth devices where we have less control over the advertised names.
Related files:
- src/descriptor.c
- include/descriptor.h
Currently, the device name normalization process in libdivecomputer has some limitations when matching Bluetooth device names to device descriptors:
Device descriptors use short names (e.g. "D5") while Bluetooth devices broadcast longer names with manufacturer prefix and serial numbers (e.g. "Suunto D5 12345678")
The
find_matching_descriptor()function fails to match these longer names because it looks for exact matches with the product names in the descriptor listThe fallback string parsing in
normalizeDeviceType()is basic and may not handle all manufacturer naming patterns correctlyExample cases:
Suggested improvements:
Add manufacturer-specific name parsing rules that understand common patterns:
Update the descriptor matching to:
Add test cases for various real-world device name formats
This would improve the reliability of device identification, especially for Bluetooth devices where we have less control over the advertised names.
Related files: