This is the Readme file for usbtool, a general purpose command line utility
which can send USB requests to arbitrary devices. Usbtool is based on libusb.
WHAT IS USBTOOL GOOD FOR?
=========================
When you implement a communication protocol like USB, you must usually write
two programs: one on each end of the communication. For USB, this means that
you must write a firmware for the device and driver software for the host.
Usbtool can save you the work of writing the host software, at least during
firmware development and testing. Usbtool can send control-in and -out
requests to arbitrary devices and send and receive data on interrupt- and
bulk-endpoints.
Usbtool is not only a useful developer tool, it's also an example for using
libusb for communication with the device.
SYNOPSIS
========
usbtool [options] <command>
COMMANDS
========
list
This command prints a list of devices found on all available USB busses.
Options -v, -V, -p and -P can be used to filter the list.
control in|out <type> <recipient> <request> <value> <index>
Sends a control-in or control-out request to the device. The request
parameters are:
type ........ Type of request, can be "standard", "class", "vendor" or
"reserved". The type determines which software module in
the device is responsible for answering the request:
Standard requests are answered by the driver, class
requests by the class implementation (e.g. HID, CDC) and
vendor requests by custom code.
recipient ... Recipient of the request in the device. Can be "device",
"interface", "endpoint" or "other". For standard and
class requests, the specification defines a recipient for
each request. For vendor requests, choose whatever your
code expects.
request ..... 8 bit numeric value identifying the request.
value ....... 16 bit numeric value passed to the device.
index ....... another 16 bit numeric value passed to the device.
Use options -v, -V, -p and -P to single out a particular device. Use
options -d or -D to to send data in an OUT request. Use options -n, -O
and -b to determine what to do with data received in an IN request.
interrupt in|out
Sends or receives data on an interrupt-out resp. -in endpoint.
Use options -v, -V, -p and -P to single out a particular device. Use
options -d or -D to to send data to an OUT endpoint. Use options -n, -O
and -b to determine what to do with data received from an IN endpoint.
Use option -e to set the endpoint number, -c to choose a configuration
-i to claim a particular interface.
bulk in|out
Same as "interrupt in" and "interrupt out", but for bulk endpoints.
OPTIONS
=======
Most options have already been mentioned at the commands which use them.
here is a complete list:
-h or -?
Prints a short help.
-v <vendor-id>
Numeric vendor ID, can be "*" to allow any VID. Take only devices with
matching vendor ID into account.
-p <product-id>
Numeric product ID, can be "*" to allow any PID. Take only devices with
matching product ID into account.
-V <vendor-name-pattern>
Shell style matching pattern for vendor name. Take only devices into
account which have a vendor name that matches this pattern.
-P <product-name-pattern>
Shell style matching pattern for product name. Take only devices into
account which have a product name that matches this pattern.
-S <serial-pattern>
Shell style matching pattern for serial number. Take only devices into
account which have a serial number that matches this pattern.
-d <databytes>
Data bytes to send to the device, comma separated list of numeric values.
E.g.: "1,2,3,4,5".
-D <file>
Binary data sent to the device should be taken from this file.
-O <file>
Write received data bytes to the given file. Format is either hex or
binary, depending on the -b flag. By default, received data is printed
to standard output.
-b
Request binary output format for files and standard output. Default is
a hexadecimal listing.
-n <count>
Numeric value: Maximum number of bytes to receive. This value is passed
directly to the libusb API functions.
-e <endpoint>
Numeric value: Endpoint number for interrupt and bulk commands.
-t <timeout>
Numeric value: Timeout in milliseconds for the request. This value is
passed directly to the libusb API functions.
-c <configuration>
Numeric value: Interrupt and bulk endpoints can usually only be used if
a configuration and an interface has been chosen. Use -c and -i to
specify configuration and interface values.
-i <interface>
Numeric value: Interrupt and bulk endpoints can usually only be used if
a configuration and an interface has been chosen. Use -c and -i to
specify configuration and interface values.
-w
Usbtool may be too verbose with warnings for some applications. Use this
option to suppress USB warnings.
NUMERIC VALUES
==============
All numeric values can be given in hexadecimal, decimal or octal. Hex values
are identified by their 0x or 0X prefix, octal values by a leading "0" (the
digit zero) and decimal values because they start with a non-zero digit. An
optional sign character is allowed. The special value "*" is translated to
zero and stands for "any value" in some contexts.
SHELL STYLE MATCHING PATTERNS
=============================
Some options take shell style matching patterns as an argument. This refers
to Unix shells and their file wildcard operations:
+ "*" (asterisk character) matches any number (0 to infinite) of any
characters.
+ "?" matches exactly one arbitrary character.
+ A list of characters in square brackets (e.g. "[abc]") matches any of the
characters in the list. If a dash ("-") is in the list, it must be the
first or the last character. If a caret ("^") is in the list, it must
not be the first character. A closing square bracket ("]") must be the
first character in the list. A range of characters can be specified in
the way "[a-z]". This matches all characters with numeric representation
(usually ASCII) starting with "a" and ending with "z". The entire
construct matches only one character.
+ A list of characters in square brackets starting with a caret ("^"), e.g.
("[^abc]") matches any character NOT in the list. The other rules are as
above.
+ "\" (backslash) followed by any character matches that following
character. This can be used to escape "*", "?", "[" and "\".
BUILDING USBTOOL
================
Usbtool uses libusb on Unix and libusb-win32 on Windows. These libraries can
be obtained from http://libusb.sourceforge.net/ and
http://libusb-win32.sourceforge.net/ respectively. On Unix, a simple "make"
should compile the sources (although you may have to edit Makefile to
include or remove additional libraries). On Windows, we recommend that you
use MinGW and MSYS. See the top level Readme file for details. Edit
Makefile.windows according to your library installation paths and build with
"make -f Makefile.windows".
EXAMPLES
========
To list all devices connected to your computer, do
usbtool -w list
To check whether our selection options single out the desired device, use eg.
usbtool -w -P LEDControl list
This command shows all LEDControl devices connected or prints nothing if
none is found. LEDControl is the device from the "custom-class" example.
You can also send commands to the LEDControl device using usbtool. From
the file requests.h in custom-class/firmware, we know that the set-status
request has numeric value 1 and the get-status request is 2. See this file
for details of the protocol used. We can therefore query the status with
usbtool -w -P LEDControl control in v
没有合适的资源?快使用搜索试试~ 我知道了~
AVR-USB-HID
共104个文件
txt:32个
h:21个
c:19个
5星 · 超过95%的资源 需积分: 9 38 下载量 113 浏览量
2009-05-12
16:25:49
上传
评论
收藏 468KB ZIP 举报
温馨提示
AVR-USB-HID,用AVR模拟USB电路,简单,USB1.0收发数据都正常!!!
资源推荐
资源详情
资源评论
收起资源包目录
AVR-USB-HID (104个子文件)
usbdrvasm.asm 618B
compare-sizes.awk 1KB
usbdrv.c 24KB
usbtool.c 13KB
hiddata.c 12KB
hiddata.c 12KB
opendevice.c 8KB
opendevice.c 8KB
opendevice.c 8KB
opendevice.c 8KB
main.c 7KB
main.c 6KB
set-led.c 6KB
set-led.c 6KB
main.c 5KB
main.c 5KB
main.c 4KB
hidtool.c 4KB
osccal.c 2KB
oddebug.c 1KB
null.c 695B
usbdrv.h 30KB
usbconfig-prototype.h 17KB
usbconfig.h 17KB
usbconfig.h 17KB
usbconfig.h 17KB
usbconfig.h 17KB
usbconfig.h 15KB
usbportability.h 4KB
osctune.h 4KB
opendevice.h 4KB
opendevice.h 4KB
opendevice.h 4KB
opendevice.h 4KB
hiddata.h 3KB
hiddata.h 3KB
oddebug.h 3KB
osccal.h 3KB
hidsdi.h 2KB
hidsdi.h 2KB
requests.h 1KB
requests.h 1KB
usbdrvasm18-crc.inc 31KB
usbdrvasm128.inc 28KB
usbdrvasm15.inc 17KB
usbdrvasm165.inc 17KB
usbdrvasm12.inc 15KB
usbdrvasm20.inc 15KB
usbdrvasm16.inc 12KB
asmcommon.inc 8KB
Makefile 7KB
Makefile 7KB
Makefile 7KB
Makefile 7KB
Makefile 6KB
Makefile 1KB
Makefile 1KB
Makefile 1KB
Makefile 1003B
with-vreg.png 14KB
with-zener.png 13KB
with-series-diodes.png 13KB
tiny45-rc.png 8KB
usbdrvasm.S 9KB
with-zener.sch 220KB
with-vreg.sch 211KB
with-series-diodes.sch 209KB
tiny45-rc.sch 189KB
License.txt 19KB
License.txt 19KB
Changelog.txt 12KB
Changelog.txt 12KB
Readme.txt 8KB
Readme.txt 8KB
USBID-License.txt 7KB
USBID-License.txt 7KB
CommercialLicense.txt 7KB
CommercialLicense.txt 7KB
Readme.txt 5KB
Readme.txt 4KB
Readme.txt 4KB
Readme.txt 3KB
Readme.txt 3KB
Readme.txt 2KB
Readme.txt 1KB
sizes-20090323-gcc4.3.2.txt 1KB
sizes-20090323-gcc3.4.6.txt 1KB
sizes-20090415-gcc3.4.6.txt 1KB
sizes-20090415-gcc4.3.2.txt 1KB
Readme.txt 1KB
sizes-20081126-gcc4.3.0.txt 1024B
sizes-20081126-gcc3.4.6.txt 1024B
sizes-20081022-gcc3.4.6.txt 1024B
sizes-20081022-gcc4.3.0.txt 1024B
sizes-20080513-gcc3.4.6.txt 960B
sizes-20080513-gcc4.3.0.txt 960B
Readme.txt 900B
sizes-20080418-gcc3.4.6.txt 832B
sizes-20080418-gcc4.2.2.txt 832B
Readme.txt 501B
共 104 条
- 1
- 2
资源评论
- y5788993402015-12-04看看。看看。看看
- hongyanj2014-08-19就是V-USB,网上的,比较早的
hzq1976
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功