(→Configuration files) |
(→Hardware setup and test execution order) |
||
| Line 36: | Line 36: | ||
* Supported USB cable | * Supported USB cable | ||
* Device with USB host capability (e.g. PC) | * Device with USB host capability (e.g. PC) | ||
| - | * Device with USB peripheral capability (e.g. N900) | + | * Device with USB peripheral capability (e.g. Nokia N810/N900) |
How to setup test enviroment: | How to setup test enviroment: | ||
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.
For further instructions on creating and using configuration files, see Configuration file examples.
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.
The test asset allows you to change all endpoint parameters via configuration files. Since the USB (2.0) specification only states the valid range for different settings, it is possible to give any values as long as they fit inside these ranges. The test asset allows experimenting with different configurations and "triangulation" of what works and what does not. Naturally there are certain HW related restrictions such as total transfer capacity which obviously cannot be exceeded with endpoint configuration. Basic test asset configurations is done with base configuration files, such as provided 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]
To change the endpoint configuration, you will have to edit ep-configuration files. For example, provided ep-configuration-bulk.cfg looks like this by default:
# 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
The lines starting with # are comments and document provided parameters. Device_speed is the highest speed used device is supposed to be able handle (any/low/full/high) and used_speed the operational speed during test execution. This can be used to force the device to use lower speed than normally would be used. To add new pair of bulk endpoints simply add following lines to the file:
3 bulk in 512 9 4 bulk out 512 9
Do note that you can put different endpoint types to the same configuration so there can be any combination of bulk, interrupt and isochronous endpoints as long as device supports this.
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 |