bind -a '#U' /dev /dev/usbctl /dev/usbdata /dev/usbstat /dev/usbaddr /dev/usbframe /dev/usbsetup
The data file usbdata provides read and write access to endpoints 1 and 2. When the file is read, it returns data written to endpoint 1 by the USB host. Data written to the file is provided in response to the host's read requests on endpoint 2. Output data is converted to packets limited to the maximum packet length for the endpoint (see the maxpkt control request, below), which is 1023 bytes by default. Note that zero length records can be transmitted and received on USB.
The file usbsetup provides read and write access to endpoint 0. When the file is read, it returns SETUP requests from the host. If a given request requires a reply, the reply must be written to the file (host requests will automatically be NAKd until then). Requests and replies are in binary form as defined in the USB specification, except for the reset message described below. The driver itself interprets all SET_ADDRESS requests from the host, and sets the controller's address accordingly. That request will therefore not be visible on the usbsetup file.
A USB bus or device reset sets the controller's USB address to zero, the USB `default address' for configuration. It also resets all data toggles to DATA0. A subsequent read of usbsetup will return the following special 8-byte reset message:
byte 16rFF, byte 16rFF, byte 'r', byte 'e', byte 's', byte 'e', byte 't', byte '\n'
which does not resemble a normal SETUP message. Further reads and writes on usbdata will return errors until that file has been closed and reopened.
The control file usbctl receives textual commands to set device parameters and responses:
Stalling an endpoint causes IN and OUT transactions from the host to return a `stalled' error status. On the control endpoint (endpoint 0), however, SETUP transactions will still arrive on usbsetup, and the arrival of a SETUP will automatically clear the `stalled' status for the endpoint, allowing an application to reject a control request (by stalling the subsequent status transaction) without stalling the control endpoint by rejecting subsequent SETUP transactions.
The status file usbstat is a read-only file, containing one line of statistics for each endpoint, giving: endpoint number; data toggles; maximum packet size; count of input and output bytes and packets; and counts of various error conditions.
The read-only file usbaddr contains a single number giving the current device address.
The read-only file usbframe contains a single line giving the current USB frame number.
/man/3/usb(3) | Rev: Thu Feb 15 14:43:36 GMT 2007 |