Avoid timing out when looking for a Garmin programmer after an FW update

#54 · closed · 3 comments

View on GitHub ↗

zyv

> > I'm noticing is that jdmtool always downgrades my FW to 3.02 upon the first connect, and then re-upgrades it to FW 3.05 after re-connect, which is very annoying. But this seems to be a different bug. Maybe I should create another issue for it. > > That part is correct, actually: the Garmin programmer is just a Cypress EZ-USB FX2 development board with no Garmin firmware at all, _and_ its "bootloader" cannot even handle writing the 3.05 firmware for some reason. So it needs to be loaded with 3.02 first, then 3.05. That's also what GADM's USB drivers do. > > The bug is actually that jdmtool times out waiting for the device to reconnect; it should write both firmwares in one step. You can file a new issue for that one. (Really, just need to update [this code](https://github.com/dimaryaz/jdmtool/blob/main/src/jdmtool/data_card/detect.py#L147-L148).) _Originally posted by @dimaryaz in [#52](https://github.com/dimaryaz/jdmtool/issues/52#issuecomment-3284211525)_

Comments

dimaryaz

Heh, I can sometimes repro this issue on OS X - but somehow, retrying the `open()` call doesn't help; only rescanning does. But it makes it annoying to come up with a clean fix.

dimaryaz

@zyv: Could you try #59 and see if it works for you? (I don't really like the `time.sleep`, there seems to be no way to know if the device is fully reconnected or not. Even opening it and reading its firmware version doesn't guarantee that it won't disappear again.)

zyv

You could make it 3 seconds for a round number ;) I will try this with the next cycle in a week's time. Thank you!