Package ch.ntb.usb
Class USB
java.lang.Object
ch.ntb.usb.USB
This class manages all USB devices and defines some USB specific constants.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic int
The maximum packet size of a bulk transfer when operating in fullspeed (12 MB/s) mode.static int
The maximum packet size of a bulk transfer when operating in highspeed (480 MB/s) mode.static final int
This request is used to clear or disable a specific feature (USB spec 9.4.1).static final int
This request returns the current device configuration value (USB spec 9.4.2).static final int
This request returns the specified descriptor if the descriptor exists (USB spec 9.4.3).static final int
This request returns the selected alternate setting for the specified interface (USB spec 9.4.4).static final int
This request returns status for the specified recipient (USB spec 9.4.5).static final int
This request sets the device address for all future device accesses (USB spec 9.4.6).static final int
This request sets the device configuration (USB spec 9.4.7).static final int
This request is optional and may be used to update existing descriptors or new descriptors may be added (USB spec 9.4.8).static final int
This request is used to set or enable a specific feature (USB spec 9.4.9).static final int
This request allows the host to select an alternate setting for the specified interface (USB spec 9.4.10).static final int
This request is used to set and then report an endpoint’s synchronization frame (USB spec 9.4.11).static final int
Identifies the direction of data transfer in the second phase of the control transfer.
The state of the Direction bit is ignored if the wLength field is zero, signifying there is no Data stage.
Specifies bit 7 of bmRequestType.static final int
Identifies the direction of data transfer in the second phase of the control transfer.
The state of the Direction bit is ignored if the wLength field is zero, signifying there is no Data stage.
Specifies bit 7 of bmRequestType.static final int
Specifies the intended recipient of the request.
Requests may be directed to the device, an interface on the device, or a specific endpoint on a device.static final int
Specifies the intended recipient of the request.
Requests may be directed to the device, an interface on the device, or a specific endpoint on a device.static final int
Specifies the intended recipient of the request.
Requests may be directed to the device, an interface on the device, or a specific endpoint on a device.static final int
Specifies the intended recipient of the request.
Requests may be directed to the device, an interface on the device, or a specific endpoint on a device.static final int
Specifies the type of the request.
Specifies bits 6..5 of bmRequestType.static final int
Specifies the type of the request.
Specifies bits 6..5 of bmRequestType.static final int
Specifies the type of the request.
Specifies bits 6..5 of bmRequestType.static final int
Specifies the type of the request.
Specifies bits 6..5 of bmRequestType. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
REQ_GET_STATUS
public static final int REQ_GET_STATUSThis request returns status for the specified recipient (USB spec 9.4.5). -
REQ_CLEAR_FEATURE
public static final int REQ_CLEAR_FEATUREThis request is used to clear or disable a specific feature (USB spec 9.4.1). -
REQ_SET_FEATURE
public static final int REQ_SET_FEATUREThis request is used to set or enable a specific feature (USB spec 9.4.9). -
REQ_SET_ADDRESS
public static final int REQ_SET_ADDRESSThis request sets the device address for all future device accesses (USB spec 9.4.6). -
REQ_GET_DESCRIPTOR
public static final int REQ_GET_DESCRIPTORThis request returns the specified descriptor if the descriptor exists (USB spec 9.4.3). -
REQ_SET_DESCRIPTOR
public static final int REQ_SET_DESCRIPTORThis request is optional and may be used to update existing descriptors or new descriptors may be added (USB spec 9.4.8). -
REQ_GET_CONFIGURATION
public static final int REQ_GET_CONFIGURATIONThis request returns the current device configuration value (USB spec 9.4.2). -
REQ_SET_CONFIGURATION
public static final int REQ_SET_CONFIGURATIONThis request sets the device configuration (USB spec 9.4.7). -
REQ_GET_INTERFACE
public static final int REQ_GET_INTERFACEThis request returns the selected alternate setting for the specified interface (USB spec 9.4.4). -
REQ_SET_INTERFACE
public static final int REQ_SET_INTERFACEThis request allows the host to select an alternate setting for the specified interface (USB spec 9.4.10). -
REQ_SYNCH_FRAME
public static final int REQ_SYNCH_FRAMEThis request is used to set and then report an endpoint’s synchronization frame (USB spec 9.4.11). -
REQ_TYPE_DIR_HOST_TO_DEVICE
public static final int REQ_TYPE_DIR_HOST_TO_DEVICEIdentifies the direction of data transfer in the second phase of the control transfer.
The state of the Direction bit is ignored if the wLength field is zero, signifying there is no Data stage.
Specifies bit 7 of bmRequestType. -
REQ_TYPE_DIR_DEVICE_TO_HOST
public static final int REQ_TYPE_DIR_DEVICE_TO_HOSTIdentifies the direction of data transfer in the second phase of the control transfer.
The state of the Direction bit is ignored if the wLength field is zero, signifying there is no Data stage.
Specifies bit 7 of bmRequestType. -
REQ_TYPE_TYPE_STANDARD
public static final int REQ_TYPE_TYPE_STANDARDSpecifies the type of the request.
Specifies bits 6..5 of bmRequestType. -
REQ_TYPE_TYPE_CLASS
public static final int REQ_TYPE_TYPE_CLASSSpecifies the type of the request.
Specifies bits 6..5 of bmRequestType. -
REQ_TYPE_TYPE_VENDOR
public static final int REQ_TYPE_TYPE_VENDORSpecifies the type of the request.
Specifies bits 6..5 of bmRequestType. -
REQ_TYPE_TYPE_RESERVED
public static final int REQ_TYPE_TYPE_RESERVEDSpecifies the type of the request.
Specifies bits 6..5 of bmRequestType. -
REQ_TYPE_RECIP_DEVICE
public static final int REQ_TYPE_RECIP_DEVICESpecifies the intended recipient of the request.
Requests may be directed to the device, an interface on the device, or a specific endpoint on a device. When an interface or endpoint is specified, the wIndex field identifies the interface or endpoint.
Specifies bits 4..0 of bmRequestType. -
REQ_TYPE_RECIP_INTERFACE
public static final int REQ_TYPE_RECIP_INTERFACESpecifies the intended recipient of the request.
Requests may be directed to the device, an interface on the device, or a specific endpoint on a device. When an interface or endpoint is specified, the wIndex field identifies the interface or endpoint.
Specifies bits 4..0 of bmRequestType. -
REQ_TYPE_RECIP_ENDPOINT
public static final int REQ_TYPE_RECIP_ENDPOINTSpecifies the intended recipient of the request.
Requests may be directed to the device, an interface on the device, or a specific endpoint on a device. When an interface or endpoint is specified, the wIndex field identifies the interface or endpoint.
Specifies bits 4..0 of bmRequestType. -
REQ_TYPE_RECIP_OTHER
public static final int REQ_TYPE_RECIP_OTHERSpecifies the intended recipient of the request.
Requests may be directed to the device, an interface on the device, or a specific endpoint on a device. When an interface or endpoint is specified, the wIndex field identifies the interface or endpoint.
Specifies bits 4..0 of bmRequestType. -
HIGHSPEED_MAX_BULK_PACKET_SIZE
public static int HIGHSPEED_MAX_BULK_PACKET_SIZEThe maximum packet size of a bulk transfer when operating in highspeed (480 MB/s) mode. -
FULLSPEED_MAX_BULK_PACKET_SIZE
public static int FULLSPEED_MAX_BULK_PACKET_SIZEThe maximum packet size of a bulk transfer when operating in fullspeed (12 MB/s) mode.
-
-
Constructor Details
-
USB
public USB()
-
-
Method Details
-
getDevice
Create a new device an register it in a device queue. If the device is already registered, a reference to it will be returned.- Parameters:
idVendor
- the vendor id of the USB deviceidProduct
- the product id of the USB devicefilename
- an optional filename which can be used to distinguish multiple devices with the same vendor and product id.- Returns:
- a newly created device or an already registered device
-
getDevice
SeegetDevice(short, short, String)
. The parameterfilename
is set to null.- Parameters:
idVendor
-idProduct
-- Returns:
- a newly created device or an already registered device
-
getBus
Returns the rootUsb_Bus
element.- Returns:
- the root
Usb_Bus
element - Throws:
USBException
-
init
public static void init()Explicitly callsLibusbJava.usb_init()
. Note that you don't need to call this procedure as it is called implicitly when creating a new device withgetDevice(short, short, String)
.
-