Add test script to validate USB UAC#266
Conversation
6877bdd to
9f1040f
Compare
smuppand
left a comment
There was a problem hiding this comment.
Commit ordering / path inconsistency (important for clean history)
Create files directly in Runner/suites/Kernel/Baseport/USB/usb_uac/ from patch 1 onward, and drop patch 4/4 entirely.
Alternative:
Move patch 4/4 earlier (as 1/4), then add script/README/YAML into the final location.
9f1040f to
402263a
Compare
| audio_device_count=$( | ||
| for f in /sys/bus/usb/devices/*/bInterfaceClass; do | ||
| [ -r "$f" ] || continue | ||
| if grep -qx '01' "$f"; then |
There was a problem hiding this comment.
Validate more than bInterfaceClass == 01
| # Count uniques devices with bInterfaceClass = 01 (UAC) under /sys/bus/usb/devices | ||
| audio_device_count=0 | ||
| log_info "=== USB Audio device Detection ===" | ||
| audio_device_count=$( |
There was a problem hiding this comment.
Add ALSA/device-node checks (/dev/snd, /proc/asound/cards, aplay -l, arecord -l where available)
Print detected UAC device details (VID:PID, product, device path)
| log_info "=== Test Initialization ===" | ||
|
|
||
| # Check if grep is installed, else skip test | ||
| deps_list="grep sed sort wc" |
| done 2>/dev/null | sed 's/:.*$//' | sort -u | wc -l | tr -d '[:space:]' | ||
| ) | ||
|
|
||
| log_info "Number of USB audio devices found: $audio_device_count" |
There was a problem hiding this comment.
Distinguish playback-only vs capture-only devices and also log bound driver info from sysfs
|
|
||
| - Connect USB Audio peripheral(s) to USB port(s) on DUT. | ||
| - Only applicable for USB ports that support Host Mode functionality. | ||
| - USB Audio peripherals examples: USB headset, microphone, sound card, etc. |
There was a problem hiding this comment.
Improve README to clarify exact validation scope
| echo "$TESTNAME PASS" > "$RES_FILE" | ||
| exit 0 | ||
| else | ||
| log_fail "$TESTNAME : Test Failed - No 'USB Audio Device' found" |
There was a problem hiding this comment.
Consider whether “no UAC device attached” should be FAIL or SKIP
402263a to
63b743c
Compare
63b743c to
2431fc7
Compare
|
Output for UAC device connected: DEVICE VID:PID PRODUCT1-1 04e8:a05e Samsung USB C Earphones [INFO] ALSA cards (/proc/asound/cards): |
smuppand
left a comment
There was a problem hiding this comment.
squash it to one commit.
|
|
||
| # Default result file (works even before functestlib is available) | ||
| # shellcheck disable=SC2034 | ||
| RES_FILE="$SCRIPT_DIR/${TESTNAME}.res" |
There was a problem hiding this comment.
current default is ./${TESTNAME}.res, so early SKIP paths before cd "$test_path" can write the result file into an unexpected working directory.
There was a problem hiding this comment.
Skip paths before cd "$test_path" could reliably write result file in "$SCRIPT_DIR", please correct me if my understanding is wrong. Does default result file need to be changed to "./${TESTNAME}.res" instead of "$SCRIPT_DIR/${TESTNAME}.res"?
There was a problem hiding this comment.
Skip paths before cd "$test_path" could reliably write result file in "$SCRIPT_DIR", please correct me if my understanding is wrong. Does default result file need to be changed to "./${TESTNAME}.res" instead of "$SCRIPT_DIR/${TESTNAME}.res"?
Yes, your understanding is correct.
Using:
RES_FILE="$SCRIPT_DIR/${TESTNAME}.res"
is better for the early SKIP paths before cd "$test_path" because the script may be launched from any working directory. If we used:
RES_FILE="./${TESTNAME}.res"
then early failures such as missing init_env could write the result into the caller's current directory instead of the testcase directory.
There was a problem hiding this comment.
Using RES_FILE="$SCRIPT_DIR/${TESTNAME}.res" for early skip paths in the script
| sys="/sys/bus/usb/devices/$dev" | ||
| vid=$([ -r "$sys/idVendor" ] && tr -d '[:space:]' < "$sys/idVendor" || echo -) | ||
| pid=$([ -r "$sys/idProduct" ] && tr -d '[:space:]' < "$sys/idProduct" || echo -) | ||
| if [ -r "$sys/product" ]; then |
There was a problem hiding this comment.
when a UAC interface enumerates but ALSA integration is incomplete, we still lose useful debug context in CI logs. Add a DRIVER column and populate it from the relevant interface driver symlink in sysfs.
DEVICE VID:PID DRIVER PRODUCT
1-1 04e8:a05e snd-usb-audio Samsung USB C Earphones
There was a problem hiding this comment.
Added driver info as well for each UAC device.
| missing_nodes=1 | ||
| fi | ||
| if [ "$has_pcm_p" -ne 1 ] && [ "$has_pcm_c" -ne 1 ]; then | ||
| log_fail "Missing ALSA PCM device(s) for card $c (no playback or capture node found)" |
There was a problem hiding this comment.
tighten PASS to require all detected UAC-backed ALSA cards to have playback/capture nodes, or
at least log an explicit ratio such as usable ALSA USB cards: X/Y so partial failures are visible.
There was a problem hiding this comment.
Added missing nodes info for each UAC device as part of debug logs and also logging explicit ratio of usable ALSA USB cards.
The shell script verifies the enumeration of USB Audio Class devices. Signed-off-by: Aanchal Chaurasia <achauras@qti.qualcomm.com>
2431fc7 to
eaf38ac
Compare
The shell script verifies the enumeration of USB Audio Devices connected to DUT.