- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

# test/usb-tester/usb-tester.py

    00001 #! /usr/bin/env python
    00002
    00003 # This is a USB test suite for USB devices. To use it, load an
    00004 # application featuring the USB Test Function into the target,
    00005 # connect it to the PC and run this program.
    00006 #
    00007 # You need PyUnit and PyUSB installed on the host PC for this test to
    00008 # work. PyUnit is included with Python 2.1 and later.
    00009
    00010 import sys
    00011 import unittest
    00012 import usb
    00013 import usbtest
    00014
    00015 test_vid = 0x03eb       # Atmel Corp.
    00016 test_pid = 0x21fe       # ID reserved for internal testing
    00017
    00018 def run_test(usbdev):
    00019         print "Testing device %s (VID: %04x PID: %04x)" % (usbdev.filename,
    00020                         usbdev.idVendor, usbdev.idProduct)
    00021         runner = unittest.TextTestRunner()
    00022         suite = usbtest.suite(usbdev)
    00023         runner.run(suite)
    00024
    00025 busses = usb.busses()
    00026 for bus in busses:
    00027         devices = bus.devices
    00028         for dev in devices:
    00029                 if dev.idVendor == test_vid and dev.idProduct == test_pid:
    00030                         run_test(dev)