- some USB constants added
- javadoc updates git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@141 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
@@ -135,7 +135,7 @@ public class Device {
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the claimed interface and close the opened device.
|
||||
* Release the claimed interface and close the opened device.<br>
|
||||
*
|
||||
* @throws USBException
|
||||
*/
|
||||
@@ -156,7 +156,8 @@ public class Device {
|
||||
|
||||
/**
|
||||
* Sends an USB reset to the device. The device handle will no longer be
|
||||
* valid. To use the device again, <code>open</code> must be called.
|
||||
* valid. To use the device again, {@link #open(int, int, int)} must be
|
||||
* called.
|
||||
*
|
||||
* @throws USBException
|
||||
*/
|
||||
@@ -297,7 +298,7 @@ public class Device {
|
||||
}
|
||||
|
||||
/**
|
||||
* Claim an interface to send and receive USB data.
|
||||
* Claim an interface to send and receive USB data.<br>
|
||||
*
|
||||
* @param usb_dev_handle
|
||||
* the handle of the device <b>(MUST BE VALID)</b>
|
||||
@@ -328,7 +329,7 @@ public class Device {
|
||||
}
|
||||
|
||||
/**
|
||||
* Release a previously claimed interface.
|
||||
* Release a previously claimed interface.<br>
|
||||
*
|
||||
* @param dev_handle
|
||||
* the handle of the device <b>(MUST BE VALID)</b>
|
||||
@@ -396,7 +397,10 @@ public class Device {
|
||||
* Returns the maximum packet size in bytes which is allowed to be
|
||||
* transmitted at once.<br>
|
||||
* The value is determined by reading the endpoint descriptor(s) when
|
||||
* opening the device. It is invalid before the device is opened!
|
||||
* opening the device. It is invalid before the device is opened! Note that
|
||||
* if some endpoints use different packet sizes the maximum packet size is
|
||||
* return. This value may be used to determine if a device is opened in
|
||||
* fullspeed or highspeed mode.
|
||||
*
|
||||
* @return the maximum packet size
|
||||
*/
|
||||
@@ -405,13 +409,15 @@ public class Device {
|
||||
}
|
||||
|
||||
/**
|
||||
* If enabled, the device is reset when first opened. This will only happen
|
||||
* once.
|
||||
* If enabled, the device is reset when first opened. <br>
|
||||
* 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}.
|
||||
*
|
||||
* @param enable
|
||||
* true if the device should be reset when first opened
|
||||
*/
|
||||
public void setResetOnFirstOpen(boolean enable) {
|
||||
resetOnFirstOpen = enable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
package ch.ntb.usb;
|
||||
|
||||
/**
|
||||
* This class represents the Java Native Interface to the LibUsbWin.dll.<br>
|
||||
* <br>
|
||||
* <h1>Project Description</h1>
|
||||
* Java LibUsb-Win32 is a Java wrapper for the LibUsb-Win32 USB library. <a
|
||||
* href="http://libusb-win32.sourceforge.net/">LibUsb-Win32</a> is a port of
|
||||
* the USB library <a href="http://libusb.sourceforge.net/">libusb</a> to the
|
||||
* Windows operating systems. The library allows user space applications to
|
||||
* access any USB device on Windows in a generic way without writing any line of
|
||||
* kernel driver code.
|
||||
*
|
||||
* @author schlaepfer
|
||||
*
|
||||
*/
|
||||
public class LibusbWin {
|
||||
|
||||
// Core
|
||||
|
||||
@@ -32,7 +32,7 @@ public class USB {
|
||||
|
||||
/**
|
||||
* Create a new device an register it in a device queue or get an already
|
||||
* created device.
|
||||
* created device.<br>
|
||||
*
|
||||
* @param idVendor
|
||||
* the vendor id of the USB device
|
||||
@@ -55,7 +55,7 @@ public class USB {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an already registered device or null if the device does not exist.
|
||||
* Get an already registered device or null if the device does not exist.<br>
|
||||
*
|
||||
* @param idVendor
|
||||
* the vendor id of the USB device
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ch.ntb.usb;
|
||||
|
||||
public class Usb_Config_Descriptor {
|
||||
public static final int USB_MAXCONFIG = 8;
|
||||
|
||||
public byte bLength;
|
||||
|
||||
public byte bDescriptorType;
|
||||
|
||||
@@ -1,6 +1,43 @@
|
||||
package ch.ntb.usb;
|
||||
|
||||
public class Usb_Device_Descriptor {
|
||||
/*
|
||||
* Device and/or Interface Class codes
|
||||
*/
|
||||
public static final int USB_CLASS_PER_INTERFACE = 0;
|
||||
public static final int USB_CLASS_AUDIO = 1;
|
||||
public static final int USB_CLASS_COMM = 2;
|
||||
public static final int USB_CLASS_HID = 3;
|
||||
public static final int USB_CLASS_PRINTER = 7;
|
||||
public static final int USB_CLASS_MASS_STORAGE = 8;
|
||||
public static final int USB_CLASS_HUB = 9;
|
||||
public static final int USB_CLASS_DATA = 10;
|
||||
public static final int USB_CLASS_VENDOR_SPEC = 0xff;
|
||||
|
||||
/*
|
||||
* Descriptor types
|
||||
*/
|
||||
public static final int USB_DT_DEVICE = 0x01;
|
||||
public static final int USB_DT_CONFIG = 0x02;
|
||||
public static final int USB_DT_STRING = 0x03;
|
||||
public static final int USB_DT_INTERFACE = 0x04;
|
||||
public static final int USB_DT_ENDPOINT = 0x05;
|
||||
|
||||
public static final int USB_DT_HID = 0x21;
|
||||
public static final int USB_DT_REPORT = 0x22;
|
||||
public static final int USB_DT_PHYSICAL = 0x23;
|
||||
public static final int USB_DT_HUB = 0x29;
|
||||
|
||||
/*
|
||||
* Descriptor sizes per descriptor type
|
||||
*/
|
||||
public static final int USB_DT_DEVICE_SIZE = 18;
|
||||
public static final int USB_DT_CONFIG_SIZE = 9;
|
||||
public static final int USB_DT_INTERFACE_SIZE = 9;
|
||||
public static final int USB_DT_ENDPOINT_SIZE = 7;
|
||||
public static final int USB_DT_ENDPOINT_AUDIO_SIZE = 9; /* Audio extension */
|
||||
public static final int USB_DT_HUB_NONVAR_SIZE = 7;
|
||||
|
||||
public byte bLength;
|
||||
|
||||
public byte bDescriptorType;
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
package ch.ntb.usb;
|
||||
|
||||
public class Usb_Endpoint_Descriptor {
|
||||
public static final int USB_MAXENDPOINTS = 32;
|
||||
|
||||
/* in bEndpointAddress */
|
||||
public static final int USB_ENDPOINT_ADDRESS_MASK = 0x0f;
|
||||
public static final int USB_ENDPOINT_DIR_MASK = 0x80;
|
||||
|
||||
/* in bmAttributes */
|
||||
public static final int USB_ENDPOINT_TYPE_MASK = 0x03;
|
||||
public static final int USB_ENDPOINT_TYPE_CONTROL = 0;
|
||||
public static final int USB_ENDPOINT_TYPE_ISOCHRONOUS = 1;
|
||||
public static final int USB_ENDPOINT_TYPE_BULK = 2;
|
||||
public static final int USB_ENDPOINT_TYPE_INTERRUPT = 3;
|
||||
|
||||
public byte bLength;
|
||||
|
||||
public byte bDescriptorType;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ch.ntb.usb;
|
||||
|
||||
public class Usb_Interface {
|
||||
public static final int USB_MAXALTSETTING = 128; /* Hard limit */
|
||||
|
||||
public Usb_Interface_Descriptor[] altsetting;
|
||||
|
||||
public int num_altsetting;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ch.ntb.usb;
|
||||
|
||||
public class Usb_Interface_Descriptor {
|
||||
public static final int USB_MAXINTERFACES = 32;
|
||||
|
||||
public byte bLength;
|
||||
|
||||
public byte bDescriptorType;
|
||||
|
||||
Reference in New Issue
Block a user