Contents |
USB peripheral test cases are made between host (e.g. PC) and peripheral gadget (e.g. N900). Both ends have their own drivers which communicate and transfer data between different endpoints.
Each test case must be run independently and devices must be preset according to case requirements using provided setup test cases. In practice, this means for example data transfer requires preconnected host enabled USB cable and host mode supporting device is connected to system. Each test case prints out required user interaction to terminal.
Current coverage for USB tests:
USB bulk and isochronous endpoint transfer test cases. Those who know more about USB transfer can also alter endpoint configurations via configuration files. Example configurations are provided with the test package.
Required hardware:
How to setup test enviroment:
NOTE: Before executing test cases it must be determined if used devices are capable of acting as peripheral or host. This depends on USB controller chips of devices and necessary information should be available from device vendors. Furthermore, current gadget driver implementation is built over MUSB driver implementation available in Linux kernel. Possible different implementations by device vendors may cause incompatibility with this test driver.
$ blts_usb_testrunner -C [config file] -e [test number]
This test asset uses two configuration files: One for generic test execution options and one for endpoint configuration. Endpoint configuration file is linked to base configuration files thus only base file path is given as parameter. Configuration files must be used, as they contain endpoint configuration for driver.
Currently following example base configuration files are included in the package:
The base files are linked to endpoint configuration files and following examples are provided with test package:
NOTE: Supported endpoint configurations differ from device to device and they should be modified according to test execution requirements. These configuration files are provided as examples and should not be used as such during proper test execution.
NOTE:
NOTE: All other gadget drivers MUST be unloaded before test execution in used DUT!
You can use command lsmod to determine which modules are loaded in memory:
$ lsmod
See if some gadget driver is found. For example g_file_storage is a mass storage module, but this depends on used HW and SW. The module can be unloaded with following command:
$ modprobe -r g_file_storage
Arguments:
| Switch | Function |
|---|---|
| -C | Used parameter configuration file |
| -l | Used log file, default blts_skeleton_run.log |
| -e | Execute single or multiple selected tests, for example -e 1,4,5. |
| -en | Execute test by name, for example -en "My test X" |
| -s | Show list of all tests |
| -? | Help message |
| -nc | Do not output log to terminal |
| Optional switch | Function |
| -h | Use given host driver (default: blts_usb_host), for example -h blts_usb_host |
| -p | Use given peripheral driver (default: blts_gadget), for example -h blts_gadget |
Test case execution notices:
| Case name | Notice |
|---|---|
| USB - Setup host driver* | |
| USB - Setup peripheral driver# | Use configuration file to create specific setup, bulk endpoints are created by default |
| USB - Read test* | Read data from endpoints |
| USB - Write test* | Write data to endpoints |
* This test is run on host device.
# This test is run on peripheral device.
Example base configuration file blts-usb-testrunner-bulk.cnf:
# USB test case configuration for parameters ###################### # General parameters # ###################### [parameter] name host_driver const "blts_usb_host" [end_parameter] [parameter] name host_driver_path const "/usr/lib/tests/blts-usb-tests/" [end_parameter] [parameter] name peripheral_driver const "blts_gadget" [end_parameter] [parameter] name peripheral_driver_path const "/usr/lib/tests/blts-usb-tests/" [end_parameter] [parameter] name data_transfer_timeout const "10000" [end_parameter] [parameter] name usb_transfer_size const 4096 [end_parameter] ########################## # Endpoint configuration # ########################## [parameter] name ep_configuration_file const "/usr/share/blts-usb-tests/ep-configuration-bulk.cfg" [end_parameter] ################ # Driver setup # ################ [test] name "USB - Setup host driver" params host_driver host_driver_path [end_test] [test] name "USB - Setup peripheral driver" params peripheral_driver peripheral_driver_path usb_transfer_size ep_configuration_file [end_test] ####################### # Data transfer cases # ####################### [test] name "USB - Read test" params host_driver host_driver_path peripheral_driver peripheral_driver_path usb_transfer_size [end_test] [test] name "USB - Write test" params host_driver host_driver_path peripheral_driver peripheral_driver_path usb_transfer_size [end_test]
Example endpoint configuration file ep-configuration-bulk.cfg:
# device_speed used_speed max_power high any 50 # endpoint type direction max_packet_size interval 1 bulk in 512 9 2 bulk out 512 9
Debian package is provided which includes both host and peripheral drivers in addition to test runner. This package can be installed on all devices under testing, although functionality depends on used hardware.
| USB Specification | USB documentation |
| Version | Date | Handled By | Status | Comments |
|---|---|---|---|---|
| 0.1 | 8-sep-2010 | Iekku Huttunen | Draft | Page created |