Skip to content

Fix device_info rewrite for devices that omit product (COROS DURA) — fixes #80 - #86

Open
nothingshocking wants to merge 2 commits into
jat255:mainfrom
nothingshocking:fix-80
Open

nothingshocking wants to merge 2 commits into
jat255:mainfrom
nothingshocking:fix-80

Conversation

@nothingshocking

Copy link
Copy Markdown

Fixes #80.

Problem

The COROS DURA writes a device_info record containing only manufacturer (294)
and a text product_name. It has no numeric product, device_index,
serial_number, or source_type. The existing rewrite only overwrites product
when it is already present, so the output has manufacturer=GARMIN with no product,
and Garmin Connect shows no device for the activity.

Simply removing the is not None guard isn't enough: a parsed message's fields are
bound to the source definition, so assigning a field that wasn't defined raises
Field is not growable.

Fix

When a device_info record being modified has no product/garmin_product:

  • Rebuild it as a fresh DeviceInfoMessage (same approach as the FileIdMessage
    rewrite), copying all populated fields across.
  • Set product to the profile's target device.
  • Fill device_index=0 (creator), source_type=local, and serial_number (from the
    profile, falling back to the existing default) if absent, so Garmin Connect
    recognises the record as the recording device.

Records that already carry a product (e.g. Hammerhead Karoo) go through the existing
code path unchanged.

Testing

  • Two regression tests added in tests/test_fit_editor.py (synthetic DURA-style files).
  • Full suite: all pass except test_show_dirs_flag_with_garmin_dirs, which also fails
    on unmodified main in my environment.
  • Real device: re-uploaded a COROS DURA activity (Aug 4, 2026). Before: no device in
    Garmin Connect. After: shows Edge 830. Karoo activities upload unchanged (409
    duplicate as expected).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FIT File Issue]: Coros Dura FIT files upload successfully but no gear assigned in Garmin Connect

1 participant