Garmin: Add MTP Support for More Models.#82
Merged
mikeller merged 1 commit intosubsurface:Subsurface-DS9from Jul 2, 2025
Merged
Garmin: Add MTP Support for More Models.#82mikeller merged 1 commit intosubsurface:Subsurface-DS9from
mikeller merged 1 commit intosubsurface:Subsurface-DS9from
Conversation
bcc993d to
2127a7e
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
Add MTP support for additional Garmin Descent models by centralizing model metadata and leveraging a shared model list in both the parser and device code.
- Introduce a
garmin_model_tstruct (including anmtp_capableflag) and declare a globalgarmin_modelsarray in the header. - Update
src/garmin_parser.cto use the sharedgarmin_modelsarray instead of a local static list. - Enhance MTP detection logic in
src/garmin.cto iterate overgarmin_modelsand skip non-MTP-capable devices.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/garmin_parser.c | Removed local models[] array, replaced with garmin_models lookup. |
| src/garmin.h | Added garmin_model_t definition (with mtp_capable) and extern array. |
| src/garmin.c | Defined garmin_models with MTP flags, updated product-ID checks. |
Comments suppressed due to low confidence (2)
src/garmin_parser.c:1667
- [nitpick] The loop index variable 'i' is not descriptive. Consider renaming it to something like 'model_index' for clarity.
unsigned i;
src/garmin.h:39
- Consider adding a comment explaining what the 'mtp_capable' flag represents and how it should be used, to improve code self-documentation.
bool mtp_capable;
|
|
||
| bool mtp_capable = false; | ||
| for (unsigned j = 0; garmin_models[j].name; j++) { | ||
| if ((garmin_models[j].id | 0x4000) == rawdevices[i].device_entry.product_id) { |
There was a problem hiding this comment.
Magic number 0x4000 is used to derive the USB product ID flag. Consider defining a named constant (e.g., USB_MTP_FLAG) to improve readability and maintainability.
Suggested change
| if ((garmin_models[j].id | 0x4000) == rawdevices[i].device_entry.product_id) { | |
| if ((garmin_models[j].id | USB_MTP_FLAG) == rawdevices[i].device_entry.product_id) { |
2127a7e to
6a2fbe4
Compare
Add MTP support for more of the newer Garmin Descent models. Signed-off-by: Michael Keller <github@ike.ch>
6a2fbe4 to
fc2ff86
Compare
theCarlG
pushed a commit
to theCarlG/libdc
that referenced
this pull request
Jul 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add MTP support for more of the newer Garmin Descent models.