Fix formatting properly and remove trailing white-spaces.

This commit is contained in:
Luca Longinotti 2013-07-15 16:31:55 +02:00
parent 974d277459
commit 2bb24448a1
24 changed files with 509 additions and 509 deletions

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -23,10 +23,10 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
/**
* A structure representing the Binary Device Object Store (BOS) descriptor.
*
*
* This descriptor is documented in section 9.6.2 of the USB 3.0 specification.
* All multiple-byte fields are represented in host-endian format.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class BosDescriptor
@ -45,7 +45,7 @@ public final class BosDescriptor
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -55,42 +55,42 @@ public final class BosDescriptor
/**
* Returns the size of this descriptor (in bytes).
*
*
* @return The descriptor size in bytes;
*/
public native byte bLength();
/**
* Returns the descriptor type.
*
*
* @return The descriptor type.
*/
public native byte bDescriptorType();
/**
* Returns the length of this descriptor and all of its sub descriptors.
*
*
* @return The total descriptor length.
*/
public native short wTotalLength();
/**
* Returns the number of separate device capability descriptors in the BOS.
*
*
* @return The number of device capability descriptors.
*/
public native byte bNumDeviceCaps();
/**
* Returns the array with the device capability descriptors.
*
*
* @return The array with device capability descriptors.
*/
public native BosDevCapabilityDescriptor[] devCapability();
/**
* Returns a dump of this descriptor.
*
*
* @return The descriptor dump.
*/
public String dump()
@ -125,11 +125,11 @@ public final class BosDescriptor
}
final BosDescriptor other = (BosDescriptor) obj;
return new EqualsBuilder()
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.wTotalLength(), other.wTotalLength())
.append(this.bNumDeviceCaps(), other.bNumDeviceCaps())
.append(this.devCapability(), other.devCapability()).isEquals();
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.wTotalLength(), other.wTotalLength())
.append(this.bNumDeviceCaps(), other.bNumDeviceCaps())
.append(this.devCapability(), other.devCapability()).isEquals();
}
@Override

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -27,10 +27,10 @@ import de.ailis.usb4java.utils.DescriptorUtils;
/**
* A generic representation of a BOS Device Capability descriptor.
*
*
* It is advised to check bDevCapabilityType and call the matching
* get*Descriptor method to get a structure fully matching the type.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class BosDevCapabilityDescriptor
@ -49,7 +49,7 @@ public final class BosDevCapabilityDescriptor
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -59,35 +59,35 @@ public final class BosDevCapabilityDescriptor
/**
* Returns the size of this descriptor (in bytes).
*
*
* @return The descriptor size in bytes;
*/
public native byte bLength();
/**
* Returns the descriptor type.
*
*
* @return The descriptor type.
*/
public native byte bDescriptorType();
/**
* Returns the device capability type.
*
*
* @return The device capability type.
*/
public native byte bDevCapabilityType();
/**
* Returns the device capability data (bLength - 3 bytes).
*
*
* @return The device capability data.
*/
public native ByteBuffer devCapabilityData();
/**
* Returns a dump of this descriptor.
*
*
* @return The descriptor dump.
*/
public String dump()
@ -96,11 +96,11 @@ public final class BosDevCapabilityDescriptor
"BOS Device Capability Descriptor:%n" + " bLength %18d%n"
+ " bDescriptorType %10d%n" + " bDevCapabilityType %7s%n"
+ " devCapabilityData:%n%s%n",
this.bLength() & 0xff,
this.bDescriptorType() & 0xff,
this.bDevCapabilityType() & 0xff,
DescriptorUtils.dump(this.devCapabilityData()).replaceAll("(?m)^",
" "));
this.bLength() & 0xff,
this.bDescriptorType() & 0xff,
this.bDevCapabilityType() & 0xff,
DescriptorUtils.dump(this.devCapabilityData()).replaceAll("(?m)^",
" "));
}
@ -121,11 +121,11 @@ public final class BosDevCapabilityDescriptor
}
final BosDevCapabilityDescriptor other = (BosDevCapabilityDescriptor) obj;
return new EqualsBuilder()
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.bDevCapabilityType(), other.bDevCapabilityType())
.append(this.devCapabilityData().array(),
other.devCapabilityData().array()).isEquals();
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.bDevCapabilityType(), other.bDevCapabilityType())
.append(this.devCapabilityData().array(),
other.devCapabilityData().array()).isEquals();
}
@Override

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -29,10 +29,10 @@ import de.ailis.usb4java.utils.DescriptorUtils;
/**
* A structure representing the standard USB configuration descriptor.
*
*
* This descriptor is documented in section 9.6.3 of the USB 3.0 specification.
* All multiple-byte fields are represented in host-endian format.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class ConfigDescriptor implements UsbConfigurationDescriptor
@ -51,7 +51,7 @@ public final class ConfigDescriptor implements UsbConfigurationDescriptor
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -85,31 +85,31 @@ public final class ConfigDescriptor implements UsbConfigurationDescriptor
/**
* Returns the array with interfaces supported by this configuration.
*
*
* @return The array with interfaces.
*/
public native Interface[] iface();
/**
* Extra descriptors.
*
*
* If libusb encounters unknown interface descriptors, it will store them
* here, should you wish to parse them.
*
*
* @return The extra descriptors.
*/
public native ByteBuffer extra();
/**
* Length of the extra descriptors, in bytes.
*
*
* @return The extra descriptors length.
*/
public native int extraLength();
/**
* Returns a dump of this descriptor.
*
*
* @return The descriptor dump.
*/
public String dump()

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -27,11 +27,11 @@ import de.ailis.usb4java.utils.DescriptorUtils;
/**
* A structure representing the Container ID descriptor.
*
*
* This descriptor is documented in section 9.6.2.3 of the USB 3.0
* specification. All multiple-byte fields, except UUIDs, are represented in
* host-endian format.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class ContainerIdDescriptor
@ -51,7 +51,7 @@ public final class ContainerIdDescriptor
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -61,42 +61,42 @@ public final class ContainerIdDescriptor
/**
* Returns the size of this descriptor (in bytes).
*
*
* @return The descriptor size in bytes;
*/
public native byte bLength();
/**
* Returns the descriptor type.
*
*
* @return The descriptor type.
*/
public native byte bDescriptorType();
/**
* Returns the device capability type.
*
*
* @return The device capability type.
*/
public native byte bDevCapabilityType();
/**
* Returns the reserved field.
*
*
* @return The reserved field.
*/
public native byte bReserved();
/**
* Returns the 128 bit UUID.
*
*
* @return The 128 bit UUID.
*/
public native ByteBuffer containerId();
/**
* Returns a dump of this descriptor.
*
*
* @return The descriptor dump.
*/
public String dump()
@ -105,9 +105,9 @@ public final class ContainerIdDescriptor
+ " bDescriptorType %10d%n" + " bDevCapabilityType %7d%n"
+ " bReserved %16d%n" + " containerId:%n%s%n",
this.bLength() & 0xff, this.bDescriptorType() & 0xff, this
.bDevCapabilityType() & 0xff, this.bReserved() & 0xff,
.bDevCapabilityType() & 0xff, this.bReserved() & 0xff,
DescriptorUtils.dump(this.containerId())
.replaceAll("(?m)^", " "));
.replaceAll("(?m)^", " "));
}
@Override
@ -127,12 +127,12 @@ public final class ContainerIdDescriptor
}
final ContainerIdDescriptor other = (ContainerIdDescriptor) obj;
return new EqualsBuilder()
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.bDevCapabilityType(), other.bDevCapabilityType())
.append(this.bReserved(), other.bReserved())
.append(this.containerId().array(), other.containerId().array())
.isEquals();
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.bDevCapabilityType(), other.bDevCapabilityType())
.append(this.bReserved(), other.bReserved())
.append(this.containerId().array(), other.containerId().array())
.isEquals();
}
@Override

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -26,13 +26,13 @@ package de.ailis.usb4java.libusb;
* {@link LibUsb#setDebug(Context, int)} will not affect the other user of the
* library, and {@link LibUsb#exit(Context)} will not destroy resources that the
* other user is still using.
*
*
* Sessions are created by {@link LibUsb#init(Context)} and destroyed through
* {@link LibUsb#exit(Context)}. If your application is guaranteed to only ever
* include a single libusb user (i.e. you), you do not have to worry about
* contexts: pass NULL in every function call where a context is required. The
* default context will be used.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class Context
@ -51,7 +51,7 @@ public final class Context
/**
* Returns the native pointer to the context structure.
*
*
* @return The native pointer to the context structure.
*/
public long getPointer()

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -20,14 +20,14 @@ package de.ailis.usb4java.libusb;
/**
* Structure representing a USB device detected on the system.
*
*
* This is an opaque type for which you are only ever provided with a pointer,
* usually originating from {@link LibUsb#getDeviceList(Context, DeviceList)}.
*
*
* Certain operations can be performed on a device, but in order to do any I/O
* you will have to first obtain a device handle using
* {@link LibUsb#open(Device, DeviceHandle)}.
*
*
* Devices are reference counted with {@link LibUsb#refDevice(Device)} and
* {@link LibUsb#unrefDevice(Device)}, and are freed when the reference count
* reaches 0. New devices presented by
@ -36,7 +36,7 @@ package de.ailis.usb4java.libusb;
* decrease the reference count on all devices in the list.
* {@link LibUsb#open(Device, DeviceHandle)} adds another reference which is
* later destroyed by {@link LibUsb#close(DeviceHandle)}.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class Device
@ -55,7 +55,7 @@ public final class Device
/**
* Returns the native pointer to the device structure.
*
*
* @return The native pointer to the device structure.
*/
public long getPointer()

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -27,10 +27,10 @@ import de.ailis.usb4java.utils.DescriptorUtils;
/**
* A structure representing the standard USB device descriptor.
*
*
* This descriptor is documented in section 9.6.1 of the USB 3.0 specification.
* All multiple-byte fields are represented in host-endian format.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class DeviceDescriptor implements UsbDeviceDescriptor
@ -49,7 +49,7 @@ public final class DeviceDescriptor implements UsbDeviceDescriptor
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -101,7 +101,7 @@ public final class DeviceDescriptor implements UsbDeviceDescriptor
/**
* Returns a dump of this descriptor.
*
*
* @return The descriptor dump.
*/
public String dump()
@ -111,7 +111,7 @@ public final class DeviceDescriptor implements UsbDeviceDescriptor
/**
* Returns a dump of this descriptor.
*
*
* @param handle
* The USB device handle for resolving string descriptors. If
* null then no strings are resolved.

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -20,13 +20,13 @@ package de.ailis.usb4java.libusb;
/**
* Structure representing a handle on a USB device.
*
*
* This is an opaque type for which you are only ever provided with a pointer,
* usually originating from {@link LibUsb#open(Device, DeviceHandle)}.
*
*
* A device handle is used to perform I/O and other operations. When finished
* with a device handle, you should call {@link LibUsb#close(DeviceHandle)}.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class DeviceHandle
@ -46,7 +46,7 @@ public final class DeviceHandle
/**
* Returns the native pointer to the device handle structure.
*
*
* @return The native pointer to the device handle structure.
*/
public long getPointer()

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -23,7 +23,7 @@ import java.util.Iterator;
/**
* List of devices as returned by
* {@link LibUsb#getDeviceList(Context, DeviceList)}.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class DeviceList implements Iterable<Device>
@ -45,7 +45,7 @@ public final class DeviceList implements Iterable<Device>
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -55,7 +55,7 @@ public final class DeviceList implements Iterable<Device>
/**
* Returns the number of devices in the list.
*
*
* @return The number of devices in the list.
*/
public int getSize()
@ -65,7 +65,7 @@ public final class DeviceList implements Iterable<Device>
/**
* Returns the device with the specified index.
*
*
* @param index
* The device index.
* @return The device or null when index is out of bounds.

View File

@ -9,7 +9,7 @@ import java.util.Iterator;
/**
* Iterator for device list.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
final class DeviceListIterator implements Iterator<Device>
@ -22,7 +22,7 @@ final class DeviceListIterator implements Iterator<Device>
/**
* Constructor.
*
*
* @param devices
* The devices list.
*/

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -29,10 +29,10 @@ import de.ailis.usb4java.utils.DescriptorUtils;
/**
* A structure representing the standard USB endpoint descriptor.
*
*
* This descriptor is documented in section 9.6.6 of the USB 3.0 specification.
* All multiple-byte fields are represented in host-endian format.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class EndpointDescriptor implements UsbEndpointDescriptor
@ -51,7 +51,7 @@ public final class EndpointDescriptor implements UsbEndpointDescriptor
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -80,45 +80,45 @@ public final class EndpointDescriptor implements UsbEndpointDescriptor
/**
* For audio devices only: the rate at which synchronization feedback is
* provided.
*
*
* @return The synchronization feedback rate.
*/
public native byte bRefresh();
/**
* For audio devices only: the address of the synch endpoint.
*
*
* @return The synch endpoint address.
*/
public native byte bSynchAddress();
/**
* Extra descriptors.
*
*
* If libusb encounters unknown endpoint descriptors, it will store them
* here, should you wish to parse them.
*
*
* @return The extra descriptors.
*/
public native ByteBuffer extra();
/**
* Length of the extra descriptors, in bytes.
*
*
* @return The extra descriptors length.
*/
public native int extraLength();
/**
* Returns a dump of this descriptor.
*
*
* @return The descriptor dump.
*/
public String dump()
{
return String.format(
"%s%n" + " extralen %17d%n" + " extra:%n" + "%s", DescriptorUtils
.dump(this), this.extraLength(),
.dump(this), this.extraLength(),
DescriptorUtils.dump(this.extra()).replaceAll("(?m)^", " "));
}

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -23,7 +23,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
/**
* A collection of alternate settings for a particular USB interface.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class Interface
@ -42,7 +42,7 @@ public final class Interface
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -53,21 +53,21 @@ public final class Interface
/**
* Returns the array with interface descriptors. The length of this array is
* determined by the {@link #numAltsetting()} field.
*
*
* @return The array with interface descriptors.
*/
public native InterfaceDescriptor[] altsetting();
/**
* Returns the number of alternate settings that belong to this interface.
*
*
* @return The number of alternate settings.
*/
public native int numAltsetting();
/**
* Returns a dump of this interface.
*
*
* @return The interface dump.
*/
public String dump()
@ -111,8 +111,8 @@ public final class Interface
final Interface other = (Interface) obj;
return new EqualsBuilder()
.append(this.altsetting(), other.altsetting())
.append(this.numAltsetting(), other.numAltsetting()).isEquals();
.append(this.altsetting(), other.altsetting())
.append(this.numAltsetting(), other.numAltsetting()).isEquals();
}
@Override

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -29,10 +29,10 @@ import de.ailis.usb4java.utils.DescriptorUtils;
/**
* A structure representing the standard USB interface descriptor.
*
*
* This descriptor is documented in section 9.6.5 of the USB 3.0 specification.
* All multiple-byte fields are represented in host-endian format.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class InterfaceDescriptor implements UsbInterfaceDescriptor
@ -51,7 +51,7 @@ public final class InterfaceDescriptor implements UsbInterfaceDescriptor
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -88,31 +88,31 @@ public final class InterfaceDescriptor implements UsbInterfaceDescriptor
/**
* Returns the array with endpoints.
*
*
* @return The array with endpoints.
*/
public native EndpointDescriptor[] endpoint();
/**
* Extra descriptors.
*
*
* If libusb encounters unknown interface descriptors, it will store them
* here, should you wish to parse them.
*
*
* @return The extra descriptors.
*/
public native ByteBuffer extra();
/**
* Length of the extra descriptors, in bytes.
*
*
* @return The extra descriptors length.
*/
public native int extraLength();
/**
* Returns a dump of this descriptor.
*
*
* @return The descriptor dump.
*/
public String dump()

View File

@ -16,7 +16,7 @@ public final class IsoPacketDescriptor
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -22,7 +22,7 @@ import javax.usb.UsbException;
/**
* libusb-specific USB exception.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class LibUsbException extends UsbException
@ -35,7 +35,7 @@ public final class LibUsbException extends UsbException
/**
* Constructor.
*
*
* @param message
* The error message.
* @param errorCode
@ -50,7 +50,7 @@ public final class LibUsbException extends UsbException
/**
* Returns the error code.
*
*
* @return The error code
*/
public int getErrorCode()

View File

@ -14,7 +14,7 @@ import java.net.URL;
/**
* Utility class to load native libraries from classpath.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class Loader
@ -80,7 +80,7 @@ public final class Loader
* "osx" or (for any other non-supported platform) the value of the
* "os.name" property converted to lower case and with removed space
* characters.
*
*
* @return The operating system name.
*/
private static String getOS()
@ -103,7 +103,7 @@ public final class Loader
* names i386 und amd64 are converted accordingly) or (when platform is
* unsupported) the value of os.arch converted to lower-case and with
* removed space characters.
*
*
* @return The CPU architecture
*/
private static String getArch()
@ -123,7 +123,7 @@ public final class Loader
/**
* Returns the shared library extension name.
*
*
* @return The shared library extension name.
*/
private static String getExt()
@ -155,7 +155,7 @@ public final class Loader
/**
* Creates the temporary directory used for unpacking the native libraries.
* This directory is marked for deletion on exit.
*
*
* @return The temporary directory for native libraries.
*/
private static File createTempDirectory()
@ -191,7 +191,7 @@ public final class Loader
/**
* Returns the platform name. This could be for example "linux-x86" or
* "windows-x86_64".
*
*
* @return The architecture name. Never null.
*/
private static String getPlatform()
@ -202,7 +202,7 @@ public final class Loader
/**
* Returns the name of the usb4java native library. This could be
* "libusb4java.dll" for example.
*
*
* @return The usb4java native library name. Never null.
*/
private static String getLibName()
@ -214,7 +214,7 @@ public final class Loader
* Returns the name of the libusb native library. This could be
* "libusb0.dll" for example or null if this library is not needed on the
* current platform (Because it is provided by the operating system).
*
*
* @return The libusb native library name or null if not needed.
*/
private static String getExtraLibName()
@ -229,7 +229,7 @@ public final class Loader
/**
* Copies the specified input stream to the specified output file.
*
*
* @param input
* The input stream.
* @param output
@ -239,7 +239,7 @@ public final class Loader
*/
private static void copy(final InputStream input, final File output)
throws IOException
{
{
final byte[] buffer = new byte[BUFFER_SIZE];
final FileOutputStream stream = new FileOutputStream(output);
try
@ -254,11 +254,11 @@ public final class Loader
{
stream.close();
}
}
}
/**
* Extracts a single library.
*
*
* @param platform
* The platform name (For example "linux-x86")
* @param lib
@ -333,7 +333,7 @@ public final class Loader
* times. Duplicate calls are ignored. This method is automatically called
* when the {@link LibUsb} class is loaded. When you need to do it earlier
* (To catch exceptions for example) then simply call this method manually.
*
*
* @throws LoaderException
* When loading the native wrapper libraries failed.
*/

View File

@ -7,7 +7,7 @@ package de.ailis.usb4java.libusb;
/**
* Thrown when JNI library could not be loaded.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class LoaderException extends RuntimeException
@ -17,7 +17,7 @@ public final class LoaderException extends RuntimeException
/**
* Constructor.
*
*
* @param message
* The error message.
*/
@ -28,7 +28,7 @@ public final class LoaderException extends RuntimeException
/**
* Constructor.
*
*
* @param message
* The error message.
* @param cause

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -22,7 +22,7 @@ import java.io.FileDescriptor;
/**
* Listener interface for pollfd notifications.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public interface PollfdListener
@ -30,7 +30,7 @@ public interface PollfdListener
/**
* Callback function, invoked when a new file descriptor should be added to
* the set of file descriptors monitored for events.
*
*
* @param fd
* the new file descriptor.
* @param events
@ -43,10 +43,10 @@ public interface PollfdListener
/**
* Callback function, invoked when a file descriptor should be removed from
* the set of file descriptors being monitored for events.
*
*
* After returning from this callback, do not use that file descriptor
* again.
*
*
* @param fd
* The file descriptor to stop monitoring.
* @param userData

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -23,10 +23,10 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
/**
* A structure representing the superspeed endpoint companion descriptor.
*
*
* This descriptor is documented in section 9.6.7 of the USB 3.0 specification.
* All multiple-byte fields are represented in host-endian format.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class SsEndpointCompanionDescriptor
@ -46,7 +46,7 @@ public final class SsEndpointCompanionDescriptor
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -56,14 +56,14 @@ public final class SsEndpointCompanionDescriptor
/**
* Returns the size of this descriptor (in bytes).
*
*
* @return The descriptor size in bytes;
*/
public native byte bLength();
/**
* Returns the descriptor type.
*
*
* @return The descriptor type.
*/
public native byte bDescriptorType();
@ -71,7 +71,7 @@ public final class SsEndpointCompanionDescriptor
/**
* Returns the maximum number of packets the endpoint can send or receive as
* part of a burst.
*
*
* @return The maximum number of packets as part of a burst.
*/
public native byte bMaxBurst();
@ -81,7 +81,7 @@ public final class SsEndpointCompanionDescriptor
* maximum number of streams the EP supports. In isochronous endpoint:
* bits 1:0 represents the Mult - a zero based value that determines the
* maximum number of packets within a service interval.
*
*
* @return The attributes.
*/
public native byte bmAttributes();
@ -89,14 +89,14 @@ public final class SsEndpointCompanionDescriptor
/**
* Returns the total number of bytes this endpoint will transfer every
* service interval. Valid only for periodic endpoints.
*
*
* @return The total number of bytes per service interval.
*/
public native short wBytesPerInterval();
/**
* Returns a dump of this descriptor.
*
*
* @return The descriptor dump.
*/
public String dump()
@ -126,12 +126,12 @@ public final class SsEndpointCompanionDescriptor
}
final SsEndpointCompanionDescriptor other = (SsEndpointCompanionDescriptor) obj;
return new EqualsBuilder()
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.bMaxBurst(), other.bMaxBurst())
.append(this.bmAttributes(), other.bmAttributes())
.append(this.wBytesPerInterval(), other.wBytesPerInterval())
.isEquals();
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.bMaxBurst(), other.bMaxBurst())
.append(this.bmAttributes(), other.bmAttributes())
.append(this.wBytesPerInterval(), other.wBytesPerInterval())
.isEquals();
}
@Override

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -25,9 +25,9 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
* A structure representing the SuperSpeed USB Device Capability descriptor.
* This descriptor is documented in section 9.6.2.2 of the USB 3.0
* specification.
*
*
* All multiple-byte fields are represented in host-endian format.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class SsUsbDeviceCapabilityDescriptor
@ -48,7 +48,7 @@ public final class SsUsbDeviceCapabilityDescriptor
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -58,28 +58,28 @@ public final class SsUsbDeviceCapabilityDescriptor
/**
* Returns the size of this descriptor (in bytes).
*
*
* @return The descriptor size in bytes;
*/
public native byte bLength();
/**
* Returns the descriptor type.
*
*
* @return The descriptor type.
*/
public native byte bDescriptorType();
/**
* Returns the device capability type.
*
*
* @return The device capability type.
*/
public native byte bDevCapabilityType();
/**
* Returns the bitmap of supported device level features.
*
*
* @return The supported device level features.
*/
public native byte bmAttributes();
@ -87,7 +87,7 @@ public final class SsUsbDeviceCapabilityDescriptor
/**
* Returns the bitmap encoding of the speed supported by this device when
* operating in SuperSpeed mode.
*
*
* @return The supported speed.
*/
public native short wSpeedSupported();
@ -95,28 +95,28 @@ public final class SsUsbDeviceCapabilityDescriptor
/**
* Returns the lowest speed at which all the functionality supported by the
* device is available to the user.
*
*
* @return The lowest speed.
*/
public native byte bFunctionalitySupport();
/**
* Returns the U1 Device Exit Latency.
*
*
* @return The U1 Device Exit Latency.
*/
public native byte bU1DevExitLat();
/**
* Returns the U2 Device Exit Latency.
*
*
* @return The U2 Device Exit Latency.
*/
public native short bU2DevExitLat();
/**
* Returns a dump of this descriptor.
*
*
* @return The descriptor dump.
*/
public String dump()
@ -151,14 +151,14 @@ public final class SsUsbDeviceCapabilityDescriptor
}
final SsUsbDeviceCapabilityDescriptor other = (SsUsbDeviceCapabilityDescriptor) obj;
return new EqualsBuilder()
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.bDevCapabilityType(), other.bDevCapabilityType())
.append(this.bmAttributes(), other.bmAttributes())
.append(this.wSpeedSupported(), other.wSpeedSupported())
.append(this.bFunctionalitySupport(), other.bFunctionalitySupport())
.append(this.bU1DevExitLat(), other.bU1DevExitLat())
.append(this.bU2DevExitLat(), other.bU2DevExitLat()).isEquals();
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.bDevCapabilityType(), other.bDevCapabilityType())
.append(this.bmAttributes(), other.bmAttributes())
.append(this.wSpeedSupported(), other.wSpeedSupported())
.append(this.bFunctionalitySupport(), other.bFunctionalitySupport())
.append(this.bU1DevExitLat(), other.bU1DevExitLat())
.append(this.bU2DevExitLat(), other.bU2DevExitLat()).isEquals();
}
@Override

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -22,11 +22,11 @@ import java.nio.ByteBuffer;
/**
* The generic USB transfer structure.
*
*
* The user populates this structure and then submits it in order to request a
* transfer. After the transfer has completed, the library populates the
* transfer with the results and passes it back to the user.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class Transfer
@ -50,7 +50,7 @@ public final class Transfer
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -60,14 +60,14 @@ public final class Transfer
/**
* Returns the handle of the device that this transfer will be submitted to.
*
*
* @return The handle of the device.
*/
public native DeviceHandle devHandle();
/**
* Sets the handle of the device that this transfer will be submitted to.
*
*
* @param handle
* The handle of the device.
*/
@ -75,14 +75,14 @@ public final class Transfer
/**
* Returns the bitwise OR combination of libusb transfer flags.
*
*
* @return The transfer flags.
*/
public native byte flags();
/**
* Sets the bitwise OR combination of libusb transfer flags.
*
*
* @param flags
* The transfer flags to set.
*/
@ -90,14 +90,14 @@ public final class Transfer
/**
* Returns the address of the endpoint where this transfer will be sent.
*
*
* @return The endpoint address.
*/
public native byte endpoint();
/**
* Sets the address of the endpoint where this transfer will be sent.
*
*
* @param endpoint
* The endpoint address to set
*/
@ -105,14 +105,14 @@ public final class Transfer
/**
* Returns the type of the endpoint.
*
*
* @return The endpoint type.
*/
public native byte type();
/**
* Sets the type of the endpoint.
*
*
* @param type
* The endpoint type to set.
*/
@ -121,7 +121,7 @@ public final class Transfer
/**
* Returns the timeout for this transfer in milliseconds. A value of 0
* indicates no timeout.
*
*
* @return The timeout.
*/
public native long timeout();
@ -129,7 +129,7 @@ public final class Transfer
/**
* Sets the timeout for this transfer in milliseconds. A value of 0
* indicates no timeout.
*
*
* @param timeout
* The timeout to set.
*/
@ -138,28 +138,28 @@ public final class Transfer
/**
* Returns the status of the transfer. Read-only, and only for use within
* transfer callback function.
*
*
* If this is an isochronous transfer, this field may read
* {@link LibUsb#TRANSFER_COMPLETED} even if there were errors in the
* frames. Use the status field in each packet to determine if errors
* occurred.
*
*
* @return The transfer status.
*/
public native int status();
/**
* Returns the length of the data buffer.
*
*
* @return The data buffer length.
*/
public native int length();
/**
* Sets the length of the data buffer.
*
*
* This is checked against the maximum capacity of the supplied ByteBuffer.
*
*
* @param length
* The data buffer length to set.
*/
@ -192,23 +192,23 @@ public final class Transfer
* Returns the actual length of data that was transferred. Read-only, and
* only for use within transfer callback function. Not valid for isochronous
* endpoint transfers.
*
*
* @return The actual length of the transferred data.
*/
public native int actualLength();
/**
* Returns the current callback object.
*
*
* @return The current callback object.
*/
public native TransferCallback callback();
/**
* Sets the callback object.
*
*
* This will be invoked when the transfer completes, fails, or is cancelled.
*
*
* @param callback
* The callback object to use.
*/
@ -216,7 +216,7 @@ public final class Transfer
/**
* Returns the current user data object.
*
*
* @return The current user data object.
*/
public native Object userData();
@ -224,7 +224,7 @@ public final class Transfer
/**
* Sets the user data object, representing user context data to pass to
* the callback function and that can be accessed from there.
*
*
* @param userData
* The user data object to set.
*/
@ -232,7 +232,7 @@ public final class Transfer
/**
* Returns the data buffer.
*
*
* @return The data buffer.
*/
public ByteBuffer buffer()
@ -242,7 +242,7 @@ public final class Transfer
/**
* Sets the data buffer.
*
*
* @param buffer
* The data buffer to set.
*/
@ -271,14 +271,14 @@ public final class Transfer
/**
* Returns the number of isochronous packets. Only used for I/O with
* isochronous endpoints.
*
*
* @return The number of isochronous packets.
*/
public native int numIsoPackets();
/**
* Sets the number of isochronous packets.
*
*
* @param numIsoPackets
* The number of isochronous packets to set.
*/
@ -286,7 +286,7 @@ public final class Transfer
/**
* Array of isochronous packet descriptors, for isochronous transfers only.
*
*
* @return The array of isochronous packet descriptors.
*/
public native IsoPacketDescriptor[] isoPacketDesc();

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -24,9 +24,9 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
/**
* A structure representing the USB 2.0 Extension descriptor. This descriptor is
* documented in section 9.6.2.1 of the USB 3.0 specification.
*
*
* All multiple-byte fields are represented in host-endian format.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class Usb20ExtensionDescriptor
@ -46,7 +46,7 @@ public final class Usb20ExtensionDescriptor
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -56,35 +56,35 @@ public final class Usb20ExtensionDescriptor
/**
* Returns the size of this descriptor (in bytes).
*
*
* @return The descriptor size in bytes;
*/
public native byte bLength();
/**
* Returns the descriptor type.
*
*
* @return The descriptor type.
*/
public native byte bDescriptorType();
/**
* Returns the device capability type.
*
*
* @return The device capability type.
*/
public native byte bDevCapabilityType();
/**
* Returns the bitmap of supported device level features.
*
*
* @return The supported device level features.
*/
public native int bmAttributes();
/**
* Returns a dump of this descriptor.
*
*
* @return The descriptor dump.
*/
public String dump()
@ -114,10 +114,10 @@ public final class Usb20ExtensionDescriptor
}
final Usb20ExtensionDescriptor other = (Usb20ExtensionDescriptor) obj;
return new EqualsBuilder()
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.bDevCapabilityType(), other.bDevCapabilityType())
.append(this.bmAttributes(), other.bmAttributes()).isEquals();
.append(this.bDescriptorType(), other.bDescriptorType())
.append(this.bLength(), other.bLength())
.append(this.bDevCapabilityType(), other.bDevCapabilityType())
.append(this.bmAttributes(), other.bmAttributes()).isEquals();
}
@Override

View File

@ -1,9 +1,9 @@
/*
* Copyright 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*
*
* Based on libusb <http://www.libusb.org/>:
*
*
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright 2010-2012 Peter Stuge <peter@stuge.se>
@ -24,7 +24,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
/**
* Structure providing the version of the libusb runtime.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class Version implements Comparable<Version>
@ -43,7 +43,7 @@ public final class Version implements Comparable<Version>
/**
* Returns the native pointer.
*
*
* @return The native pointer.
*/
public long getPointer()
@ -53,35 +53,35 @@ public final class Version implements Comparable<Version>
/**
* Returns the library major version.
*
*
* @return The library major version.
*/
public native int major();
/**
* Returns the library minor version.
*
*
* @return The library minor version.
*/
public native int minor();
/**
* Returns the library micro version.
*
*
* @return The library micro version.
*/
public native int micro();
/**
* Returns the library nano version.
*
*
* @return The library nano version.
*/
public native int nano();
/**
* Returns the release candidate suffix string, e.g. "-rc4".
*
*
* @return The release candidate suffix string.
*/
public native String rc();