From 92fc4e48a0be7d8ee5d19c03829e83e0b463ad74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAanchal?= Date: Thu, 22 Jan 2026 15:56:04 +0530 Subject: [PATCH 1/4] Add test script to validate USB HID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shell script verifies the enumeration of USB Human Interface Devices. Signed-off-by: “Aanchal --- Runner/suites/Kernel/Baseport/usb_hid/run.sh | 66 ++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Runner/suites/Kernel/Baseport/usb_hid/run.sh diff --git a/Runner/suites/Kernel/Baseport/usb_hid/run.sh b/Runner/suites/Kernel/Baseport/usb_hid/run.sh new file mode 100644 index 00000000..da9effa6 --- /dev/null +++ b/Runner/suites/Kernel/Baseport/usb_hid/run.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +# Validate USB HID device detection +# Requires at least one USB HID peripheral (keyboard/mouse, etc.) connected to a USB Host port. + +# Robustly find and source init_env +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +INIT_ENV="" +SEARCH="$SCRIPT_DIR" +while [ "$SEARCH" != "/" ]; do + if [ -f "$SEARCH/init_env" ]; then + INIT_ENV="$SEARCH/init_env" + break + fi + SEARCH=$(dirname "$SEARCH") +done + +if [ -z "$INIT_ENV" ]; then + echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2 + exit 1 +fi + +# Only source if not already loaded (idempotent) +if [ -z "$__INIT_ENV_LOADED" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi +# Always source functestlib.sh, using $TOOLS exported by init_env +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/functestlib.sh" + +TESTNAME="usb_hid" +test_path=$(find_test_case_by_name "$TESTNAME") +cd "$test_path" || exit 1 +# shellcheck disable=SC2034 +res_file="./$TESTNAME.res" + +log_info "-----------------------------------------------------------------------------------------" +log_info "-------------------Starting $TESTNAME Testcase----------------------------" +log_info "=== Test Initialization ===" + +# Check if lsusb is installed +check_dependencies lsusb grep + +log_info "=== USB HID device Detection ===" +hid_iface_count="$(lsusb -v 2>/dev/null | grep -i 'Human Interface Device' | wc -l)" + +echo "lsusb -v HID descriptors:" +lsusb -v 2>/dev/null | grep -i 'Human Interface Device' || true + +echo "Number of HID interfaces found: $hid_iface_count" + +if [ "$hid_iface_count" -gt 0 ]; then + log_pass "$TESTNAME : Test Passed - USB HID interface(s) detected" + echo "$TESTNAME PASS" > "$res_file" + exit 0 +else + log_fail "$TESTNAME : Test Failed - No 'Human Interface Device' interface found" + echo "$TESTNAME FAIL" > "$res_file" + exit 1 +fi + +log_info "-------------------Completed $TESTNAME Testcase----------------------------" \ No newline at end of file From 5c78fe1c7387c08eeadcd11b8564a490af72ba75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAanchal?= Date: Thu, 22 Jan 2026 16:00:57 +0530 Subject: [PATCH 2/4] Add documentation for Runner/../usb_hid/run.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added setup information and basic requirements. This informs the tester of the hardware setup requirement before starting test. Signed-off-by: “Aanchal --- .../suites/Kernel/Baseport/usb_hid/README.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Runner/suites/Kernel/Baseport/usb_hid/README.md diff --git a/Runner/suites/Kernel/Baseport/usb_hid/README.md b/Runner/suites/Kernel/Baseport/usb_hid/README.md new file mode 100644 index 00000000..e632d3b1 --- /dev/null +++ b/Runner/suites/Kernel/Baseport/usb_hid/README.md @@ -0,0 +1,27 @@ +``` +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause-Clear +``` + +# USB HID Validation + +## Overview + +This shell script executes on the DUT (Device-Under-Test) and verifies enumeration of connected USB Human Interface Devices (HID). + +--- + +## Setup + +- Connect USB HID peripheral(s) to USB port(s) on DUT. +- Only applicable for USB ports that support Host Mode functionality. +- USB HID peripherals examples: Mouse, Keyboard, USB headset, etc. + +--- + +## License + +``` +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause-Clear +``` From 91cb3bb3509514a1ff045a4a20f5f060ebe27526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAanchal?= Date: Thu, 22 Jan 2026 16:10:08 +0530 Subject: [PATCH 3/4] Add test definition for usb_hid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Individual test definition is meant to be used for debugging the test script running in LAVA. Signed-off-by: “Aanchal --- .../suites/Kernel/Baseport/usb_hid/usb_hid.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Runner/suites/Kernel/Baseport/usb_hid/usb_hid.yaml diff --git a/Runner/suites/Kernel/Baseport/usb_hid/usb_hid.yaml b/Runner/suites/Kernel/Baseport/usb_hid/usb_hid.yaml new file mode 100644 index 00000000..7521de49 --- /dev/null +++ b/Runner/suites/Kernel/Baseport/usb_hid/usb_hid.yaml @@ -0,0 +1,16 @@ +metadata: + name: usb-hid + format: "Lava-Test Test Definition 1.0" + description: "This shell script executes on the DUT (Device-Under-Test) and verifies enumeration of connected USB Human Interface Devices (HID)." + os: + - linux + scope: + - functional + +run: + steps: + - REPO_PATH=$PWD + - cd Runner/suites/Kernel/Baseport/usb_hid + - ./run.sh || true + - $REPO_PATH/Runner/utils/send-to-lava.sh usb_hid.res || true + From 3acbc6708219cbfea3d9d1d624c619d84bebaaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAanchal?= Date: Thu, 22 Jan 2026 16:46:35 +0530 Subject: [PATCH 4/4] Fix: restore executable bits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: “Aanchal --- Runner/suites/Kernel/Baseport/usb_hid/run.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 Runner/suites/Kernel/Baseport/usb_hid/run.sh diff --git a/Runner/suites/Kernel/Baseport/usb_hid/run.sh b/Runner/suites/Kernel/Baseport/usb_hid/run.sh old mode 100644 new mode 100755