|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is not an Application Programming Interface. It is used internally to the implementation, and connects to the host OS implementation (probably in native code).
Method Summary | |
void |
claimInterface(int ifnum)
Claims a particular interface in the current configuration. |
int |
clearHalt(byte ep)
Clears halt/stall status on an endpoint. |
Device |
getChild(int port)
Returns children of a hub device. |
java.lang.String |
getClaimer(int ifnum)
Identifies the driver claiming a particular interface in the current configuration. |
byte[] |
getConfigBuf(int config)
Returns a buffer holding the entire set of configuration descriptors for the specified configuration. |
byte[] |
readBulk(int ep,
int length)
Reads a specified number of bytes from a BULK IN endpoint. |
byte[] |
readControl(byte type,
byte request,
short value,
short index,
short length)
Issues a control IN request with an optional data READ phase. |
byte[] |
readIntr(int ep,
int len)
Reads a specified number of bytes from a INTERRUPT IN endpoint. |
void |
releaseInterface(int ifnum)
Releases a claim on a given interface, so that another driver can safely claim it. |
void |
setInterface(int ifnum,
int alt)
Assigns a particular alternate setting to a given interface. |
void |
writeBulk(int ep,
byte[] buf)
Writes a specified number of bytes to a BULK OUT endpoint. |
void |
writeControl(byte type,
byte request,
short value,
short index,
byte[] buf)
Issues a control OUT request with an optional data WRITE phase. |
void |
writeIntr(int ep,
byte[] buf)
Writes a specified number of bytes to a INTERRUPT OUT endpoint. |
Method Detail |
public byte[] getConfigBuf(int config) throws java.io.IOException
config
- Number of the configuration, from zero to the limit
specified by DeviceDescriptor.getNumConfigurations()
public byte[] readControl(byte type, byte request, short value, short index, short length) throws java.io.IOException
Most of the parameters here are used to build the SETUP packet for the control request, which is always written to the device. Note an OUT control request with only a setup packet is different from the IN request with the same bits in the setup packet data; it goes to a different endpoint.
type
- Masked together using three constants from
ControlMessage
: DIR_TO_HOST, a TYPE_*, and a RECIP_*.request
- bRequest field, either standard (from table 9-3 in
the USB 2.0 specification) for TYPE_STANDARD, or else as specified
in the class or vendor device type specification.value
- sixteen bit field associated with requestindex
- sixteen bit field associated with requestlength
- How much data should be read; may be zero to indicate
that no READ phase follows the SETUP packet.public void writeControl(byte type, byte request, short value, short index, byte[] buf) throws java.io.IOException
Most of the parameters here are used to build the SETUP packet for the control request, which is always written to the device. Note an OUT control request with only a setup packet is different from the IN request with the same bits in the setup packet data; it goes to a different endpoint.
type
- Masked together using three constants from
ControlMessage
: DIR_TO_DEVICE, a TYPE_*, and a RECIP_*.request
- bRequest field, either standard (from table 9-3 in
the USB 2.0 specification) for TYPE_STANDARD, or else as specified
in the class or vendor device type specification.value
- sixteen bit field associated with requestindex
- sixteen bit field associated with requestbuf
- The data to be written. Length may be zero to indicate
that no WRITe phase follows the SETUP packet.public byte[] readBulk(int ep, int length) throws java.io.IOException
Endpoint.getMaxPacketSize()
,
the caller may need to decide whether to see if it is followed
by a zero length packet.
An endpoint's interface should be claimed before it is used for bulk I/O.
ep
- Endpoint direction and address, as specified in an
endpoint descriptor by Endpoint.getEndpoint()
.length
- How many bytes to read.public void writeBulk(int ep, byte[] buf) throws java.io.IOException
Endpoint.getMaxPacketSize()
then the last packet is "short". To write such an exact multiple
with a "short" last packet, explicitly follow this write by another,
using a buffer with length zero.
An endpoint's interface should be claimed before it is used for bulk I/O.
ep
- Endpoint direction and address, as specified in an
endpoint descriptor by Endpoint.getEndpoint()
.buf
- The bytes to write.public int clearHalt(byte ep) throws java.io.IOException
The endpoint's interface should be claimed before clearing its halt status.
ep
- Endpoint address and direction, as returned by
Endpoint.getEndpoint()
.public byte[] readIntr(int ep, int len) throws java.io.IOException
This blocks until an interrupt transfer completes. It's the
caller's responsibility to ensure that the endpoint is polled
often enough to meet Endpoint.getInterval()
requirements
after a transfer completes.
An endpoint's interface should be claimed before it is used for interrupt I/O.
ep
- Endpoint direction and address, as specified in an
endpoint descriptor by Endpoint.getEndpoint()
.length
- How many bytes to read.public void writeIntr(int ep, byte[] buf) throws java.io.IOException
Endpoint.getMaxPacketSize()
then the last packet is "short". To write such an exact multiple
with a "short" last packet, explicitly follow this write with a
write of a buffer with length zero.
This blocks until an interrupt transfer completes. It's the
caller's responsibility to ensure that the endpoint is polled
often enough to meet Endpoint.getInterval()
requirements
after a transfer completes.
An endpoint's interface should be claimed before it is used for interrupt I/O.
ep
- Endpoint direction and address, as specified in an
endpoint descriptor by Endpoint.getEndpoint()
.buf
- The bytes to write.public java.lang.String getClaimer(int ifnum) throws java.io.IOException
ifnum
- Number from the descriptor, returned by
Interface.getNumber()
.public void claimInterface(int ifnum) throws java.io.IOException
ifnum
- Number from the descriptor, returned by
Interface.getNumber()
.releaseInterface(int)
public void setInterface(int ifnum, int alt) throws java.io.IOException
ifnum
- Number from the descriptor, returned by
Interface.getNumber()
.alt
- Number from the descriptor, returned by
Interface.getAlternateSetting()
.public void releaseInterface(int ifnum) throws java.io.IOException
ifnum
- Number from the descriptor, returned by
Interface.getNumber()
.claimInterface(int)
public Device getChild(int port) throws java.io.IOException
port
- Number of the hub port of interest, from one to the
Hub.getNumPorts()
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |