-
Notifications
You must be signed in to change notification settings - Fork 174
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
udisks2: Be more tolerant of device-startup time #1359
Conversation
@a3f Could you take a look at 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.
LGTM apart from the two comments.
When switching an SDWire to 'host' mode, it may take time for the partition to appear. During that time the device (e.g. '/dev/sdo1') may not exist, so trying to cat e.g. '/sys/call/block/sdo1' fails. Handle this by returning a zero size in that case, as is done when the returned size is empty. Even when the block device is present, udisks2 may take a short time to make the device available. Handle this by retrying a few times, until things settle. Add the call to _wait_for_medium() in write_files() while we are here, to match what is done in write_image(). Also fix the parameter type for write_files() and mention the exception it may raise. Fixes: labgrid-project#1357 Signed-off-by: Simon Glass <[email protected]>
OK, I addressed one and explained the other |
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.
@Emantor Please don't merge this, yet. I'd like to look into this. I suspect the retry mechanism can be implemented more straight forward.
Any word on when you will figure this out? I am able to test things if it helps |
When switching an SDWire to 'host' mode, it may take time for the partition to appear.
During that time the device (e.g. '/dev/sdo1') may not exist, so trying to cat e.g. '/sys/call/block/sdo1' fails. Handle this by returning a zero size in that case, as is done when the returned size is empty.
Even when the block device is present, udisks2 may take a short time to make the device available. Handle this by retrying a few times, until things settle.
Add the call to _wait_for_medium() in write_files() while we are here, to match what is done in write_image(). Also fix the parameter type for write_files() and mention the exception it may raise.
This change has been manually tested since there are no tests available for the code being modified.
Checklist
(I cannot find any tests for USBStorage)
(not needed, I think)
--->
(it seems that these were out-of-sync before my PR)
Fixes: #1357