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

factory: allow --force mode to find already flashed devices #236

Closed
wants to merge 1 commit into from

Conversation

electroniceel
Copy link
Member

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.

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":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ew. No.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member

@whitequark whitequark left a 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.

@whitequark
Copy link
Member

This defeats the purpose of the --force flag to allow reflashing them.

This doesn't actually defeat the purpose of the --force flag since it is there to allow flashing devices in recovery mode. But I agree that we can extend the meaning of the flag to cover the case you've encountered.

@electroniceel
Copy link
Member Author

This defeats the purpose of the --force flag to allow reflashing them.

This doesn't actually defeat the purpose of the --force flag since it is there to allow flashing devices in recovery mode. But I agree that we can extend the meaning of the flag to cover the case you've encountered.

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.

@whitequark
Copy link
Member

Flashing devices in recovery mode doesn't work without this change too.

You're right. I think there was a change to the enumeration algorithm somewhere in the meantime that broke this functionality.

@whitequark whitequark deleted the fix-factory-force branch November 21, 2020 22:35
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.

None yet

2 participants