summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2022-03-14 20:15:51 +0100
committerBenjamin Berg <bberg@redhat.com>2022-05-17 20:29:00 +0200
commit7b0093b4c6703e04ffec89be4c190b9a00ad5b9a (patch)
treeec9ad024233063543703fd8f8f79faf5b9cde6f9 /tests
parent0fd5a617ab75026601cf17dc7d80f3d68a8027d5 (diff)
tests: Reset the USB device before testing
The kernel caches URBs to get descriptor values. Doing a reset before starting the record ensures that we will see any descriptor reads in the usbmon trace and can therefore correctly replay them (possibly not true if they happen multiple times).
Diffstat (limited to 'tests')
-rwxr-xr-xtests/create-driver-test.py.in5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/create-driver-test.py.in b/tests/create-driver-test.py.in
index 3eabb78..8173271 100755
--- a/tests/create-driver-test.py.in
+++ b/tests/create-driver-test.py.in
@@ -105,6 +105,11 @@ process.wait()
# Run capture
# https://osqa-ask.wireshark.org/questions/53919/how-can-i-precisely-specify-a-usb-device-to-capture-with-tshark/
+print(f'### Reseting USB port (as descriptors could be missing in the dump otherwise)')
+usb_device.open()
+usb_device.reset()
+usb_device.close()
+
print(f'### Starting USB capture on usbmon{bus_num}')
capture_pid = os.fork()
assert(capture_pid >= 0)