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

Fix the insertion of USB3 Gen2x1 device could not being detected (Bugfix) #1438

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

eugene-yujinwu
Copy link
Contributor

Description

We had a usb3 gen2x1 device which used to the type-c usb3 test. But it failed to be detected by checkbox when plug in. The Bug is: The hotplug of a usb-c disk works well but com.canonical.certification::usb-c/insert test failed #1437

The reason of this issue is that the new run_watcher didn't cover this type of usb3 device.

Resolved issues

We had a usb3 gen2x1 device which used to the type-c usb3 test. But it failed to be detected by checkbox when plug in. The Bug is: The hotplug of a usb-c disk works well but com.canonical.certification::usb-c/insert test failed #1437

The reason of this issue is that the new run_watcher didn't cover this type of usb3 device.

Documentation

Tests

Run the usb3-typec insert test:
==============[ Running job 3 / 3. Estimated time left: 0:00:30 ]===============
--------[ USB 3.0 storage device insertion detected on USB Type-C port ]--------
ID: com.canonical.certification::usb-c/insert
Category: com.canonical.plainbox::usb
Purpose:

This test will check that the system correctly detects the insertion of
a USB 3.0 storage device in a USB Type-C connector.
NOTE: Make sure the USB storage device has a partition before starting
the test.

Steps:

  1. Commence the test.
  2. Connect a USB 3.0 storage device to a USB Type-C port.
  3. Do not unplug the device after the test.

Pick an action
=> press ENTER to continue
c => add a comment
s => skip this job
q => save the session and quit
[csq]:
... 8< -------------------------------------------------------------------------

INSERT NOW

Timeout: 30 seconds
super_speed_plus_gen2x1_usb was inserted. Controller: xhci_hcd, Number: 54
usable partition: sda1
USB3 insertion test passed.
cache file usb_insert_info is at: /var/tmp/checkbox-ng/sessions/checkbox-run-2024-08-29T03.21.05.session/session-share
------------------------------------------------------------------------- >8 ---
Outcome: job passed
Finalizing session that hasn't been submitted anywhere: checkbox-run-2024-08-29T03.21.05
==================================[ Results ]===================================
☑ : Collect information about supported types of USB
☑ : Hardware Manifest
☑ : USB 3.0 storage device insertion detected on USB Type-C port

Run the usb3 insert test with usb3 gen1 disk insert:
==============[ Running job 2 / 2. Estimated time left: 0:02:00 ]===============
-----------------[ USB 3.0 storage device insertion detected ]------------------
ID: com.canonical.certification::usb3/insert
Category: com.canonical.plainbox::usb
Purpose:

Check system can detect insertion of a USB 3.0 storage device.
NOTE: Make sure the USB storage device has a partition before starting
the test.

Steps:

  1. Press continue.
  2. Wait until the message "INSERT NOW" is displayed on the screen.
  3. Connect USB 3.0 storage device.

Pick an action
=> press ENTER to continue
c => add a comment
s => skip this job
q => save the session and quit
[csq]:
... 8< -------------------------------------------------------------------------

INSERT NOW

Timeout: 30 seconds
super_speed_usb was inserted. Controller: xhci_hcd, Number: 53
usable partition: sda2
USB3 insertion test passed.
cache file usb_insert_info is at: /var/tmp/checkbox-ng/sessions/checkbox-run-2024-08-29T02.49.03.session/session-share
------------------------------------------------------------------------- >8 ---
Outcome: job passed
Finalizing session that hasn't been submitted anywhere: checkbox-run-2024-08-29T02.49.03
==================================[ Results ]===================================
☑ : Collect information about supported types of USB
☑ : USB 3.0 storage device insertion detected

@eugene-yujinwu eugene-yujinwu force-pushed the fix_usb3_gen2x1_detection branch from d27bc7c to 5a6aab7 Compare August 29, 2024 03:32
Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 45.72%. Comparing base (d725523) to head (5a6aab7).
Report is 118 commits behind head on main.

Files with missing lines Patch % Lines
...ox-support/checkbox_support/scripts/run_watcher.py 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1438      +/-   ##
==========================================
- Coverage   45.72%   45.72%   -0.01%     
==========================================
  Files         367      367              
  Lines       39134    39134              
  Branches     6618     6618              
==========================================
- Hits        17895    17894       -1     
  Misses      20565    20565              
- Partials      674      675       +1     
Flag Coverage Δ
checkbox-support 59.69% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@pieqq pieqq left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, and thanks for the test to make sure it works with your USB-C disk!

@pieqq pieqq merged commit b92edc5 into main Aug 29, 2024
40 of 41 checks passed
@pieqq pieqq deleted the fix_usb3_gen2x1_detection branch August 29, 2024 08:19
@eugene-yujinwu
Copy link
Contributor Author

@pieqq , thank you for your quick review.

@fernando79513
Copy link
Collaborator

fernando79513 commented Sep 16, 2024

Taking a look at this issue I saw that there is an error in the "insertion" condition.
Explanation
The line:

python
Copy code
if "USB Mass Storage device detected" or "uas" in line_str:
does not work as intended because of the way Python evaluates conditional expressions. Here's what's happening step by step:

Expression Evaluation Order:

Python evaluates "USB Mass Storage device detected" first.
Since non-empty strings are considered True in a boolean context, "USB Mass Storage device detected" evaluates to True.
Therefore, the entire expression before the or operator is True.

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.

3 participants