descriptor: make dc_filter_suunto descriptor-specific for each EON Steel model - #142
Conversation
…eel model The filter previously ignored the descriptor parameter and checked USB HID PID or BLE name prefix against the entire family's combined list. This caused all four EON Steel descriptors (EON Steel, EON Core, D5, EON Steel Black) to match any Suunto EONSTEEL family device, preventing automatic model selection. Refactor to index each flat array by dc_descriptor_get_model(descriptor) so only the descriptor that corresponds to the connected device's USB PID or BLE name prefix matches. Unknown model numbers return 0 (no match). The two data arrays are left in the same form as upstream so that upstream additions of new models merge cleanly. This affects only the device selector presented to the user before a download begins. The import process itself is unchanged: the Suunto EON Steel driver echoes the descriptor model number back in DC_EVENT_DEVINFO, so the coarse-model refinement path in the consumer never fires, and the hw_id field is never populated, so the hw_id refinement path is also a no-op. A user who selects the correct model manually sees no difference in behaviour. The benefit is for automatic descriptor selection, which now returns exactly one match instead of four. Signed-off-by: Michael Keller <github@ike.ch>
| return dc_match_usbhid (userdata, &usbhid[model]); | ||
| } else if (transport == DC_TRANSPORT_BLE) { | ||
| return DC_FILTER_INTERNAL (userdata, bluetooth, 0, dc_match_prefix); | ||
| return dc_match_prefix (userdata, &bluetooth[model]); |
|
Thanks for the review. The BLE prefix ambiguity is technically real in isolation, but the concern does not apply to this PR.
Subsurface maps BLE device names to descriptors via its own prefix table in The PR also does not make the BLE situation worse than before: the old code passed all four BLE entries to The fix targets the USB HID path, which uses exact PID matching and is unambiguous after this change. |

The filter previously ignored the descriptor parameter and checked USB HID
PID or BLE name prefix against the entire family's combined list. This
caused all four EON Steel descriptors (EON Steel, EON Core, D5, EON Steel
Black) to match any Suunto EONSTEEL family device, preventing automatic
model selection.
Refactor to index each flat array by dc_descriptor_get_model(descriptor)
so only the descriptor that corresponds to the connected device's USB PID
or BLE name prefix matches. Unknown model numbers return 0 (no match).
The two data arrays are left in the same form as upstream so that upstream
additions of new models merge cleanly.
This affects only the device selector presented to the user before a
download begins. The import process itself is unchanged: the Suunto EON
Steel driver echoes the descriptor model number back in DC_EVENT_DEVINFO,
so the coarse-model refinement path in the consumer never fires, and the
hw_id field is never populated, so the hw_id refinement path is also a
no-op. A user who selects the correct model manually sees no difference
in behaviour. The benefit is for automatic descriptor selection, which
now returns exactly one match instead of four.