tools/usb/hcd-tests.sh

Source file repositories/reference/linux-study-clean/tools/usb/hcd-tests.sh

File Facts

System
Linux kernel
Corpus path
tools/usb/hcd-tests.sh
Extension
.sh
Size
6217 bytes
Lines
275
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# test types can be passed on the command line:
#
# - control: any device can do this
# - out, in:  out needs 'bulk sink' firmware, in needs 'bulk src'
# - iso-out, iso-in:  out needs 'iso sink' firmware, in needs 'iso src'
# - halt: needs bulk sink+src, tests halt set/clear from host
# - unlink: needs bulk sink and/or src, test HCD unlink processing
# - loop: needs firmware that will buffer N transfers
#
# run it for hours, days, weeks.
#

#
# this default provides a steady test load for a bulk device
#
TYPES='control out in'
#TYPES='control out in halt'

#
# to test HCD code
#
#  - include unlink tests
#  - add some ${RANDOM}ness
#  - connect several devices concurrently (same HC)
#  - keep HC's IRQ lines busy with unrelated traffic (IDE, net, ...)
#  - add other concurrent system loads
#

declare -i COUNT BUFLEN

COUNT=50000
BUFLEN=2048

# NOTE:  the 'in' and 'out' cases are usually bulk, but can be
# set up to use interrupt transfers by 'usbtest' module options


if [ "$DEVICE" = "" ]; then
	echo "testing ALL recognized usbtest devices"
	echo ""
	TEST_ARGS="-a"
else
	TEST_ARGS=""
fi

do_test ()
{
    if ! ./testusb $TEST_ARGS -s $BUFLEN -c $COUNT $* 2>/dev/null
    then
	echo "FAIL"
	exit 1
    fi
}

ARGS="$*"

if [ "$ARGS" = "" ];
then
    ARGS="$TYPES"
fi

# FIXME use /sys/bus/usb/device/$THIS/bConfigurationValue to
# check and change configs

CONFIG=''

check_config ()

Annotation

Implementation Notes