#!/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 ()
{ if [ "$CONFIG" = "" ]; then
CONFIG=$1 echo"assuming $CONFIG configuration"
return fi if [ "$CONFIG" = $1 ]; then
return fi
echo"** device must be in $1 config, but it's $CONFIG instead"
exit 1
}
echo"TESTING: $ARGS"
while : true do echo $(date)
for TYPE in $ARGS do # restore defaults
COUNT=5000
BUFLEN=2048
# FIXME automatically multiply COUNT by 10 when # /sys/bus/usb/device/$THIS/speed == "480"
# COUNT=50000
case $TYPE in
control) # any device, in any configuration, can use this. echo'** Control test cases:'
halt) # NOTE: sometimes hardware doesn't cooperate well with halting # endpoints from the host side. so long as mass-storage class # firmware can halt them from the device, don't worry much if # you can't make this test work on your device.
COUNT=2000 echo"test 13: $COUNT halt set/clear"
do_test -t 13
;;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.