public class ZtexDevice1 extends java.lang.Object implements HasName
ZtexScanBus1
.
The following table describes the ZTEX descriptor 1.
Field name | Offset | Size | Description | ||||||||||||||||||||||||||||||||||||||||||
ZTEX_DESCRIPTOR_SIZE | 0 | 1 | Size of the descriptor in bytes; must be 40 for descriptor version 1 | ||||||||||||||||||||||||||||||||||||||||||
ZTEX_DESCRIPTOR_VERSION | 1 | 1 | Descriptor version; 1 for version 1 | ||||||||||||||||||||||||||||||||||||||||||
ZTEXID | 2 | 4 | ID; must be "ZTEX" | ||||||||||||||||||||||||||||||||||||||||||
PRODUCT_ID | 6 | 4 | Four numbers (0..255) representing the product ID and firmware compatibility information. A firmware can overwrite an installed one if ( INSTALLED.PRODUCTID[0]==0 || PRODUCTID[0]==0 || INSTALLED.PRODUCTID[0]==PRODUCTID[0] ) && ( INSTALLED.PRODUCTID[1]==0 || PRODUCTID[1]==0 || INSTALLED.PRODUCTID[1]==PRODUCTID[1] ) && ( INSTALLED.PRODUCTID[2]==0 || PRODUCTID[2]==0 || INSTALLED.PRODUCTID[2]==PRODUCTID[2] ) && ( INSTALLED.PRODUCTID[3]==0 || PRODUCTID[3]==0 || INSTALLED.PRODUCTID[3]==PRODUCTID[3] )Here is a list of the preserved product ID's:
|
||||||||||||||||||||||||||||||||||||||||||
FW_VERSION | 10 | 1 | May be used to specify the firmware version. | ||||||||||||||||||||||||||||||||||||||||||
INTERFACE_VERSION | 11 | 1 | The interface version. This number specifies the protocol that is used for interfacing the host software. A description of interface version 1 can be found in Ztex1v1 |
||||||||||||||||||||||||||||||||||||||||||
INTERFACE_CAPABILITIES | 12 | 6 | 6 bytes, each bit represents a capability. If set, the capability is supported. A description of the capabilities of interface version 1 can be found in Ztex1v1 |
||||||||||||||||||||||||||||||||||||||||||
MODULE_RESERVED | 18 | 12 | 12 bytes for application specific use, i.e. they depend from the PRODUCT_ID | ||||||||||||||||||||||||||||||||||||||||||
SN_STRING | 30 | 10 | A serial number string of 10 characters. The default SN is "0000000000" |
Ztex1
,
Ztex1v1
,
ZtexScanBus1
Modifier and Type | Field and Description |
---|---|
static int |
cypressProductIdBuggy
Product ID of buggy FX3 devices (datecode 1149)
|
static int |
cypressProductIdFx2
EZ-USB USB FX2 product ID: 0x8613
|
static int |
cypressProductIdFx3
EZ-USB USB FX3 product ID: 0x00f3
|
static int |
cypressVendorId
Cypress vendor ID: 0x4b4
|
static int |
cypressVendorIdBuggy
Vendor ID of buggy FX3 devices (datecode 1149)
|
static int |
ztexProductId
USB product ID for ZTEX devices that support ZTEX descriptor 1: 0x100.
|
static int |
ztexProductIdMax
Largest USB product ID for ZTEX devices that support ZTEX descriptor 1: 0x1ff.
|
static int |
ztexVendorId
ZTEX vendor ID: 0x221a
|
Constructor and Description |
---|
ZtexDevice1(ZtexContext p_context,
org.usb4java.Device p_dev,
int pUsbVendorId,
int pUsbProductId,
boolean allowUnconfigured)
Constructs an instance from a given USB device.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
byteArrayString(byte[] buf)
Produces a nice string representation of an array of bytes.
|
boolean |
compatible(int productId0,
int productId1,
int productId2,
int productId3)
Checks whether the given product ID is compatible to the device.
|
ZtexContext |
context()
Returns the USB context of the device.
|
org.usb4java.Device |
dev()
Returns the USB device.
|
protected void |
finalize()
Releases all resources.
|
int |
fwVersion()
Returns the firmware version.
|
boolean |
fx3()
Returns true if device is an FX3
|
byte[] |
interfaceCapabilities()
Returns the interface capabilities (all 6 bytes).
|
int |
interfaceCapabilities(int i)
Returns byte i of the interface capabilities.
|
boolean |
interfaceCapabilities(int i,
int j)
Returns byte i, bit j of the interface capabilities.
|
int |
interfaceVersion()
Returns the interface version.
|
java.lang.String |
manufacturerString()
Returns the manufacturer string of the device.
|
byte[] |
moduleReserved()
Returns the application specific information (all 12 bytes).
|
int |
moduleReserved(int i)
Returns byte i of the application specific information.
|
java.lang.String |
name()
Returns a name that identifies the device.
|
static java.lang.String |
name(org.usb4java.Device p_dev)
Returns a name that identifies a device.
|
byte[] |
productId()
Returns the product ID (all 4 bytes).
|
int |
productId(int i)
Returns byte i of the product ID.
|
java.lang.String |
productString()
Returns the product string of the device.
|
void |
ref()
Increases reference counter.
|
void |
setName(java.lang.String n)
Set the name of the device which is returned by
name() . |
java.lang.String |
snString()
Returns the serial number string of the device.
|
java.lang.String |
toString()
Returns a string representation if the device with a lot of useful information.
|
void |
unref()
Decreases reference counter and rleases resources if 0 is reached.
|
int |
usbProductId()
Returns the USB product ID of the device.
|
int |
usbVendorId()
Returns the USB vendor ID of the device.
|
boolean |
valid()
Returns true if ZTEX descriptor 1 is available.
|
public static final int cypressVendorId
public static final int cypressProductIdFx2
public static final int cypressProductIdFx3
public static final int cypressVendorIdBuggy
public static final int cypressProductIdBuggy
public static final int ztexVendorId
public static final int ztexProductId
Please read the information about USB vendor and product ID's.
ztexProductIdMax
,
Constant Field Valuespublic static final int ztexProductIdMax
ztexProductId
+1 to ztexProductIdMax (0x101 to 0x1ff) are reserved for ZTEX devices and allow to identify products without reading the ZTEX descriptor.
Please read the information about USB vendor and product ID's.
ztexProductId
,
Constant Field Valuespublic ZtexDevice1(ZtexContext p_context, org.usb4java.Device p_dev, int pUsbVendorId, int pUsbProductId, boolean allowUnconfigured) throws UsbException, InvalidFirmwareException, DeviceNotSupportedException
InvalidFirmwareException
is thrown.
To suppress this behavior (e.g. if the EZ-USB device is known to be unconfigured) the vendor and product id's
can be set to -1.p_context
- The USB context.p_dev
- The USB device.pUsbVendorId
- The given vendor ID.pUsbProductId
- The given product ID.allowUnconfigured
- If true, unconfigured devices are allowed.UsbException
- if an USB communication error occurs.InvalidFirmwareException
- if no valid ZTEX descriptor 1 is found.DeviceNotSupportedException
- if the device has the wrong USB ID's.public static java.lang.String byteArrayString(byte[] buf)
buf
- A byte array.public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String name(org.usb4java.Device p_dev)
p_dev
- the device.public java.lang.String name()
setName(String)
, a string containing bus information is returned.public void setName(java.lang.String n)
name()
.n
- New name of the device or null in order to delete the name.public final boolean compatible(int productId0, int productId1, int productId2, int productId3)
if ( this.productId(0)==0 || productId0<0 || this.productId(0)==productId0 ) && ( this.productId(0)==0 || productId1<=0 || this.productId(1)==productId1 ) && ( this.productId(2)==0 || productId2<=0 || this.productId(2)==productId2 ) && ( this.productId(3)==0 || productId3<=0 || this.productId(3)==productId3 )
productId0
- Byte 0 of the given product IDproductId1
- Byte 1 of the given product IDproductId2
- Byte 2 of the given product IDproductId3
- Byte 3 of the given product IDpublic final org.usb4java.Device dev()
public final ZtexContext context()
public final boolean valid()
public final int usbVendorId()
public final int usbProductId()
public final java.lang.String manufacturerString()
public final java.lang.String productString()
public final java.lang.String snString()
public final byte[] productId()
public int productId(int i)
i
- indexpublic final int fwVersion()
public final int interfaceVersion()
public final byte[] interfaceCapabilities()
public final int interfaceCapabilities(int i)
i
- indexpublic final boolean interfaceCapabilities(int i, int j)
i
- byte indexj
- bit indexpublic final byte[] moduleReserved()
public final int moduleReserved(int i)
i
- indexpublic final boolean fx3()
public void ref() throws UsbException
UsbException
- if USB context can be initializedpublic void unref()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable