Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix two issues preventing Garmin devices working #1

Merged
merged 2 commits into from
Nov 1, 2022

Conversation

CodyJung
Copy link

Fixes a couple of implementation issues preventing Garmin devices working correctly with OpenMTP (ganeshrvel/openmtp#153).

First, Garmin devices don't typically populate all three device descriptors - usually only the SerialNumber string is available. Previously, we would fail early if any string was unavailable.

Second, Garmin devices separate the header from payload during the data phase. It seems like we previously assumed that if that were the case then the packet would be full, but that's not necessarily true. I've added a check so if we read less than the size the device has said it's going to send, that will also trigger a bulk read of the payload.

Note:
This code was committed on a different computer than was developed, so it probably needs secondary verification. Also, I'm not a Go developer so this may need formatting/rewriting to conform to Go standards.

All three device descriptor strings are technically optional. Rather than
returning an error when one is empty, continue to iterate through the rest.
When dealing with a separate header and payload, make sure that we
do not expect to receive additional USB packet headers in the payload portion of
the transfer. Previously, we were assuming that this would only occur when the
device was sending more than a full packet's worth of data, but this is not correct -
we should continue the bulk transfer any time the device sends us less data than
the header says it will be sending.
@ganeshrvel
Copy link
Owner

ganeshrvel commented Jul 25, 2022

Awesome, Thanks for putting the effort. I am in middle of adding apple silicone support. I will run the tests on my devices and will approve this pr.

Thanks again.

@ganeshrvel ganeshrvel changed the base branch from master to fix/garmin-fujifilm November 1, 2022 15:23
@ganeshrvel ganeshrvel merged commit b7906e7 into ganeshrvel:fix/garmin-fujifilm Nov 1, 2022
@ganeshrvel
Copy link
Owner

Thank you for the PRs. Merged them.

Shall be releasing a beta release of OpenMTP tonight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants