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
factory: allow --force mode to find already flashed devices #236
Conversation
Also improve debug logging in GlasgowHardwareDevice._enumerate_devices()
try: | ||
device = GlasgowHardwareDevice(args.serial, _factory_rev=args.factory_rev) | ||
except GlasgowDeviceError as e: | ||
if args.force and str(e) == "device not found": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ew. No.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the exact problem?
Do you want an explicit GlasgowDeviceNotFound exception? Yes, I admit the string comparison is a bit hacky.
Or do you want to change the search algo in GlasgowHardwareDevice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or do you want to change the search algo in GlasgowHardwareDevice?
I'm going to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me implement this in a better way.
This doesn't actually defeat the purpose of the |
Flashing devices in recovery mode doesn't work without this change too. Because once the firmware is loaded into the ram of the FX2, the firmware reads the flashed revision there and reports as that when re-enumerating. |
You're right. I think there was a change to the enumeration algorithm somewhere in the meantime that broke this functionality. |
Without this change, the call to GlasgowHardwareDevice._enumerate_devices() would only return devices which do not have a revision set yet. This defeats the purpose of the --force flag to allow reflashing them.
Also improve debug logging in GlasgowHardwareDevice._enumerate_devices(). I needed this to find the problem and I think it could help in similar situations.