diff --git a/java/src/ch/ntb/usb/Device.java b/java/src/ch/ntb/usb/Device.java
index df9675d..dd44d16 100644
--- a/java/src/ch/ntb/usb/Device.java
+++ b/java/src/ch/ntb/usb/Device.java
@@ -27,7 +27,7 @@ public class Device {
private boolean resetOnFirstOpen, resetDone;
- private Usb_Device_Descriptor devDesc;
+ private int resetTimeout = 1000;
protected Device(short idVendor, short idProduct) {
resetOnFirstOpen = false;
@@ -81,7 +81,7 @@ public class Device {
while (bus != null) {
Usb_Device dev = bus.devices;
while (dev != null) {
- devDesc = dev.descriptor;
+ Usb_Device_Descriptor devDesc = dev.descriptor;
if ((devDesc.idVendor == idVendor)
&& (devDesc.idProduct == idProduct)) {
logger.info("Open device: " + dev.filename);
@@ -128,7 +128,7 @@ public class Device {
resetDone = true;
reset();
try {
- Thread.sleep(1000);
+ Thread.sleep(resetTimeout);
} catch (InterruptedException e) {
//
}
@@ -545,12 +545,17 @@ public class Device {
* If enabled, the device is reset when first opened.
* This will only happen once. When the application is started, the device
* state is unknown. If the device is not reset, read or write may result in
- * a {@link USBTimeoutException}.
+ * a {@link USBTimeoutException}.
+ *
+ * This feature is disabled by default.
*
* @param enable
* true if the device should be reset when first opened
+ * @param timeout
+ * the timeout between the reset and the reopening
*/
- public void setResetOnFirstOpen(boolean enable) {
+ public void setResetOnFirstOpen(boolean enable, int timeout) {
resetOnFirstOpen = enable;
+ resetTimeout = timeout;
}
}
diff --git a/java/src/ch/ntb/usb/LibusbWin.java b/java/src/ch/ntb/usb/LibusbWin.java
index 9b34c6a..0d32490 100644
--- a/java/src/ch/ntb/usb/LibusbWin.java
+++ b/java/src/ch/ntb/usb/LibusbWin.java
@@ -13,7 +13,8 @@ package ch.ntb.usb;
* kernel driver code.
*
* The API description of this class has been copied from the libusb documentation.
+ * href="http://libusb.sourceforge.net/documentation.html">libusb documentation
+ * and adapted where neccessary.
*
* @author schlaepfer
* @version DLL: 00.02.00
@@ -47,13 +48,15 @@ public class LibusbWin {
public static native int usb_find_devices();
/**
- * usb_get_busses simply returns the value of the global
- * variable usb_busses. This was implemented for those languages that
- * support C calling convention and can use shared libraries, but don't
- * support C global variables (like Delphi).
+ * usb_get_busses returns a tree of descriptor objects.
+ * The tree represents the bus structure with devices, configurations,
+ * interfaces and endpoints. Note that this is only a copy. To refresh the
+ * information, usb_getbusses() must be called again. The
+ * name of the objects contained in the tree is starting with
+ * Usb_.
*
- * @return the structure of all busses and devices. Note: The java
- * objects are copies of the C structs.
+ * @return the structure of all busses and devices. Note: The
+ * java objects are copies of the C structs.
*/
public static native Usb_Bus usb_get_busses();