public class UsbLib extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CFG_ATTR_REMOTE_WAKE
Configuration attribute - remote wakeup
|
static int |
CFG_ATTR_SELF_POWER
Configuration attribute - self-powered
|
static int |
CLASS_APP_SPEC
Device class - application specific
|
static int |
CLASS_AUDIO
Device class - audio
|
static int |
CLASS_COMM
Device class - CDC control
|
static int |
CLASS_CONTENT_SEC
Device class security x
|
static int |
CLASS_DATA
Device class - CDC data
|
static int |
CLASS_DIAGNOSTIC
Device class - diagnostic
|
static int |
CLASS_HEALTHCARE
Device class - personal healthcare
|
static int |
CLASS_HID
Device class - human interface
|
static int |
CLASS_HUB
Device class - hub
|
static int |
CLASS_IMAGE
Device class - still image
|
static int |
CLASS_INTERFACE
Device class - see interface
|
static int |
CLASS_MASS_STORE
Device class - mass storage
|
static int |
CLASS_MISC
Device class - miscellaneous
|
static int |
CLASS_PHYSICAL
Device class - physical
|
static int |
CLASS_PRINTER
Device class - printer
|
static int |
CLASS_SMART_CARD
Device class - smart card
|
static int |
CLASS_VENDOR_SPEC
Device class - vendor specific
|
static int |
CLASS_VIDEO
Device class - video
|
static int |
CLASS_WIRELESS
Device class - wireless
|
static int |
EP_ATTR_BULK
Endpoint attribute - bulk data
|
static int |
EP_ATTR_BULK_STREAM
Endpoint attribute - bulk stream
|
static int |
EP_ATTR_CONTROL
Endpoint attribute - control
|
static int |
EP_ATTR_INTERRUPT
Endpoint attribute - interrupt
|
static int |
EP_ATTR_ISOCHRONOUS
Endpoint attribute - isochronous
|
static int |
EP_DIRECTION_IN
Endpoint direction - in
|
static int |
SPEED_FULL
Device speed - full
|
static int |
SPEED_HIGH
Device speed - high
|
static int |
SPEED_LOW
Device speed - low
|
static int |
SPEED_SUPER
Device speed - super
|
static int |
SPEED_UNKNOWN
Device speed - unknown
|
| Constructor and Description |
|---|
UsbLib() |
| Modifier and Type | Method and Description |
|---|---|
static void |
attachKernelDriver(long devh,
int intfc)
Re-attach kernel driver to an interface.
|
static UsbConfiguration |
buildConfiguration(long cdesc,
UsbDevice devc)
Builds a complete configuration from its descriptor.
|
static int |
bulkTransfer(long devh,
int endp,
byte[] data,
int offset,
int leng,
int timeout)
Transfers bulk data on an endpoint.
|
static void |
claimInterface(long devh,
int intfc)
Claims an interface.
|
static void |
clearHalt(long devh,
int endp)
Clears a halt condition on an endpoint.
|
static void |
close(long devh)
Closes a device.
|
static int |
controlTransfer(long devh,
int type,
int rqst,
int value,
int index,
byte[] data,
int offset,
int leng,
int timeout)
Transfers data on the control endpoint.
|
static void |
detachKernelDriver(long devh,
int intfc)
Detach kernel driver from an interface.
|
static void |
freeConfigDescriptor(long cdesc)
Frees a configuration descriptor.
|
static long |
getActiveConfigDescriptor(long devc)
Gets the active configuration descriptor handle.
|
static long[] |
getAltSettingDescriptors(long iface)
Gets the alternate settings in an interface.
|
static int |
getBusNumber(long devc)
Gets the bus number for a device.
|
static long |
getConfigDescriptor(long devc,
int index)
Gets a configuration descriptor handle.
|
static long |
getConfigDescriptorByValue(long devc,
int value)
Gets a configuration descriptor handle using its value.
|
static int |
getConfiguration(long devh)
Gets the number of the active configuration.
|
static UsbDevice |
getDevice(int vendor,
int product,
String serial,
int index)
Gets the device matching vendor, product, serial and index.
|
static int |
getDeviceAddress(long devc)
Gets the address of a device.
|
static long[] |
getDeviceList(long ctxt)
Gets the list of available USB devices.
|
static List<UsbDevice> |
getDevices(int vendor,
int product,
String serial)
Gets the list of devices matching vendor, product and serial.
|
static int |
getDeviceSpeed(long devc)
Gets the speed of a device.
|
static long[] |
getEndpointDescriptors(long idesc)
Gets the endpoints in an interface.
|
static long[] |
getInterfaces(long cdesc)
Gets the interfaces in a configuration.
|
static int |
getMaxPacketSize(long devc,
int endp)
Gets the maximum packet size for an endpoint.
|
static int |
getPortNumber(long devc)
Gets the port number for a device.
|
static String |
getStringDescriptorAscii(long devh,
int index)
Gets a string descriptor.
|
static int |
interruptTransfer(long devh,
int endp,
byte[] data,
int offset,
int leng,
int timeout)
Transfers interrupt data on an endpoint.
|
static boolean |
kernelDriverActive(long devh,
int intfc)
Determines if kernel driver is active on an interface.
|
static UsbConfigurationDescriptor |
newConfigurationDescriptor(long cdesc)
Creates a configuration descriptor object.
|
static UsbDeviceDescriptor |
newDeviceDescriptor(long devc)
Gets the device descriptor.
|
static UsbEndpointDescriptor |
newEndpointDescriptor(long edesc)
Creates an endpoint descriptor object.
|
static UsbInterfaceDescriptor |
newInterfaceDescriptor(long idesc)
Creates an interface descriptor object.
|
static long |
open(long devc)
Opens a device for subsequent I/O operations.
|
static void |
releaseInterface(long devh,
int intfc)
Releases an interface.
|
static void |
resetDevice(long devh)
Resets a device.
|
static void |
setAutoDetachKernelDriver(long devh,
boolean enable)
Enables/disables the auto detach kernel driver capability.
|
static void |
setConfiguration(long devh,
int conf)
Sets the active configuration.
|
static void |
setInterfaceAltSetting(long devh,
int intfc,
int alt)
Sets an alternate setting for an interface.
|
static void |
unrefDevice(long devc)
Unreferences a device.
|
public static final int SPEED_UNKNOWN
public static final int SPEED_LOW
public static final int SPEED_FULL
public static final int SPEED_HIGH
public static final int SPEED_SUPER
public static final int CLASS_INTERFACE
public static final int CLASS_AUDIO
public static final int CLASS_COMM
public static final int CLASS_HID
public static final int CLASS_PHYSICAL
public static final int CLASS_IMAGE
public static final int CLASS_PRINTER
public static final int CLASS_MASS_STORE
public static final int CLASS_HUB
public static final int CLASS_DATA
public static final int CLASS_SMART_CARD
public static final int CLASS_CONTENT_SEC
public static final int CLASS_VIDEO
public static final int CLASS_HEALTHCARE
public static final int CLASS_DIAGNOSTIC
public static final int CLASS_WIRELESS
public static final int CLASS_MISC
public static final int CLASS_APP_SPEC
public static final int CLASS_VENDOR_SPEC
public static final int CFG_ATTR_SELF_POWER
public static final int CFG_ATTR_REMOTE_WAKE
public static final int EP_ATTR_CONTROL
public static final int EP_ATTR_ISOCHRONOUS
public static final int EP_ATTR_BULK
public static final int EP_ATTR_INTERRUPT
public static final int EP_ATTR_BULK_STREAM
public static final int EP_DIRECTION_IN
public static List<UsbDevice> getDevices(int vendor, int product, String serial) throws org.lsst.ccs.drivers.commons.DriverException
vendor - The vendor ID; or -1 to match allproduct - The product ID; or -1 to match allserial - The serial number, which matches if it is contained
in the device's number; or null to match allorg.lsst.ccs.drivers.commons.DriverExceptionpublic static UsbDevice getDevice(int vendor, int product, String serial, int index) throws org.lsst.ccs.drivers.commons.DriverException
vendor - The vendor ID, or -1 to match allproduct - The product ID, or -1 to match allserial - The serial number, which matches if it is contained
in the device's number; or null to match allindex - The index of the device in the list of matching
devicesorg.lsst.ccs.drivers.commons.DriverExceptionpublic static UsbConfiguration buildConfiguration(long cdesc, UsbDevice devc)
cdesc - The configuration descriptor handledevc - The associated device objectpublic static long[] getDeviceList(long ctxt)
throws org.lsst.ccs.drivers.commons.DriverException
ctxt - The library contextorg.lsst.ccs.drivers.commons.DriverExceptionpublic static int getBusNumber(long devc)
devc - The device handlepublic static int getPortNumber(long devc)
devc - The device handlepublic static int getDeviceAddress(long devc)
devc - The device handlepublic static int getDeviceSpeed(long devc)
devc - The device handlepublic static int getMaxPacketSize(long devc,
int endp)
devc - The device handleendp - The endpoint addresspublic static void unrefDevice(long devc)
devc - The device handlepublic static long open(long devc)
throws org.lsst.ccs.drivers.commons.DriverException
devc - The device handleorg.lsst.ccs.drivers.commons.DriverExceptionpublic static void close(long devh)
devh - The open handlepublic static int getConfiguration(long devh)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleorg.lsst.ccs.drivers.commons.DriverExceptionpublic static void setConfiguration(long devh,
int conf)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleconf - The number of the configuration to make activeorg.lsst.ccs.drivers.commons.DriverExceptionpublic static void claimInterface(long devh,
int intfc)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleintfc - The number of the interface to claimorg.lsst.ccs.drivers.commons.DriverExceptionpublic static void releaseInterface(long devh,
int intfc)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleintfc - The number of the interface to releaseorg.lsst.ccs.drivers.commons.DriverExceptionpublic static void setInterfaceAltSetting(long devh,
int intfc,
int alt)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleintfc - The interface numberalt - The alternate setting numberorg.lsst.ccs.drivers.commons.DriverExceptionpublic static boolean kernelDriverActive(long devh,
int intfc)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleintfc - The interface numberorg.lsst.ccs.drivers.commons.DriverExceptionpublic static void detachKernelDriver(long devh,
int intfc)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleintfc - The interface numberorg.lsst.ccs.drivers.commons.DriverExceptionpublic static void attachKernelDriver(long devh,
int intfc)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleintfc - The interface numberorg.lsst.ccs.drivers.commons.DriverExceptionpublic static void setAutoDetachKernelDriver(long devh,
boolean enable)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleenable - Whether to enable (true) or disable (false)org.lsst.ccs.drivers.commons.DriverExceptionpublic static void clearHalt(long devh,
int endp)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleendp - The endpoint addressorg.lsst.ccs.drivers.commons.DriverExceptionpublic static void resetDevice(long devh)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleorg.lsst.ccs.drivers.commons.DriverExceptionpublic static UsbDeviceDescriptor newDeviceDescriptor(long devc) throws org.lsst.ccs.drivers.commons.DriverException
devc - The device handleorg.lsst.ccs.drivers.commons.DriverExceptionpublic static long getActiveConfigDescriptor(long devc)
throws org.lsst.ccs.drivers.commons.DriverException
devc - The device handleorg.lsst.ccs.drivers.commons.DriverExceptionpublic static long getConfigDescriptor(long devc,
int index)
throws org.lsst.ccs.drivers.commons.DriverException
devc - The device handleindex - The index of the descriptororg.lsst.ccs.drivers.commons.DriverExceptionpublic static long getConfigDescriptorByValue(long devc,
int value)
throws org.lsst.ccs.drivers.commons.DriverException
devc - The device handlevalue - The descriptor value (number)org.lsst.ccs.drivers.commons.DriverExceptionpublic static void freeConfigDescriptor(long cdesc)
cdesc - The configuration descriptor handlepublic static UsbConfigurationDescriptor newConfigurationDescriptor(long cdesc)
cdesc - The configuration descriptor handlepublic static long[] getInterfaces(long cdesc)
cdesc - The configuration descriptor handlepublic static long[] getAltSettingDescriptors(long iface)
iface - The interface handlepublic static UsbInterfaceDescriptor newInterfaceDescriptor(long idesc)
idesc - The interface descriptor handlepublic static long[] getEndpointDescriptors(long idesc)
idesc - The interface descriptor handlepublic static UsbEndpointDescriptor newEndpointDescriptor(long edesc)
edesc - The endpoint descriptor handlepublic static String getStringDescriptorAscii(long devh, int index) throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleindex - The index of the string descriptororg.lsst.ccs.drivers.commons.DriverExceptionpublic static int controlTransfer(long devh,
int type,
int rqst,
int value,
int index,
byte[] data,
int offset,
int leng,
int timeout)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handletype - The transfer typerqst - The request parametervalue - The value parameterindex - The index parameterdata - The array to or from which the data is transferredoffset - The offset to the start of the transferred dataleng - The number of bytes to transfertimeout - The timeout (ms)org.lsst.ccs.drivers.commons.DriverExceptionpublic static int bulkTransfer(long devh,
int endp,
byte[] data,
int offset,
int leng,
int timeout)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleendp - The endpoint address.data - The array to or from which the data is transferredoffset - The offset to the start of the transferred dataleng - The number of bytes to transfertimeout - The timeout (ms)org.lsst.ccs.drivers.commons.DriverExceptionpublic static int interruptTransfer(long devh,
int endp,
byte[] data,
int offset,
int leng,
int timeout)
throws org.lsst.ccs.drivers.commons.DriverException
devh - The open handleendp - The endpoint address.data - The array to or from which the data is transferredoffset - The offset to the start of the transferred dataleng - The number of bytes to transfertimeout - The timeout (ms)org.lsst.ccs.drivers.commons.DriverExceptionCopyright © 2015 LSST. All rights reserved.