diff --git a/.gitignore b/.gitignore index 5a3ecc8..351afa7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ target .classpath .project .idea +.vscode *.iml hs_err_*.log diff --git a/src/main/assembly/README.txt b/src/main/assembly/README.txt index 62f3f9b..e6b9c1c 100644 --- a/src/main/assembly/README.txt +++ b/src/main/assembly/README.txt @@ -11,6 +11,6 @@ libusb4java-*.jar (The native libraries for the various platforms) commons-lang3-*.jar (Apache Commons Lang library needed by usb4java) If you don't want usb4java to extract the native libraries into a temporary -directoy on each program start then you might want to distribute them in +directory on each program start then you might want to distribute them in extracted form with your application. Just make sure your classpath points to the directory where you extracted the JARs. diff --git a/src/main/java/org/usb4java/DescriptorUtils.java b/src/main/java/org/usb4java/DescriptorUtils.java index a30d1b6..75f281f 100644 --- a/src/main/java/org/usb4java/DescriptorUtils.java +++ b/src/main/java/org/usb4java/DescriptorUtils.java @@ -17,7 +17,7 @@ import java.util.Map; public final class DescriptorUtils { /** Mapping from USB class id to USB class name. */ - private static final Map CLASS_NAMES = + private static final Map CLASS_NAMES = new HashMap(); static @@ -35,8 +35,7 @@ public final class DescriptorUtils CLASS_NAMES.put(LibUsb.CLASS_SMART_CARD, "Smart Card"); CLASS_NAMES.put(LibUsb.CLASS_CONTENT_SECURITY, "Content Security"); CLASS_NAMES.put(LibUsb.CLASS_VIDEO, "Video"); - CLASS_NAMES.put(LibUsb.CLASS_PERSONAL_HEALTHCARE, - "Personal Healthcare"); + CLASS_NAMES.put(LibUsb.CLASS_PERSONAL_HEALTHCARE, "Personal Healthcare"); CLASS_NAMES.put(LibUsb.CLASS_DIAGNOSTIC_DEVICE, "Diagnostic Device"); CLASS_NAMES.put(LibUsb.CLASS_WIRELESS, "Wireless"); CLASS_NAMES.put(LibUsb.CLASS_APPLICATION, "Application"); @@ -137,7 +136,7 @@ public final class DescriptorUtils * @param product * The product string or null if unknown. * @param serial - * The serial number strsing or null if unknown. + * The serial number string or null if unknown. * @return The descriptor dump. */ public static String dump(final DeviceDescriptor descriptor, @@ -348,7 +347,7 @@ public final class DescriptorUtils return "Feedback"; case LibUsb.ISO_USAGE_TYPE_IMPLICIT: return "Implicit Feedback Data"; - case 3: + case 3: // b11 is considered "Reserved" according to USB 3.0 spec. return "Reserved"; default: diff --git a/src/main/java/org/usb4java/DeviceDescriptor.java b/src/main/java/org/usb4java/DeviceDescriptor.java index a79244d..81804f4 100644 --- a/src/main/java/org/usb4java/DeviceDescriptor.java +++ b/src/main/java/org/usb4java/DeviceDescriptor.java @@ -59,11 +59,11 @@ public final class DeviceDescriptor { return this.deviceDescriptorPointer; } - + /** * Returns the Java byte buffer which contains the descriptor structure. * - * @return The descriptor structur buffer. + * @return The descriptor structure buffer. */ public ByteBuffer getBuffer() { @@ -72,15 +72,15 @@ public final class DeviceDescriptor /** * Returns the size of this descriptor (in bytes). - * - * @return The size of this descriptor (in bytes). + * + * @return The size of this descriptor (in bytes). */ public native byte bLength(); /** * Returns the descriptor type. Will have value {@link LibUsb#DT_DEVICE} - * in this context. - * + * in this context. + * * @return The descriptor type. */ public native byte bDescriptorType(); @@ -88,88 +88,88 @@ public final class DeviceDescriptor /** * Returns the USB specification release number in binary-coded decimal. * A value of 0x0200 indicates USB 2.0, 0x0110 indicates USB 1.1, etc. - * + * * @return The USB specification release number. - */ + */ public native short bcdUSB(); /** * Returns the USB-IF class code for the device. See LibUSB.CLASS_* * constants. - * + * * @return The USB-IF class code. */ public native byte bDeviceClass(); /** - * Returns the USB-IF subclass code for the device, qualified by the + * Returns the USB-IF subclass code for the device, qualified by the * bDeviceClass value. - * + * * @return The USB-IF subclass code. - */ + */ public native byte bDeviceSubClass(); /** - * Returns the USB-IF protocol code for the device, qualified by the + * Returns the USB-IF protocol code for the device, qualified by the * bDeviceClass and bDeviceSubClass values. - * + * * @return The USB-IF protocol code. */ public native byte bDeviceProtocol(); /** * Returns the maximum packet size for endpoint 0. - * + * * @return The maximum packet site for endpoint 0. */ public native byte bMaxPacketSize0(); /** * Returns the USB-IF vendor ID. - * + * * @return The vendor ID */ public native short idVendor(); /** * Returns the USB-IF product ID. - * + * * @return The product ID. */ public native short idProduct(); /** * Returns the device release number in binary-coded decimal. - * + * * @return The device release number. */ public native short bcdDevice(); /** * Returns the index of the string descriptor describing manufacturer. - * + * * @return The manufacturer string descriptor index. */ public native byte iManufacturer(); /** * Returns the index of the string descriptor describing product. - * + * * @return The product string descriptor index. */ public native byte iProduct(); /** - * Returns the index of the string descriptor containing device serial + * Returns the index of the string descriptor containing device serial * number. - * + * * @return The serial number string descriptor index. */ public native byte iSerialNumber(); /** * Returns the number of possible configurations. - * + * * @return The number of possible configurations. */ public native byte bNumConfigurations(); diff --git a/src/main/java/org/usb4java/SsEndpointCompanionDescriptor.java b/src/main/java/org/usb4java/SsEndpointCompanionDescriptor.java index 9a63d3a..2093463 100644 --- a/src/main/java/org/usb4java/SsEndpointCompanionDescriptor.java +++ b/src/main/java/org/usb4java/SsEndpointCompanionDescriptor.java @@ -36,7 +36,7 @@ public final class SsEndpointCompanionDescriptor /** * Constructs a new descriptor which can be passed to the - * {@link LibUsb#getSsEndpointCompanionDescriptor(Context, + * {@link LibUsb#getSsEndpointCompanionDescriptor(Context, * EndpointDescriptor, SsEndpointCompanionDescriptor)} * method. */ @@ -144,7 +144,7 @@ public final class SsEndpointCompanionDescriptor return false; } - final SsEndpointCompanionDescriptor other = + final SsEndpointCompanionDescriptor other = (SsEndpointCompanionDescriptor) obj; return new EqualsBuilder() diff --git a/src/test/java/org/usb4java/DeviceListIteratorTest.java b/src/test/java/org/usb4java/DeviceListIteratorTest.java index dd16e17..212735a 100644 --- a/src/test/java/org/usb4java/DeviceListIteratorTest.java +++ b/src/test/java/org/usb4java/DeviceListIteratorTest.java @@ -82,7 +82,7 @@ public class DeviceListIteratorTest * a {@link NoSuchElementException} when accessing elements after the end */ @Test(expected = NoSuchElementException.class) - public void testNextAfterend() + public void testNextAfterEnd() { assumeUsbTestsEnabled(); while (this.iterator.hasNext()) { diff --git a/src/test/java/org/usb4java/DeviceListTest.java b/src/test/java/org/usb4java/DeviceListTest.java index 090abdc..5a0bd1b 100644 --- a/src/test/java/org/usb4java/DeviceListTest.java +++ b/src/test/java/org/usb4java/DeviceListTest.java @@ -76,7 +76,7 @@ public class DeviceListTest LibUsb.freeDeviceList(b, true); } } - + /** * Tests the {@link DeviceList#hashCode()} method. */ @@ -95,7 +95,7 @@ public class DeviceListTest LibUsb.freeDeviceList(list, true); } } - + /** * Tests the {@link DeviceList#toString()} method */ @@ -115,7 +115,7 @@ public class DeviceListTest LibUsb.freeDeviceList(list, true); } } - + /** * Tests the {@link DeviceList#getPointer()} method */ diff --git a/src/test/java/org/usb4java/LibUsbDeviceTest.java b/src/test/java/org/usb4java/LibUsbDeviceTest.java index 0bdb523..abd7d29 100644 --- a/src/test/java/org/usb4java/LibUsbDeviceTest.java +++ b/src/test/java/org/usb4java/LibUsbDeviceTest.java @@ -38,7 +38,7 @@ import org.usb4java.LibUsb; */ public class LibUsbDeviceTest { - /** The libusb contxet. */ + /** The libusb context. */ private Context context; /** The device to run the tests on. */ @@ -785,7 +785,7 @@ public class LibUsbDeviceTest } /** - * Validates the specified endpoint desriptor. + * Validates the specified endpoint descriptor. * * @param desc * The endpoint descriptor to validate. diff --git a/src/test/java/org/usb4java/LibUsbGlobalTest.java b/src/test/java/org/usb4java/LibUsbGlobalTest.java index 84c8ecd..10c74fd 100644 --- a/src/test/java/org/usb4java/LibUsbGlobalTest.java +++ b/src/test/java/org/usb4java/LibUsbGlobalTest.java @@ -27,7 +27,7 @@ import org.usb4java.LibUsb; */ public class LibUsbGlobalTest { - /** The libusb contxet. */ + /** The libusb context. */ private Context context; /** @@ -63,6 +63,7 @@ public class LibUsbGlobalTest * Tests the {@link LibUsb#setDebug(Context, int)} method. */ @Test + @Deprecated public void testSetDebug() { assumeUsbTestsEnabled(); diff --git a/src/test/java/org/usb4java/LibUsbHotplugTest.java b/src/test/java/org/usb4java/LibUsbHotplugTest.java index 1eaadfc..dafa218 100644 --- a/src/test/java/org/usb4java/LibUsbHotplugTest.java +++ b/src/test/java/org/usb4java/LibUsbHotplugTest.java @@ -18,12 +18,12 @@ import org.junit.Test; /** * Tests the hotplug part of the {@link LibUsb} class. - * + * * @author Klaus Reimer (k@ailis.de) */ public class LibUsbHotplugTest { - /** The libusb contxet. */ + /** The libusb context. */ private Context context; /** @@ -95,7 +95,7 @@ public class LibUsbHotplugTest } /** - * Ensures that no hotplug event is fired when enumeration is deactived. + * Ensures that no hotplug event is fired when enumeration is deactivated. * When no devices are connected then this test is pretty much useless but * won't fail because of that. */ diff --git a/src/test/java/org/usb4java/TransferTest.java b/src/test/java/org/usb4java/TransferTest.java index facb0e8..c2d852e 100644 --- a/src/test/java/org/usb4java/TransferTest.java +++ b/src/test/java/org/usb4java/TransferTest.java @@ -30,7 +30,7 @@ import org.usb4java.Transfer; */ public class TransferTest { - /** The libusb contxet. */ + /** The libusb context. */ private Context context; /** diff --git a/src/test/java/org/usb4java/test/UsbAssume.java b/src/test/java/org/usb4java/test/UsbAssume.java index 1b9f22f..7445ce8 100644 --- a/src/test/java/org/usb4java/test/UsbAssume.java +++ b/src/test/java/org/usb4java/test/UsbAssume.java @@ -15,7 +15,7 @@ import org.usb4java.LibUsb; /** * USB-related assumptions. - * + * * @author Klaus Reimer (k@ailis.de) */ public class UsbAssume @@ -25,16 +25,16 @@ public class UsbAssume /** If TCK tests are to be executed. */ private static Boolean tckTests; - + /** * Check if USB tests are enabled. - * + * * USB tests can be controlled with the system property USB_TESTS. When * set to true then USB tests are always run, if set to false then they * are never run. If this property is not set then the command-line tool * lsusb is called. If this tool returned at least two lines of text then * USB tests are enabled. In all other cases they are disabled. - * + * * @return True if USB tests are enabled, false if not. */ public static boolean isUsbTestsEnabled() @@ -86,7 +86,7 @@ public class UsbAssume * Assume that USB tests are enabled. Call this in the first line of * tests method or preparation methods when you want to ignore the * tests when the system is not able to run the tests anyway. - * + * * USB tests can be controlled with the system property USB_TESTS. When * set to true then USB tests are always run, if set to false then they * are never run. If this property is not set then the command-line tool @@ -117,7 +117,7 @@ public class UsbAssume * Assume that TCK tests are enabled. Call this in the first line of * tests method or preparation methods when you want to ignore the * tests when the system is not able to run the TCK tests anyway. - * + * * TCK tests can be controlled with the system property TCK_TESTS. When * set to true then TCK tests are always run, if set to false then they * are never run. If this property is not set then the command-line tool