-
Notifications
You must be signed in to change notification settings - Fork 17
Add test script to validate USB Host mode #33
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
Runner/suites/Kernel/FunctionalArea/baseport/USBHost/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
``` | ||
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
SPDX-License-Identifier: BSD-3-Clause-Clear | ||
``` | ||
|
||
# USB Host Mode Validation | ||
|
||
## Overview | ||
|
||
This shell script executes on the DUT (Device-Under-Test) and verifies enumeration of connected USB devices. | ||
|
||
--- | ||
|
||
## Setup | ||
|
||
- Connect USB peripheral(s) to USB port(s) on DUT. | ||
- Only applicable for USB ports that support Host Mode functionality. | ||
- USB peripherals examples: Mass Storage devices (pendrives, SSD, hard drives, etc.), HID devices (Mouse, Keyboard, USB headset, USB camera, etc.) | ||
|
||
--- | ||
|
||
## License | ||
|
||
``` | ||
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
SPDX-License-Identifier: BSD-3-Clause-Clear | ||
``` |
45 changes: 45 additions & 0 deletions
45
Runner/suites/Kernel/FunctionalArea/baseport/USBHost/run.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/sh | ||
|
||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
# SPDX-License-Identifier: BSD-3-Clause-Clear | ||
|
||
#Setup requires at least one USB peripheral connected to USB port that supports Host mode function | ||
achauras-qcom marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Import test suite definitions | ||
. "${PWD}"/init_env | ||
TESTNAME="USBHost" | ||
|
||
#import test functions library | ||
. "${TOOLS}"/functestlib.sh | ||
test_path=$(find_test_case_by_name "$TESTNAME") | ||
log_info "-----------------------------------------------------------------------------------------" | ||
log_info "-------------------Starting $TESTNAME Testcase----------------------------" | ||
|
||
log_info "Running USB Host enumeration test" | ||
|
||
# Check if lsusb is installed | ||
check_dependencies lsusb | ||
|
||
# Run lsusb and capture output | ||
usb_output=$(lsusb) | ||
device_count=$(echo "$usb_output" | wc -l) | ||
|
||
# Filter out USB hubs | ||
non_hub_count=$(echo "$usb_output" | grep -vi "hub" | wc -l) | ||
|
||
echo "Enumerated USB devices..." | ||
echo "$usb_output" | ||
|
||
# Check if any USB devices were found | ||
if [ "$device_count" -eq 0 ]; then | ||
log_fail "$TESTNAME : Test Failed - No USB devices found." | ||
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res | ||
elif [ "$non_hub_count" -eq 0 ]; then | ||
log_fail "$TESTNAME : Test Failed - Only USB hubs detected, no functional USB devices." | ||
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res | ||
else | ||
log_pass "$TESTNAME : Test Passed - $non_hub_count non-hub USB device(s) found." | ||
echo "$TESTNAME PASS" > $test_path/$TESTNAME.res | ||
fi | ||
|
||
log_info "-------------------Completed $TESTNAME Testcase----------------------------" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.