-
Notifications
You must be signed in to change notification settings - Fork 210
usbstoragedriver: Allow to define a different waiting medium timeout #1711
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
base: master
Are you sure you want to change the base?
usbstoragedriver: Allow to define a different waiting medium timeout #1711
Conversation
labgrid/driver/usbstoragedriver.py
Outdated
|
||
def __attrs_post_init__(self): | ||
super().__attrs_post_init__() | ||
self._expect = PtxExpect(self) |
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.
This is totally unused, why was this added?
f209948
to
ecb0d50
Compare
labgrid/driver/usbstoragedriver.py
Outdated
WAIT_FOR_MEDIUM_TIMEOUT = 10.0 # s | ||
timeout = attr.ib(default=0.0, validator=attr.validators.instance_of(float)) | ||
default=10.0, | ||
validator=attr.validators.instance_of(float)) |
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.
Two timeouts and two validators does not look like valid python code.
@@ -39,15 +39,22 @@ class USBStorageDriver(Driver): | |||
"NetworkUSBSDWireDevice", | |||
}, | |||
} | |||
|
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.
Stray newline, please remove it.
WAIT_FOR_MEDIUM_SLEEP = 0.5 # s | ||
MOUNT_RETRIES = 5 | ||
|
||
def __attrs_post_init__(self): | ||
if self.timeout < 0.0: | ||
raise ValueError("timeout must be positive") |
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.
This should be moved into the validation function for attrs.
Nice to have a way to define a timeout for usb storage driver if it used after a usb switch. This will make this code more simpler mux_driver = target.get_driver('LXAUSBMuxDriver') mux_driver.set_links(['host-device']) time.sleep(3) <-- avoid to use a new sleep here usb = target.get_driver('USBStorageDriver') assert usb.get_size() > 0 Signed-off-by: Michael Trimarchi <[email protected]>
ecb0d50
to
6bf4032
Compare
Nice to have a way to define a timeout for usb storage driver if it used after a usb switch. This will make this code more simpler
mux_driver = target.get_driver('LXAUSBMuxDriver')
mux_driver.set_links(['host-device'])
time.sleep(3) <-- avoid to use a new sleep here
usb = target.get_driver('USBStorageDriver')
assert usb.get_size() > 0
Let's consider this as first interaction with the project. Could be that somenthing is missing here and there. It's more an RFC patch