Add test script to validate USB UVC - #520
Conversation
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
The shell script verifies the enumeration of USB Video Class devices. Signed-off-by: Aanchal Chaurasia <achauras@qti.qualcomm.com>
6a8f84d to
e89eb2f
Compare
| log_info "Number of /dev/video* nodes found: ${video_node_count:-0}" | ||
|
|
||
| # Pass if the number of /dev/video* nodes is at least the number of detected UVC devices | ||
| if [ "${video_node_count:-0}" -ge "$video_device_count" ] 2>/dev/null; then |
There was a problem hiding this comment.
The final result compares the total number of unique /dev/video* nodes with the total number of UVC devices. This does not prove that every UVC device has a node. For example, one device exposing two nodes and another exposing none produces 2 >= 2 and incorrectly passes.
Track validation per USB device and fail when any detected device has no associated video node. The sibling usb_msd/run.sh test demonstrates the expected per-device tracking pattern.
| for v in "$intf"/video4linux/video*; do | ||
| [ -e "$v" ] || continue | ||
| node="/dev/$(basename "$v")" | ||
| if [ -e "$node" ]; then |
There was a problem hiding this comment.
Sysfs may expose video4linux/video* before udev creates the corresponding /dev/video* node. Checking the node only once makes the test race device enumeration and can produce intermittent false failures. Reuse wait_for_path from Runner/utils/functestlib.sh with a bounded timeout, such as wait_for_path "$node" 5, before declaring the node missing.
|
|
||
| # Check if dependencies are installed, else skip test | ||
| # Include all external utilities used by this script | ||
| deps_list="grep sed sort wc tr readlink head awk" |
There was a problem hiding this comment.
The dependency declaration includes unused head and awk, while the script invokes external basename at line 127 without declaring it. Remove unused dependencies and either declare basename or replace it with shell parameter expansion.
| Running this test on a DUT without a connected USB Video peripheral is expected to FAIL with the message: No 'USB Video Device' found. | ||
|
|
||
| --- | ||
|
|
There was a problem hiding this comment.
Remove trailing whitespaces
The shell script verifies the enumeration of USB Video Class devices.