Format/clean-up all libusb/ Java files before starting work on reviewing them.
This commit is contained in:
parent
608121bbe6
commit
974d277459
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -36,8 +36,7 @@ public final class BosDescriptor
|
||||
|
||||
/**
|
||||
* Constructs a new BOS descriptor which can be passed to the
|
||||
* {@link LibUsb#getBosDescriptor(DeviceHandle, BosDescriptor)}
|
||||
* method.
|
||||
* {@link LibUsb#getBosDescriptor(DeviceHandle, BosDescriptor)} method.
|
||||
*/
|
||||
public BosDescriptor()
|
||||
{
|
||||
@ -69,19 +68,19 @@ public final class BosDescriptor
|
||||
public native byte bDescriptorType();
|
||||
|
||||
/**
|
||||
* Returns the length of this descriptor and all of its sub descriptors.
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
@ -97,53 +96,54 @@ public final class BosDescriptor
|
||||
public String dump()
|
||||
{
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
builder.append(String.format("BOS Descriptor:%n"
|
||||
+ " bLength %18d%n"
|
||||
+ " bDescriptorType %10d%n"
|
||||
+ " wTotalLength %13s%n"
|
||||
+ " bNumDeviceCaps %11s%n",
|
||||
bLength() & 0xff,
|
||||
bDescriptorType() & 0xff,
|
||||
wTotalLength() & 0xffff,
|
||||
bNumDeviceCaps() & 0xff));
|
||||
for (final BosDevCapabilityDescriptor descriptor: devCapability())
|
||||
builder.append(String.format("BOS Descriptor:%n" + " bLength %18d%n"
|
||||
+ " bDescriptorType %10d%n" + " wTotalLength %13s%n"
|
||||
+ " bNumDeviceCaps %11s%n", this.bLength() & 0xff,
|
||||
this.bDescriptorType() & 0xff, this.wTotalLength() & 0xffff,
|
||||
this.bNumDeviceCaps() & 0xff));
|
||||
for (final BosDevCapabilityDescriptor descriptor : this.devCapability())
|
||||
{
|
||||
builder.append(descriptor.dump().replaceAll("(?m)^", " "));
|
||||
}
|
||||
return builder.toString();
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj)
|
||||
{
|
||||
if (obj == null) return false;
|
||||
if (obj == this) return true;
|
||||
if (obj.getClass() != getClass()) return false;
|
||||
final BosDescriptor other =
|
||||
(BosDescriptor) obj;
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (obj == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (obj.getClass() != this.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final BosDescriptor other = (BosDescriptor) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(bDescriptorType(), other.bDescriptorType())
|
||||
.append(bLength(), other.bLength())
|
||||
.append(wTotalLength(), other.wTotalLength())
|
||||
.append(bNumDeviceCaps(), other.bNumDeviceCaps())
|
||||
.append(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
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(bLength())
|
||||
.append(bDescriptorType())
|
||||
.append(wTotalLength())
|
||||
.append(bNumDeviceCaps())
|
||||
.append(devCapability())
|
||||
return new HashCodeBuilder().append(this.bLength())
|
||||
.append(this.bDescriptorType()).append(this.wTotalLength())
|
||||
.append(this.bNumDeviceCaps()).append(this.devCapability())
|
||||
.toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return dump();
|
||||
return this.dump();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -92,49 +92,53 @@ public final class BosDevCapabilityDescriptor
|
||||
*/
|
||||
public String dump()
|
||||
{
|
||||
return String.format("BOS Device Capability Descriptor:%n"
|
||||
+ " bLength %18d%n"
|
||||
+ " bDescriptorType %10d%n"
|
||||
+ " bDevCapabilityType %7s%n"
|
||||
+ " devCapabilityData:%n%s%n",
|
||||
bLength() & 0xff,
|
||||
bDescriptorType() & 0xff,
|
||||
bDevCapabilityType() & 0xff,
|
||||
DescriptorUtils.dump(devCapabilityData())
|
||||
.replaceAll("(?m)^", " "));
|
||||
|
||||
return String.format(
|
||||
"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)^",
|
||||
" "));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj)
|
||||
{
|
||||
if (obj == null) return false;
|
||||
if (obj == this) return true;
|
||||
if (obj.getClass() != getClass()) return false;
|
||||
final BosDevCapabilityDescriptor other =
|
||||
(BosDevCapabilityDescriptor) obj;
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (obj == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (obj.getClass() != this.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final BosDevCapabilityDescriptor other = (BosDevCapabilityDescriptor) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(bDescriptorType(), other.bDescriptorType())
|
||||
.append(bLength(), other.bLength())
|
||||
.append(bDevCapabilityType(), other.bDevCapabilityType())
|
||||
.append(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
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(bLength())
|
||||
.append(bDescriptorType())
|
||||
.append(bDevCapabilityType())
|
||||
.append(devCapabilityData())
|
||||
.toHashCode();
|
||||
return new HashCodeBuilder().append(this.bLength())
|
||||
.append(this.bDescriptorType()).append(this.bDevCapabilityType())
|
||||
.append(this.devCapabilityData()).toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return dump();
|
||||
return this.dump();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -117,10 +117,11 @@ public final class ConfigDescriptor implements UsbConfigurationDescriptor
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append(String.format("%s%n" + " extralen %17d%n"
|
||||
+ " extra:%n" + "%s", DescriptorUtils.dump(this), extraLength(),
|
||||
DescriptorUtils.dump(extra()).replaceAll("(?m)^", " ")));
|
||||
+ " extra:%n" + "%s", DescriptorUtils.dump(this),
|
||||
this.extraLength(),
|
||||
DescriptorUtils.dump(this.extra()).replaceAll("(?m)^", " ")));
|
||||
|
||||
for (final Interface iface : iface())
|
||||
for (final Interface iface : this.iface())
|
||||
{
|
||||
builder.append("%n" + iface.dump());
|
||||
}
|
||||
@ -131,19 +132,12 @@ public final class ConfigDescriptor implements UsbConfigurationDescriptor
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(bLength())
|
||||
.append(bDescriptorType())
|
||||
.append(wTotalLength())
|
||||
.append(bNumInterfaces())
|
||||
.append(bConfigurationValue())
|
||||
.append(iConfiguration())
|
||||
.append(bmAttributes())
|
||||
.append(bMaxPower())
|
||||
.append(iface())
|
||||
.append(extra())
|
||||
.append(extraLength())
|
||||
.toHashCode();
|
||||
return new HashCodeBuilder().append(this.bLength())
|
||||
.append(this.bDescriptorType()).append(this.wTotalLength())
|
||||
.append(this.bNumInterfaces()).append(this.bConfigurationValue())
|
||||
.append(this.iConfiguration()).append(this.bmAttributes())
|
||||
.append(this.bMaxPower()).append(this.iface()).append(this.extra())
|
||||
.append(this.extraLength()).toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -157,31 +151,29 @@ public final class ConfigDescriptor implements UsbConfigurationDescriptor
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final ConfigDescriptor other = (ConfigDescriptor) obj;
|
||||
|
||||
return new EqualsBuilder()
|
||||
.append(bLength(), other.bLength())
|
||||
.append(bDescriptorType(), other.bDescriptorType())
|
||||
.append(wTotalLength(), other.wTotalLength())
|
||||
.append(bNumInterfaces(), other.bNumInterfaces())
|
||||
.append(bConfigurationValue(), other.bConfigurationValue())
|
||||
.append(iConfiguration(), other.iConfiguration())
|
||||
.append(bmAttributes(), other.bmAttributes())
|
||||
.append(bMaxPower(), other.bMaxPower())
|
||||
.append(iface(), other.iface())
|
||||
.append(extra(), other.extra())
|
||||
.append(extraLength(), other.extraLength())
|
||||
.isEquals();
|
||||
return new EqualsBuilder().append(this.bLength(), other.bLength())
|
||||
.append(this.bDescriptorType(), other.bDescriptorType())
|
||||
.append(this.wTotalLength(), other.wTotalLength())
|
||||
.append(this.bNumInterfaces(), other.bNumInterfaces())
|
||||
.append(this.bConfigurationValue(), other.bConfigurationValue())
|
||||
.append(this.iConfiguration(), other.iConfiguration())
|
||||
.append(this.bmAttributes(), other.bmAttributes())
|
||||
.append(this.bMaxPower(), other.bMaxPower())
|
||||
.append(this.iface(), other.iface())
|
||||
.append(this.extra(), other.extra())
|
||||
.append(this.extraLength(), other.extraLength()).isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return dump();
|
||||
return this.dump();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -41,8 +41,7 @@ public final class ContainerIdDescriptor
|
||||
|
||||
/**
|
||||
* Constructs a new Container Id descriptor which can be passed to the
|
||||
* {@link LibUsb#getContainerIdDescriptor(Context,
|
||||
* BosDevCapabilityDescriptor, ContainerIdDescriptor)}
|
||||
* {@link LibUsb#getContainerIdDescriptor(Context, BosDevCapabilityDescriptor, ContainerIdDescriptor)}
|
||||
* method.
|
||||
*/
|
||||
public ContainerIdDescriptor()
|
||||
@ -102,51 +101,51 @@ public final class ContainerIdDescriptor
|
||||
*/
|
||||
public String dump()
|
||||
{
|
||||
return String.format("Container Id Descriptor:%n"
|
||||
+ " bLength %18d%n"
|
||||
+ " bDescriptorType %10d%n"
|
||||
+ " bDevCapabilityType %7d%n"
|
||||
+ " bReserved %16d%n"
|
||||
+ " containerId:%n%s%n",
|
||||
bLength() & 0xff,
|
||||
bDescriptorType() & 0xff,
|
||||
bDevCapabilityType() & 0xff,
|
||||
bReserved() & 0xff,
|
||||
DescriptorUtils.dump(containerId()).replaceAll("(?m)^", " "));
|
||||
return String.format("Container Id Descriptor:%n" + " bLength %18d%n"
|
||||
+ " 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,
|
||||
DescriptorUtils.dump(this.containerId())
|
||||
.replaceAll("(?m)^", " "));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj)
|
||||
{
|
||||
if (obj == null) return false;
|
||||
if (obj == this) return true;
|
||||
if (obj.getClass() != getClass()) return false;
|
||||
final ContainerIdDescriptor other =
|
||||
(ContainerIdDescriptor) obj;
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (obj == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (obj.getClass() != this.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final ContainerIdDescriptor other = (ContainerIdDescriptor) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(bDescriptorType(), other.bDescriptorType())
|
||||
.append(bLength(), other.bLength())
|
||||
.append(bDevCapabilityType(), other.bDevCapabilityType())
|
||||
.append(bReserved(), other.bReserved())
|
||||
.append(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
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(bLength())
|
||||
.append(bDescriptorType())
|
||||
.append(bDevCapabilityType())
|
||||
.append(bReserved())
|
||||
.append(containerId())
|
||||
.toHashCode();
|
||||
return new HashCodeBuilder().append(this.bLength())
|
||||
.append(this.bDescriptorType()).append(this.bDevCapabilityType())
|
||||
.append(this.bReserved()).append(this.containerId()).toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return dump();
|
||||
return this.dump();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -65,7 +65,7 @@ public final class Context
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = (prime * result)
|
||||
+ (int) (contextPointer ^ (contextPointer >>> 32));
|
||||
+ (int) (this.contextPointer ^ (this.contextPointer >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -80,12 +80,12 @@ public final class Context
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final Context other = (Context) obj;
|
||||
if (contextPointer != other.contextPointer)
|
||||
if (this.contextPointer != other.contextPointer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -95,6 +95,6 @@ public final class Context
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("libusb context 0x%x", contextPointer);
|
||||
return String.format("libusb context 0x%x", this.contextPointer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,10 +16,11 @@ public final class ControlSetup
|
||||
throw new IllegalArgumentException("buffer cannot be null");
|
||||
}
|
||||
|
||||
controlSetup = BufferUtils.slice(buffer, 0, LibUsb.CONTROL_SETUP_SIZE);
|
||||
this.controlSetup = BufferUtils.slice(buffer, 0,
|
||||
LibUsb.CONTROL_SETUP_SIZE);
|
||||
|
||||
// Control Setup (as all of USB) is Little Endian.
|
||||
controlSetup.order(ByteOrder.LITTLE_ENDIAN);
|
||||
this.controlSetup.order(ByteOrder.LITTLE_ENDIAN);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,52 +35,52 @@ public final class ControlSetup
|
||||
|
||||
public byte bmRequestType()
|
||||
{
|
||||
return controlSetup.get(0);
|
||||
return this.controlSetup.get(0);
|
||||
}
|
||||
|
||||
public void setBmRequestType(final byte bmRequestType)
|
||||
{
|
||||
controlSetup.put(0, bmRequestType);
|
||||
this.controlSetup.put(0, bmRequestType);
|
||||
}
|
||||
|
||||
public byte bRequest()
|
||||
{
|
||||
return controlSetup.get(1);
|
||||
return this.controlSetup.get(1);
|
||||
}
|
||||
|
||||
public void setBRequest(final byte bRequest)
|
||||
{
|
||||
controlSetup.put(1, bRequest);
|
||||
this.controlSetup.put(1, bRequest);
|
||||
}
|
||||
|
||||
public short wValue()
|
||||
{
|
||||
return controlSetup.getShort(2);
|
||||
return this.controlSetup.getShort(2);
|
||||
}
|
||||
|
||||
public void setWValue(final short wValue)
|
||||
{
|
||||
controlSetup.putShort(2, wValue);
|
||||
this.controlSetup.putShort(2, wValue);
|
||||
}
|
||||
|
||||
public short wIndex()
|
||||
{
|
||||
return controlSetup.getShort(4);
|
||||
return this.controlSetup.getShort(4);
|
||||
}
|
||||
|
||||
public void setWIndex(final short wIndex)
|
||||
{
|
||||
controlSetup.putShort(4, wIndex);
|
||||
this.controlSetup.putShort(4, wIndex);
|
||||
}
|
||||
|
||||
public short wLength()
|
||||
{
|
||||
return controlSetup.getShort(6);
|
||||
return this.controlSetup.getShort(6);
|
||||
}
|
||||
|
||||
public void setWLength(final short wLength)
|
||||
{
|
||||
controlSetup.putShort(6, wLength);
|
||||
this.controlSetup.putShort(6, wLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,7 +89,7 @@ public final class ControlSetup
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = (prime * result)
|
||||
+ ((controlSetup == null) ? 0 : controlSetup.hashCode());
|
||||
+ ((this.controlSetup == null) ? 0 : this.controlSetup.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -103,19 +104,19 @@ public final class ControlSetup
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final ControlSetup other = (ControlSetup) obj;
|
||||
if (controlSetup == null)
|
||||
if (this.controlSetup == null)
|
||||
{
|
||||
if (other.controlSetup != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!controlSetup.equals(other.controlSetup))
|
||||
else if (!this.controlSetup.equals(other.controlSetup))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -126,6 +127,6 @@ public final class ControlSetup
|
||||
public String toString()
|
||||
{
|
||||
return String.format("libusb control setup with buffer %s",
|
||||
controlSetup.toString());
|
||||
this.controlSetup.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -69,7 +69,7 @@ public final class Device
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = (prime * result)
|
||||
+ (int) (devicePointer ^ (devicePointer >>> 32));
|
||||
+ (int) (this.devicePointer ^ (this.devicePointer >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -84,12 +84,12 @@ public final class Device
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final Device other = (Device) obj;
|
||||
if (devicePointer != other.devicePointer)
|
||||
if (this.devicePointer != other.devicePointer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -99,6 +99,6 @@ public final class Device
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("libusb device 0x%x", devicePointer);
|
||||
return String.format("libusb device 0x%x", this.devicePointer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -106,7 +106,7 @@ public final class DeviceDescriptor implements UsbDeviceDescriptor
|
||||
*/
|
||||
public String dump()
|
||||
{
|
||||
return dump(null);
|
||||
return this.dump(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,10 +120,11 @@ public final class DeviceDescriptor implements UsbDeviceDescriptor
|
||||
public String dump(final DeviceHandle handle)
|
||||
{
|
||||
final String sManufacturer = LibUsb.getStringDescriptor(handle,
|
||||
iManufacturer());
|
||||
final String sProduct = LibUsb.getStringDescriptor(handle, iProduct());
|
||||
this.iManufacturer());
|
||||
final String sProduct = LibUsb.getStringDescriptor(handle,
|
||||
this.iProduct());
|
||||
final String sSerialNumber = LibUsb.getStringDescriptor(handle,
|
||||
iSerialNumber());
|
||||
this.iSerialNumber());
|
||||
return DescriptorUtils.dump(this, sManufacturer, sProduct,
|
||||
sSerialNumber);
|
||||
}
|
||||
@ -131,22 +132,14 @@ public final class DeviceDescriptor implements UsbDeviceDescriptor
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(bLength())
|
||||
.append(bDescriptorType())
|
||||
.append(bcdUSB())
|
||||
.append(bDeviceClass())
|
||||
.append(bDeviceSubClass())
|
||||
.append(bDeviceProtocol())
|
||||
.append(bMaxPacketSize0())
|
||||
.append(idVendor())
|
||||
.append(idProduct())
|
||||
.append(bcdDevice())
|
||||
.append(iManufacturer())
|
||||
.append(iProduct())
|
||||
.append(iSerialNumber())
|
||||
.append(bNumConfigurations())
|
||||
.toHashCode();
|
||||
return new HashCodeBuilder().append(this.bLength())
|
||||
.append(this.bDescriptorType()).append(this.bcdUSB())
|
||||
.append(this.bDeviceClass()).append(this.bDeviceSubClass())
|
||||
.append(this.bDeviceProtocol()).append(this.bMaxPacketSize0())
|
||||
.append(this.idVendor()).append(this.idProduct())
|
||||
.append(this.bcdDevice()).append(this.iManufacturer())
|
||||
.append(this.iProduct()).append(this.iSerialNumber())
|
||||
.append(this.bNumConfigurations()).toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -160,34 +153,33 @@ public final class DeviceDescriptor implements UsbDeviceDescriptor
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final DeviceDescriptor other = (DeviceDescriptor) obj;
|
||||
|
||||
return new EqualsBuilder()
|
||||
.append(bLength(), other.bLength())
|
||||
.append(bDescriptorType(), other.bDescriptorType())
|
||||
.append(bcdUSB(), other.bcdUSB())
|
||||
.append(bDeviceClass(), other.bDeviceClass())
|
||||
.append(bDeviceSubClass(), other.bDeviceSubClass())
|
||||
.append(bDeviceProtocol(), other.bDeviceProtocol())
|
||||
.append(bMaxPacketSize0(), other.bMaxPacketSize0())
|
||||
.append(idVendor(), other.idVendor())
|
||||
.append(idProduct(), other.idProduct())
|
||||
.append(bcdDevice(), other.bcdDevice())
|
||||
.append(iManufacturer(), other.iManufacturer())
|
||||
.append(iProduct(), other.iProduct())
|
||||
.append(iSerialNumber(), other.iSerialNumber())
|
||||
.append(bNumConfigurations(), other.bNumConfigurations())
|
||||
return new EqualsBuilder().append(this.bLength(), other.bLength())
|
||||
.append(this.bDescriptorType(), other.bDescriptorType())
|
||||
.append(this.bcdUSB(), other.bcdUSB())
|
||||
.append(this.bDeviceClass(), other.bDeviceClass())
|
||||
.append(this.bDeviceSubClass(), other.bDeviceSubClass())
|
||||
.append(this.bDeviceProtocol(), other.bDeviceProtocol())
|
||||
.append(this.bMaxPacketSize0(), other.bMaxPacketSize0())
|
||||
.append(this.idVendor(), other.idVendor())
|
||||
.append(this.idProduct(), other.idProduct())
|
||||
.append(this.bcdDevice(), other.bcdDevice())
|
||||
.append(this.iManufacturer(), other.iManufacturer())
|
||||
.append(this.iProduct(), other.iProduct())
|
||||
.append(this.iSerialNumber(), other.iSerialNumber())
|
||||
.append(this.bNumConfigurations(), other.bNumConfigurations())
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return dump();
|
||||
return this.dump();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -60,7 +60,7 @@ public final class DeviceHandle
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = (prime * result)
|
||||
+ (int) (deviceHandlePointer ^ (deviceHandlePointer >>> 32));
|
||||
+ (int) (this.deviceHandlePointer ^ (this.deviceHandlePointer >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -75,12 +75,12 @@ public final class DeviceHandle
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final DeviceHandle other = (DeviceHandle) obj;
|
||||
if (deviceHandlePointer != other.deviceHandlePointer)
|
||||
if (this.deviceHandlePointer != other.deviceHandlePointer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -90,6 +90,7 @@ public final class DeviceHandle
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("libusb device handle 0x%x", deviceHandlePointer);
|
||||
return String.format("libusb device handle 0x%x",
|
||||
this.deviceHandlePointer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -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>
|
||||
@ -84,8 +84,8 @@ public final class DeviceList implements Iterable<Device>
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = (prime * result)
|
||||
+ (int) (deviceListPointer ^ (deviceListPointer >>> 32));
|
||||
result = (prime * result) + size;
|
||||
+ (int) (this.deviceListPointer ^ (this.deviceListPointer >>> 32));
|
||||
result = (prime * result) + this.size;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -100,16 +100,16 @@ public final class DeviceList implements Iterable<Device>
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final DeviceList other = (DeviceList) obj;
|
||||
if (deviceListPointer != other.deviceListPointer)
|
||||
if (this.deviceListPointer != other.deviceListPointer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (size != other.size)
|
||||
if (this.size != other.size)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -120,6 +120,6 @@ public final class DeviceList implements Iterable<Device>
|
||||
public String toString()
|
||||
{
|
||||
return String.format("libusb device list 0x%x with size %d",
|
||||
deviceListPointer, size);
|
||||
this.deviceListPointer, this.size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,13 +34,13 @@ final class DeviceListIterator implements Iterator<Device>
|
||||
@Override
|
||||
public boolean hasNext()
|
||||
{
|
||||
return nextIndex < devices.getSize();
|
||||
return this.nextIndex < this.devices.getSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Device next()
|
||||
{
|
||||
return devices.get(nextIndex++);
|
||||
return this.devices.get(this.nextIndex++);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -32,7 +32,7 @@ import de.ailis.usb4java.utils.DescriptorUtils;
|
||||
*
|
||||
* 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
|
||||
@ -116,30 +116,21 @@ public final class EndpointDescriptor implements UsbEndpointDescriptor
|
||||
*/
|
||||
public String dump()
|
||||
{
|
||||
return String.format("%s%n"
|
||||
+ " extralen %17d%n"
|
||||
+ " extra:%n"
|
||||
+ "%s",
|
||||
DescriptorUtils.dump(this),
|
||||
extraLength(),
|
||||
DescriptorUtils.dump(extra()).replaceAll("(?m)^", " "));
|
||||
return String.format(
|
||||
"%s%n" + " extralen %17d%n" + " extra:%n" + "%s", DescriptorUtils
|
||||
.dump(this), this.extraLength(),
|
||||
DescriptorUtils.dump(this.extra()).replaceAll("(?m)^", " "));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(bLength())
|
||||
.append(bDescriptorType())
|
||||
.append(bEndpointAddress())
|
||||
.append(bmAttributes())
|
||||
.append(wMaxPacketSize())
|
||||
.append(bInterval())
|
||||
.append(bRefresh())
|
||||
.append(bSynchAddress())
|
||||
.append(extra())
|
||||
.append(extraLength())
|
||||
.toHashCode();
|
||||
return new HashCodeBuilder().append(this.bLength())
|
||||
.append(this.bDescriptorType()).append(this.bEndpointAddress())
|
||||
.append(this.bmAttributes()).append(this.wMaxPacketSize())
|
||||
.append(this.bInterval()).append(this.bRefresh())
|
||||
.append(this.bSynchAddress()).append(this.extra())
|
||||
.append(this.extraLength()).toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -153,30 +144,28 @@ public final class EndpointDescriptor implements UsbEndpointDescriptor
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final EndpointDescriptor other = (EndpointDescriptor) obj;
|
||||
|
||||
return new EqualsBuilder()
|
||||
.append(bLength(), other.bLength())
|
||||
.append(bDescriptorType(), other.bDescriptorType())
|
||||
.append(bEndpointAddress(), other.bEndpointAddress())
|
||||
.append(bmAttributes(), other.bmAttributes())
|
||||
.append(wMaxPacketSize(), other.wMaxPacketSize())
|
||||
.append(bInterval(), other.bInterval())
|
||||
.append(bRefresh(), other.bRefresh())
|
||||
.append(bSynchAddress(), other.bSynchAddress())
|
||||
.append(extra(), other.extra())
|
||||
.append(extraLength(), other.extraLength())
|
||||
.isEquals();
|
||||
return new EqualsBuilder().append(this.bLength(), other.bLength())
|
||||
.append(this.bDescriptorType(), other.bDescriptorType())
|
||||
.append(this.bEndpointAddress(), other.bEndpointAddress())
|
||||
.append(this.bmAttributes(), other.bmAttributes())
|
||||
.append(this.wMaxPacketSize(), other.wMaxPacketSize())
|
||||
.append(this.bInterval(), other.bInterval())
|
||||
.append(this.bRefresh(), other.bRefresh())
|
||||
.append(this.bSynchAddress(), other.bSynchAddress())
|
||||
.append(this.extra(), other.extra())
|
||||
.append(this.extraLength(), other.extraLength()).isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return dump();
|
||||
return this.dump();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -67,7 +67,7 @@ public final class Interface
|
||||
|
||||
/**
|
||||
* Returns a dump of this interface.
|
||||
*
|
||||
*
|
||||
* @return The interface dump.
|
||||
*/
|
||||
public String dump()
|
||||
@ -75,9 +75,9 @@ public final class Interface
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append(String.format("Interface:%n" + " numAltsetting %10d",
|
||||
numAltsetting()));
|
||||
this.numAltsetting()));
|
||||
|
||||
for (final InterfaceDescriptor intDesc : altsetting())
|
||||
for (final InterfaceDescriptor intDesc : this.altsetting())
|
||||
{
|
||||
builder.append("%n" + intDesc.dump());
|
||||
}
|
||||
@ -88,10 +88,8 @@ public final class Interface
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(altsetting())
|
||||
.append(numAltsetting())
|
||||
.toHashCode();
|
||||
return new HashCodeBuilder().append(this.altsetting())
|
||||
.append(this.numAltsetting()).toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,7 +103,7 @@ public final class Interface
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -113,14 +111,13 @@ public final class Interface
|
||||
final Interface other = (Interface) obj;
|
||||
|
||||
return new EqualsBuilder()
|
||||
.append(altsetting(), other.altsetting())
|
||||
.append(numAltsetting(), other.numAltsetting())
|
||||
.isEquals();
|
||||
.append(this.altsetting(), other.altsetting())
|
||||
.append(this.numAltsetting(), other.numAltsetting()).isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return dump();
|
||||
return this.dump();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -120,10 +120,11 @@ public final class InterfaceDescriptor implements UsbInterfaceDescriptor
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append(String.format("%s%n" + " extralen %17d%n"
|
||||
+ " extra:%n" + "%s", DescriptorUtils.dump(this), extraLength(),
|
||||
DescriptorUtils.dump(extra()).replaceAll("(?m)^", " ")));
|
||||
+ " extra:%n" + "%s", DescriptorUtils.dump(this),
|
||||
this.extraLength(),
|
||||
DescriptorUtils.dump(this.extra()).replaceAll("(?m)^", " ")));
|
||||
|
||||
for (final EndpointDescriptor epDesc : endpoint())
|
||||
for (final EndpointDescriptor epDesc : this.endpoint())
|
||||
{
|
||||
builder.append("%n" + epDesc.dump());
|
||||
}
|
||||
@ -134,20 +135,13 @@ public final class InterfaceDescriptor implements UsbInterfaceDescriptor
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(bLength())
|
||||
.append(bDescriptorType())
|
||||
.append(bInterfaceNumber())
|
||||
.append(bAlternateSetting())
|
||||
.append(bNumEndpoints())
|
||||
.append(bInterfaceClass())
|
||||
.append(bInterfaceSubClass())
|
||||
.append(bInterfaceProtocol())
|
||||
.append(iInterface())
|
||||
.append(endpoint())
|
||||
.append(extra())
|
||||
.append(extraLength())
|
||||
.toHashCode();
|
||||
return new HashCodeBuilder().append(this.bLength())
|
||||
.append(this.bDescriptorType()).append(this.bInterfaceNumber())
|
||||
.append(this.bAlternateSetting()).append(this.bNumEndpoints())
|
||||
.append(this.bInterfaceClass()).append(this.bInterfaceSubClass())
|
||||
.append(this.bInterfaceProtocol()).append(this.iInterface())
|
||||
.append(this.endpoint()).append(this.extra())
|
||||
.append(this.extraLength()).toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -161,32 +155,30 @@ public final class InterfaceDescriptor implements UsbInterfaceDescriptor
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final InterfaceDescriptor other = (InterfaceDescriptor) obj;
|
||||
|
||||
return new EqualsBuilder()
|
||||
.append(bLength(), other.bLength())
|
||||
.append(bDescriptorType(), other.bDescriptorType())
|
||||
.append(bInterfaceNumber(), other.bInterfaceNumber())
|
||||
.append(bAlternateSetting(), other.bAlternateSetting())
|
||||
.append(bNumEndpoints(), other.bNumEndpoints())
|
||||
.append(bInterfaceClass(), other.bInterfaceClass())
|
||||
.append(bInterfaceSubClass(), other.bInterfaceSubClass())
|
||||
.append(bInterfaceProtocol(), other.bInterfaceProtocol())
|
||||
.append(iInterface(), other.iInterface())
|
||||
.append(endpoint(), other.endpoint())
|
||||
.append(extra(), other.extra())
|
||||
.append(extraLength(), other.extraLength())
|
||||
.isEquals();
|
||||
return new EqualsBuilder().append(this.bLength(), other.bLength())
|
||||
.append(this.bDescriptorType(), other.bDescriptorType())
|
||||
.append(this.bInterfaceNumber(), other.bInterfaceNumber())
|
||||
.append(this.bAlternateSetting(), other.bAlternateSetting())
|
||||
.append(this.bNumEndpoints(), other.bNumEndpoints())
|
||||
.append(this.bInterfaceClass(), other.bInterfaceClass())
|
||||
.append(this.bInterfaceSubClass(), other.bInterfaceSubClass())
|
||||
.append(this.bInterfaceProtocol(), other.bInterfaceProtocol())
|
||||
.append(this.iInterface(), other.iInterface())
|
||||
.append(this.endpoint(), other.endpoint())
|
||||
.append(this.extra(), other.extra())
|
||||
.append(this.extraLength(), other.extraLength()).isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return dump();
|
||||
return this.dump();
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ public final class IsoPacketDescriptor
|
||||
*/
|
||||
public long getPointer()
|
||||
{
|
||||
return isoPacketDescriptorPointer;
|
||||
return this.isoPacketDescriptorPointer;
|
||||
}
|
||||
|
||||
public native int length();
|
||||
@ -41,7 +41,7 @@ public final class IsoPacketDescriptor
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = (prime * result)
|
||||
+ (int) (isoPacketDescriptorPointer ^ (isoPacketDescriptorPointer >>> 32));
|
||||
+ (int) (this.isoPacketDescriptorPointer ^ (this.isoPacketDescriptorPointer >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -56,12 +56,12 @@ public final class IsoPacketDescriptor
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final IsoPacketDescriptor other = (IsoPacketDescriptor) obj;
|
||||
if (isoPacketDescriptorPointer != other.isoPacketDescriptorPointer)
|
||||
if (this.isoPacketDescriptorPointer != other.isoPacketDescriptorPointer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -72,6 +72,6 @@ public final class IsoPacketDescriptor
|
||||
public String toString()
|
||||
{
|
||||
return String.format("libusb iso packet descriptor 0x%x",
|
||||
isoPacketDescriptorPointer);
|
||||
this.isoPacketDescriptorPointer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -564,8 +564,7 @@ public final class LibUsb
|
||||
/**
|
||||
* pollfd listeners (to support different listeners for different contexts).
|
||||
*/
|
||||
private static final ConcurrentMap<Long, ImmutablePair<PollfdListener, Object>> pollfdListeners =
|
||||
new ConcurrentHashMap<Long, ImmutablePair<PollfdListener, Object>>();
|
||||
private static final ConcurrentMap<Long, ImmutablePair<PollfdListener, Object>> pollfdListeners = new ConcurrentHashMap<Long, ImmutablePair<PollfdListener, Object>>();
|
||||
|
||||
static
|
||||
{
|
||||
@ -645,8 +644,7 @@ public final class LibUsb
|
||||
* @param level
|
||||
* The log level to set.
|
||||
*/
|
||||
public static native void setDebug(final Context context,
|
||||
final int level);
|
||||
public static native void setDebug(final Context context, final int level);
|
||||
|
||||
/**
|
||||
* Returns the version of the libusb runtime.
|
||||
@ -728,7 +726,8 @@ public final class LibUsb
|
||||
/**
|
||||
* Get the list of all port numbers from root for the specified device.
|
||||
*
|
||||
* @deprecated Please use {@link #getPortNumbers(Device, ByteBuffer)} instead.
|
||||
* @deprecated Please use {@link #getPortNumbers(Device, ByteBuffer)}
|
||||
* instead.
|
||||
*
|
||||
* @param context
|
||||
* The context.
|
||||
@ -741,8 +740,8 @@ public final class LibUsb
|
||||
* array is too small
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getPortPath(final Context context,
|
||||
final Device device, final ByteBuffer path)
|
||||
public static int getPortPath(final Context context, final Device device,
|
||||
final ByteBuffer path)
|
||||
{
|
||||
return getPortNumbers(device, path);
|
||||
}
|
||||
@ -877,8 +876,7 @@ public final class LibUsb
|
||||
* {@link #ERROR_NO_DEVICE} if the device has been disconnected
|
||||
* another error on other failure
|
||||
*/
|
||||
public static native int open(final Device device,
|
||||
final DeviceHandle handle);
|
||||
public static native int open(final Device device, final DeviceHandle handle);
|
||||
|
||||
/**
|
||||
* Convenience function for finding a device with a particular
|
||||
@ -1479,8 +1477,7 @@ public final class LibUsb
|
||||
* @param companionDescriptor
|
||||
* Output location for the superspeed endpoint companion
|
||||
* descriptor. Only valid if 0 was returned. Must be freed with
|
||||
* {@link #freeSsEndpointCompanionDescriptor(
|
||||
* SsEndpointCompanionDescriptor)}
|
||||
* {@link #freeSsEndpointCompanionDescriptor(SsEndpointCompanionDescriptor)}
|
||||
* after use.
|
||||
* @return {@link #SUCCESS} on success, {@link #ERROR_NOT_FOUND} if the
|
||||
* descriptor does not exist, another error code on error
|
||||
@ -1491,8 +1488,8 @@ public final class LibUsb
|
||||
|
||||
/**
|
||||
* Free a superspeed endpoint companion descriptor obtained from
|
||||
* {@link #getSsEndpointCompanionDescriptor(Context, EndpointDescriptor,
|
||||
* SsEndpointCompanionDescriptor)}.
|
||||
* {@link #getSsEndpointCompanionDescriptor(Context, EndpointDescriptor, SsEndpointCompanionDescriptor)}
|
||||
* .
|
||||
*
|
||||
* It is safe to call this function with a NULL parameter, in which case the
|
||||
* function simply returns.
|
||||
@ -1529,8 +1526,7 @@ public final class LibUsb
|
||||
* @param descriptor
|
||||
* The BOS descriptor to free.
|
||||
*/
|
||||
public static native void freeBosDescriptor(final BosDescriptor
|
||||
descriptor);
|
||||
public static native void freeBosDescriptor(final BosDescriptor descriptor);
|
||||
|
||||
/**
|
||||
* Get an USB 2.0 Extension descriptor.
|
||||
@ -1543,21 +1539,20 @@ public final class LibUsb
|
||||
* @param extensionDescriptor
|
||||
* Output location for the USB 2.0 Extension descriptor. Only
|
||||
* valid if 0 was returned. Must be freed with
|
||||
* {@link #freeUsb20ExtensionDescriptor(
|
||||
* Usb20ExtensionDescriptor)} after use.
|
||||
* {@link #freeUsb20ExtensionDescriptor(Usb20ExtensionDescriptor)}
|
||||
* after use.
|
||||
* @return 0 on success a LIBUSB_ERROR code on error
|
||||
*/
|
||||
public static native int getUsb20ExtensionDescriptor(
|
||||
final Context context,
|
||||
public static native int getUsb20ExtensionDescriptor(final Context context,
|
||||
final BosDevCapabilityDescriptor devCapDescriptor,
|
||||
final Usb20ExtensionDescriptor extensionDescriptor);
|
||||
|
||||
/**
|
||||
* Free a USB 2.0 Extension descriptor obtained from
|
||||
* {@link #getUsb20ExtensionDescriptor(Context, BosDevCapabilityDescriptor,
|
||||
* Usb20ExtensionDescriptor)}.
|
||||
* {@link #getUsb20ExtensionDescriptor(Context, BosDevCapabilityDescriptor, Usb20ExtensionDescriptor)}
|
||||
* .
|
||||
*
|
||||
* It is safe to call this function with a NULL parameter, in which case
|
||||
* It is safe to call this function with a NULL parameter, in which case
|
||||
* the function simply returns.
|
||||
*
|
||||
* @param extensionDescriptor
|
||||
@ -1576,10 +1571,10 @@ public final class LibUsb
|
||||
* {@link #BT_SS_USB_DEVICE_CAPABILITY}.
|
||||
* @param ssUsbDeviceCapabilityDescriptor
|
||||
* Output location for the SuperSpeed USB Device Capability
|
||||
* descriptor. Only valid if {@link #SUCCESS} was returned.
|
||||
* descriptor. Only valid if {@link #SUCCESS} was returned.
|
||||
* Must be freed with
|
||||
* {@link #freeSsUsbDeviceCapabilityDescriptor(
|
||||
* SsUsbDeviceCapabilityDescriptor)} after use.
|
||||
* {@link #freeSsUsbDeviceCapabilityDescriptor(SsUsbDeviceCapabilityDescriptor)}
|
||||
* after use.
|
||||
* @return {@link #SUCCESS} on success, an error code on error.
|
||||
*/
|
||||
public static native int getSsUsbDeviceCapabilityDescriptor(
|
||||
@ -1589,8 +1584,8 @@ public final class LibUsb
|
||||
|
||||
/**
|
||||
* Free a SuperSpeed USB Device Capability descriptor obtained from
|
||||
* {@link #getSsUsbDeviceCapabilityDescriptor(Context,
|
||||
* BosDevCapabilityDescriptor, SsUsbDeviceCapabilityDescriptor)}.
|
||||
* {@link #getSsUsbDeviceCapabilityDescriptor(Context, BosDevCapabilityDescriptor, SsUsbDeviceCapabilityDescriptor)}
|
||||
* .
|
||||
*
|
||||
* It is safe to call this function with a NULL parameter,
|
||||
* in which case the function simply returns.
|
||||
@ -1600,7 +1595,7 @@ public final class LibUsb
|
||||
*/
|
||||
public static native void freeSsUsbDeviceCapabilityDescriptor(
|
||||
final SsUsbDeviceCapabilityDescriptor ssUsbDeviceCapabilityDescriptor);
|
||||
|
||||
|
||||
/**
|
||||
* Get a Container ID descriptor.
|
||||
*
|
||||
@ -1616,17 +1611,16 @@ public final class LibUsb
|
||||
* after use.
|
||||
* @return {@link #SUCCESS} on success or an error code on error
|
||||
*/
|
||||
public static native int getContainerIdDescriptor(
|
||||
final Context context,
|
||||
public static native int getContainerIdDescriptor(final Context context,
|
||||
final BosDevCapabilityDescriptor devCapDescriptor,
|
||||
final ContainerIdDescriptor containerIdDescriptor);
|
||||
|
||||
/**
|
||||
* Free a Container ID descriptor obtained from
|
||||
* {@link #getContainerIdDescriptor(Context, BosDevCapabilityDescriptor,
|
||||
* ContainerIdDescriptor)}.
|
||||
* {@link #getContainerIdDescriptor(Context, BosDevCapabilityDescriptor, ContainerIdDescriptor)}
|
||||
* .
|
||||
*
|
||||
* It is safe to call this function with a NULL parameter, in which case
|
||||
* It is safe to call this function with a NULL parameter, in which case
|
||||
* the function simply returns.
|
||||
*
|
||||
* @param containerIdDescriptor
|
||||
@ -1634,7 +1628,7 @@ public final class LibUsb
|
||||
*/
|
||||
public static native void freeContainerIdDescriptor(
|
||||
final ContainerIdDescriptor containerIdDescriptor);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve a descriptor from the default control pipe.
|
||||
*
|
||||
@ -1656,7 +1650,7 @@ public final class LibUsb
|
||||
final byte index, final ByteBuffer data)
|
||||
{
|
||||
return controlTransfer(handle, ENDPOINT_IN, REQUEST_GET_DESCRIPTOR,
|
||||
(short)((type << 8) | index), (short) 0, data, 1000);
|
||||
(short) ((type << 8) | index), (short) 0, data, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1681,7 +1675,7 @@ public final class LibUsb
|
||||
final byte index, final short langId, final ByteBuffer data)
|
||||
{
|
||||
return controlTransfer(handle, ENDPOINT_IN, REQUEST_GET_DESCRIPTOR,
|
||||
(short)((DT_STRING << 8) | index), langId, data, 1000);
|
||||
(short) ((DT_STRING << 8) | index), langId, data, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1762,8 +1756,8 @@ public final class LibUsb
|
||||
* been disconnected, another ERROR code on other failures.
|
||||
*/
|
||||
public static native int bulkTransfer(final DeviceHandle handle,
|
||||
final byte endpoint, final ByteBuffer data, final IntBuffer transferred,
|
||||
final long timeout);
|
||||
final byte endpoint, final ByteBuffer data,
|
||||
final IntBuffer transferred, final long timeout);
|
||||
|
||||
/**
|
||||
* Perform a USB interrupt transfer.
|
||||
@ -1808,8 +1802,8 @@ public final class LibUsb
|
||||
* has been disconnected, another ERROR code on other error
|
||||
*/
|
||||
public static native int interruptTransfer(final DeviceHandle handle,
|
||||
final byte endpoint, final ByteBuffer data, final IntBuffer transferred,
|
||||
final long timeout);
|
||||
final byte endpoint, final ByteBuffer data,
|
||||
final IntBuffer transferred, final long timeout);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the event handling lock.
|
||||
@ -2338,25 +2332,31 @@ public final class LibUsb
|
||||
* This function will fire off the USB transfer and then return immediately.
|
||||
*
|
||||
* @param transfer
|
||||
* The transfer to submit
|
||||
* @return 0 on success, {@link #LIBUSB_ERROR_NO_DEVICE} if the device has been
|
||||
* disconnected, {@link #LIBUSB_ERROR_BUSY} if the transfer has already been
|
||||
* submitted. {@link #LIBUSB_ERROR_NOT_SUPPORTED} if the transfer flags are
|
||||
* not supported by the operating system. Another LIBUSB_ERROR code on failure.
|
||||
* The transfer to submit
|
||||
* @return 0 on success, {@link #LIBUSB_ERROR_NO_DEVICE} if the device has
|
||||
* been
|
||||
* disconnected, {@link #LIBUSB_ERROR_BUSY} if the transfer has
|
||||
* already been
|
||||
* submitted. {@link #LIBUSB_ERROR_NOT_SUPPORTED} if the transfer
|
||||
* flags are
|
||||
* not supported by the operating system. Another LIBUSB_ERROR code
|
||||
* on failure.
|
||||
*/
|
||||
public static native int submitTransfer(final Transfer transfer);
|
||||
|
||||
/**
|
||||
* Asynchronously cancel a previously submitted transfer.
|
||||
*
|
||||
* This function returns immediately, but this does not indicate cancellation
|
||||
* This function returns immediately, but this does not indicate
|
||||
* cancellation
|
||||
* is complete. Your callback function will be invoked at some later time
|
||||
* with a transfer status of {@link #LIBUSB_TRANSFER_CANCELLED}.
|
||||
*
|
||||
* @param transfer
|
||||
* The transfer to cancel
|
||||
* @return 0 on success, {@link #LIBUSB_ERROR_NOT_FOUND} if the transfer is
|
||||
* already complete or cancelled. Another LIBUSB_ERROR code on failure.
|
||||
* already complete or cancelled. Another LIBUSB_ERROR code on
|
||||
* failure.
|
||||
*/
|
||||
public static native int cancelTransfer(final Transfer transfer);
|
||||
|
||||
@ -2402,9 +2402,9 @@ public final class LibUsb
|
||||
}
|
||||
|
||||
public static void fillBulkTransfer(final Transfer transfer,
|
||||
final DeviceHandle handle, final byte endpoint, final ByteBuffer buffer,
|
||||
final TransferCallback callback, final Object userData,
|
||||
final long timeout)
|
||||
final DeviceHandle handle, final byte endpoint,
|
||||
final ByteBuffer buffer, final TransferCallback callback,
|
||||
final Object userData, final long timeout)
|
||||
{
|
||||
transfer.setDevHandle(handle);
|
||||
transfer.setEndpoint(endpoint);
|
||||
@ -2416,9 +2416,9 @@ public final class LibUsb
|
||||
}
|
||||
|
||||
public static void fillInterruptTransfer(final Transfer transfer,
|
||||
final DeviceHandle handle, final byte endpoint, final ByteBuffer buffer,
|
||||
final TransferCallback callback, final Object userData,
|
||||
final long timeout)
|
||||
final DeviceHandle handle, final byte endpoint,
|
||||
final ByteBuffer buffer, final TransferCallback callback,
|
||||
final Object userData, final long timeout)
|
||||
{
|
||||
transfer.setDevHandle(handle);
|
||||
transfer.setEndpoint(endpoint);
|
||||
@ -2430,9 +2430,10 @@ public final class LibUsb
|
||||
}
|
||||
|
||||
public static void fillIsoTransfer(final Transfer transfer,
|
||||
final DeviceHandle handle, final byte endpoint, final ByteBuffer buffer,
|
||||
final int numIsoPackets, final TransferCallback callback,
|
||||
final Object userData, final long timeout)
|
||||
final DeviceHandle handle, final byte endpoint,
|
||||
final ByteBuffer buffer, final int numIsoPackets,
|
||||
final TransferCallback callback, final Object userData,
|
||||
final long timeout)
|
||||
{
|
||||
transfer.setDevHandle(handle);
|
||||
transfer.setEndpoint(endpoint);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -55,6 +55,6 @@ public final class LibUsbException extends UsbException
|
||||
*/
|
||||
public int getErrorCode()
|
||||
{
|
||||
return errorCode;
|
||||
return this.errorCode;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,8 +87,14 @@ public final class Loader
|
||||
{
|
||||
final String os = System.getProperty("os.name").toLowerCase()
|
||||
.replace(" ", "");
|
||||
if (os.contains(OS_WINDOWS)) return OS_WINDOWS;
|
||||
if (os.equals(OS_MACOSX)) return OS_OSX;
|
||||
if (os.contains(OS_WINDOWS))
|
||||
{
|
||||
return OS_WINDOWS;
|
||||
}
|
||||
if (os.equals(OS_MACOSX))
|
||||
{
|
||||
return OS_OSX;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -102,10 +108,17 @@ public final class Loader
|
||||
*/
|
||||
private static String getArch()
|
||||
{
|
||||
final String arch = System.getProperty("os.arch");
|
||||
if (arch.equals(ARCH_I386)) return ARCH_X86;
|
||||
if (arch.equals(ARCH_AMD64)) return ARCH_X86_64;
|
||||
return arch.toLowerCase().replace(" ", "");
|
||||
final String arch = System.getProperty("os.arch").toLowerCase()
|
||||
.replace(" ", "");
|
||||
if (arch.equals(ARCH_I386))
|
||||
{
|
||||
return ARCH_X86;
|
||||
}
|
||||
if (arch.equals(ARCH_AMD64))
|
||||
{
|
||||
return ARCH_X86_64;
|
||||
}
|
||||
return arch;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,16 +131,25 @@ public final class Loader
|
||||
final String os = getOS();
|
||||
final String key = "usb4java.libext." + getOS();
|
||||
final String ext = System.getProperty(key);
|
||||
if (ext != null) return ext;
|
||||
if (ext != null)
|
||||
{
|
||||
return ext;
|
||||
}
|
||||
if (os.equals(OS_LINUX) || os.equals(OS_FREEBSD) || os.equals(OS_SUNOS))
|
||||
{
|
||||
return EXT_SO;
|
||||
}
|
||||
if (os.equals(OS_WINDOWS))
|
||||
{
|
||||
return EXT_DLL;
|
||||
}
|
||||
if (os.equals(OS_OSX))
|
||||
{
|
||||
return EXT_DYLIB;
|
||||
throw new LoaderException("Unable to determine the shared library " +
|
||||
"file extension for operating system '" + os +
|
||||
"'. Please specify Java parameter -D" + key + "=<FILE-EXTENSION>");
|
||||
}
|
||||
throw new LoaderException("Unable to determine the shared library "
|
||||
+ "file extension for operating system '" + os
|
||||
+ "'. Please specify Java parameter -D" + key + "=<FILE-EXTENSION>");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,23 +161,30 @@ public final class Loader
|
||||
private static File createTempDirectory()
|
||||
{
|
||||
// Return cached tmp directory when already created
|
||||
if (tmp != null) return tmp;
|
||||
if (tmp != null)
|
||||
{
|
||||
return tmp;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
tmp = File.createTempFile("usb4java", null);
|
||||
if (!tmp.delete())
|
||||
{
|
||||
throw new IOException("Unable to delete temporary file " + tmp);
|
||||
}
|
||||
if (!tmp.mkdirs())
|
||||
{
|
||||
throw new IOException("Unable to create temporary directory "
|
||||
+ tmp);
|
||||
}
|
||||
tmp.deleteOnExit();
|
||||
return tmp;
|
||||
}
|
||||
catch (final IOException e)
|
||||
{
|
||||
throw new LoaderException("Unable to create temporary directory " +
|
||||
"for usb4java natives: " + e, e);
|
||||
throw new LoaderException("Unable to create temporary directory "
|
||||
+ "for usb4java natives: " + e, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +220,10 @@ public final class Loader
|
||||
private static String getExtraLibName()
|
||||
{
|
||||
final String os = getOS();
|
||||
if (os.equals(OS_WINDOWS)) return "libusb-1.0." + EXT_DLL;
|
||||
if (os.equals(OS_WINDOWS))
|
||||
{
|
||||
return "libusb-1.0." + EXT_DLL;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -207,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
|
||||
@ -222,7 +254,7 @@ public final class Loader
|
||||
{
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts a single library.
|
||||
@ -233,18 +265,20 @@ public final class Loader
|
||||
* The library name to extract (For example "libusb0.dll")
|
||||
* @return The absolute path to the extracted library.
|
||||
*/
|
||||
private static String extractLibrary(final String platform,
|
||||
final String lib)
|
||||
private static String extractLibrary(final String platform, final String lib)
|
||||
{
|
||||
// Extract the usb4java library
|
||||
final String source = '/' +
|
||||
Loader.class.getPackage().getName().replace('.', '/') +
|
||||
'/' + platform + "/" + lib;
|
||||
final String source = '/'
|
||||
+ Loader.class.getPackage().getName().replace('.', '/') + '/'
|
||||
+ platform + "/" + lib;
|
||||
|
||||
// Check if native library is present
|
||||
final URL url = Loader.class.getResource(source);
|
||||
if (url == null) throw new LoaderException(
|
||||
"Native library not found in classpath: " + source);
|
||||
if (url == null)
|
||||
{
|
||||
throw new LoaderException("Native library not found in classpath: "
|
||||
+ source);
|
||||
}
|
||||
|
||||
// If native library was found in an already extracted form then
|
||||
// return this one without extracting it
|
||||
@ -267,11 +301,12 @@ public final class Loader
|
||||
final File dest = new File(createTempDirectory(), lib);
|
||||
try
|
||||
{
|
||||
final InputStream stream =
|
||||
Loader.class.getResourceAsStream(source);
|
||||
final InputStream stream = Loader.class.getResourceAsStream(source);
|
||||
if (stream == null)
|
||||
{
|
||||
throw new LoaderException("Unable to find " + source
|
||||
+ " in the classpath");
|
||||
}
|
||||
try
|
||||
{
|
||||
copy(stream, dest);
|
||||
@ -283,9 +318,8 @@ public final class Loader
|
||||
}
|
||||
catch (final IOException e)
|
||||
{
|
||||
throw new LoaderException(
|
||||
"Unable to extract native library " + source + " to " + dest
|
||||
+ ": " + e, e);
|
||||
throw new LoaderException("Unable to extract native library "
|
||||
+ source + " to " + dest + ": " + e, e);
|
||||
}
|
||||
|
||||
// Mark usb4java library for deletion
|
||||
@ -305,13 +339,18 @@ public final class Loader
|
||||
*/
|
||||
public static void load()
|
||||
{
|
||||
if (loaded) return;
|
||||
if (loaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String platform = getPlatform();
|
||||
final String lib = getLibName();
|
||||
final String extraLib = getExtraLibName();
|
||||
if (extraLib != null)
|
||||
{
|
||||
System.load(extractLibrary(platform, extraLib));
|
||||
}
|
||||
System.load(extractLibrary(platform, lib));
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -36,8 +36,7 @@ public final class SsEndpointCompanionDescriptor
|
||||
|
||||
/**
|
||||
* Constructs a new descriptor which can be passed to the
|
||||
* {@link LibUsb#getSsEndpointCompanionDescriptor(Context,
|
||||
* EndpointDescriptor, SsEndpointCompanionDescriptor)}
|
||||
* {@link LibUsb#getSsEndpointCompanionDescriptor(Context, EndpointDescriptor, SsEndpointCompanionDescriptor)}
|
||||
* method.
|
||||
*/
|
||||
public SsEndpointCompanionDescriptor()
|
||||
@ -78,9 +77,9 @@ public final class SsEndpointCompanionDescriptor
|
||||
public native byte bMaxBurst();
|
||||
|
||||
/**
|
||||
* Returns the attributes. In bulk endpoint: bits 4:0 represents the
|
||||
* maximum number of streams the EP supports. In isochronous endpoint:
|
||||
* bits 1:0 represents the Mult - a zero based value that determines the
|
||||
* Returns the attributes. In bulk endpoint: bits 4:0 represents the
|
||||
* 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.
|
||||
@ -102,50 +101,51 @@ public final class SsEndpointCompanionDescriptor
|
||||
*/
|
||||
public String dump()
|
||||
{
|
||||
return String.format("Device Descriptor:%n"
|
||||
+ " bLength %18d%n"
|
||||
+ " bDescriptorType %10d%n"
|
||||
+ " bMaxBurst %16s%n"
|
||||
+ " bmAttributes %13d%n"
|
||||
+ " wBytesPerInterval %8d%n",
|
||||
bLength() & 0xff,
|
||||
bDescriptorType() & 0xff,
|
||||
bMaxBurst() & 0xff,
|
||||
bmAttributes() & 0xff,
|
||||
wBytesPerInterval() & 0xffff);
|
||||
return String.format("Device Descriptor:%n" + " bLength %18d%n"
|
||||
+ " bDescriptorType %10d%n" + " bMaxBurst %16s%n"
|
||||
+ " bmAttributes %13d%n" + " wBytesPerInterval %8d%n",
|
||||
this.bLength() & 0xff, this.bDescriptorType() & 0xff,
|
||||
this.bMaxBurst() & 0xff, this.bmAttributes() & 0xff,
|
||||
this.wBytesPerInterval() & 0xffff);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj)
|
||||
{
|
||||
if (obj == null) return false;
|
||||
if (obj == this) return true;
|
||||
if (obj.getClass() != getClass()) return false;
|
||||
final SsEndpointCompanionDescriptor other =
|
||||
(SsEndpointCompanionDescriptor) obj;
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (obj == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (obj.getClass() != this.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final SsEndpointCompanionDescriptor other = (SsEndpointCompanionDescriptor) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(bDescriptorType(), other.bDescriptorType())
|
||||
.append(bLength(), other.bLength())
|
||||
.append(bMaxBurst(), other.bMaxBurst())
|
||||
.append(bmAttributes(), other.bmAttributes())
|
||||
.append(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
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(bLength())
|
||||
.append(bDescriptorType())
|
||||
.append(bMaxBurst())
|
||||
.append(bmAttributes())
|
||||
.append(wBytesPerInterval())
|
||||
return new HashCodeBuilder().append(this.bLength())
|
||||
.append(this.bDescriptorType()).append(this.bMaxBurst())
|
||||
.append(this.bmAttributes()).append(this.wBytesPerInterval())
|
||||
.toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return dump();
|
||||
return this.dump();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -23,7 +23,7 @@ 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
|
||||
* 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.
|
||||
@ -36,10 +36,10 @@ public final class SsUsbDeviceCapabilityDescriptor
|
||||
private long ssUsbDeviceCapabilityDescriptorPointer;
|
||||
|
||||
/**
|
||||
* Constructs a new SuperSpeed USB Device Capability descriptor which can
|
||||
* Constructs a new SuperSpeed USB Device Capability descriptor which can
|
||||
* be passed to the
|
||||
* {@link LibUsb#getSsUsbDeviceCapabilityDescriptor(Context,
|
||||
* BosDevCapabilityDescriptor, SsUsbDeviceCapabilityDescriptor)} method.
|
||||
* {@link LibUsb#getSsUsbDeviceCapabilityDescriptor(Context, BosDevCapabilityDescriptor, SsUsbDeviceCapabilityDescriptor)}
|
||||
* method.
|
||||
*/
|
||||
public SsUsbDeviceCapabilityDescriptor()
|
||||
{
|
||||
@ -78,35 +78,35 @@ public final class SsUsbDeviceCapabilityDescriptor
|
||||
public native byte bDevCapabilityType();
|
||||
|
||||
/**
|
||||
* Returns the bitmap of supported device level features.
|
||||
* Returns the bitmap of supported device level features.
|
||||
*
|
||||
* @return The supported device level features.
|
||||
*/
|
||||
public native byte bmAttributes();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the bitmap encoding of the speed supported by this device when
|
||||
* Returns the bitmap encoding of the speed supported by this device when
|
||||
* operating in SuperSpeed mode.
|
||||
*
|
||||
* @return The supported speed.
|
||||
*/
|
||||
public native short wSpeedSupported();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the lowest speed at which all the functionality supported by the
|
||||
* 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.
|
||||
*
|
||||
@ -122,62 +122,58 @@ public final class SsUsbDeviceCapabilityDescriptor
|
||||
public String dump()
|
||||
{
|
||||
return String.format("SuperSpeed USB Device Capability descriptor:%n"
|
||||
+ " bLength %18d%n"
|
||||
+ " bDescriptorType %10d%n"
|
||||
+ " bDevCapabilityType %7d%n"
|
||||
+ " bmAttributes %13s%n"
|
||||
+ " wSpeedSupported %10d%n"
|
||||
+ " bFunctionalitySupport %4d%n"
|
||||
+ " bU1DevExitLat %12d%n"
|
||||
+ " bU2DevExitLat %12d%n",
|
||||
bLength() & 0xff,
|
||||
bDescriptorType() & 0xff,
|
||||
bDevCapabilityType() & 0xff,
|
||||
String.format("0x%02x", bmAttributes() & 0xff),
|
||||
wSpeedSupported() & 0xffff,
|
||||
bFunctionalitySupport() & 0xff,
|
||||
bU1DevExitLat() & 0xff,
|
||||
bU2DevExitLat() & 0xffff);
|
||||
+ " bLength %18d%n" + " bDescriptorType %10d%n"
|
||||
+ " bDevCapabilityType %7d%n" + " bmAttributes %13s%n"
|
||||
+ " wSpeedSupported %10d%n" + " bFunctionalitySupport %4d%n"
|
||||
+ " bU1DevExitLat %12d%n" + " bU2DevExitLat %12d%n",
|
||||
this.bLength() & 0xff, this.bDescriptorType() & 0xff,
|
||||
this.bDevCapabilityType() & 0xff,
|
||||
String.format("0x%02x", this.bmAttributes() & 0xff),
|
||||
this.wSpeedSupported() & 0xffff,
|
||||
this.bFunctionalitySupport() & 0xff, this.bU1DevExitLat() & 0xff,
|
||||
this.bU2DevExitLat() & 0xffff);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj)
|
||||
{
|
||||
if (obj == null) return false;
|
||||
if (obj == this) return true;
|
||||
if (obj.getClass() != getClass()) return false;
|
||||
final SsUsbDeviceCapabilityDescriptor other =
|
||||
(SsUsbDeviceCapabilityDescriptor) obj;
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (obj == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (obj.getClass() != this.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final SsUsbDeviceCapabilityDescriptor other = (SsUsbDeviceCapabilityDescriptor) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(bDescriptorType(), other.bDescriptorType())
|
||||
.append(bLength(), other.bLength())
|
||||
.append(bDevCapabilityType(), other.bDevCapabilityType())
|
||||
.append(bmAttributes(), other.bmAttributes())
|
||||
.append(wSpeedSupported(), other.wSpeedSupported())
|
||||
.append(bFunctionalitySupport(), other.bFunctionalitySupport())
|
||||
.append(bU1DevExitLat(), other.bU1DevExitLat())
|
||||
.append(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
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(bLength())
|
||||
.append(bDescriptorType())
|
||||
.append(bDevCapabilityType())
|
||||
.append(bmAttributes())
|
||||
.append(wSpeedSupported())
|
||||
.append(bFunctionalitySupport())
|
||||
.append(bU1DevExitLat())
|
||||
.append(bU2DevExitLat())
|
||||
.toHashCode();
|
||||
return new HashCodeBuilder().append(this.bLength())
|
||||
.append(this.bDescriptorType()).append(this.bDevCapabilityType())
|
||||
.append(this.bmAttributes()).append(this.wSpeedSupported())
|
||||
.append(this.bFunctionalitySupport()).append(this.bU1DevExitLat())
|
||||
.append(this.bU2DevExitLat()).toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return dump();
|
||||
return this.dump();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
|
||||
* 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
|
||||
@ -55,7 +55,7 @@ public final class Transfer
|
||||
*/
|
||||
public long getPointer()
|
||||
{
|
||||
return transferPointer;
|
||||
return this.transferPointer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,13 +169,13 @@ public final class Transfer
|
||||
// maximum capacity.
|
||||
if (length != 0)
|
||||
{
|
||||
if (transferBuffer == null)
|
||||
if (this.transferBuffer == null)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"buffer is null, only a length of 0 is allowed");
|
||||
}
|
||||
|
||||
if (transferBuffer.capacity() < length)
|
||||
if (this.transferBuffer.capacity() < length)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"buffer too small for requested length");
|
||||
@ -183,7 +183,7 @@ public final class Transfer
|
||||
}
|
||||
|
||||
// Native call.
|
||||
setLengthNative(length);
|
||||
this.setLengthNative(length);
|
||||
}
|
||||
|
||||
native void setLengthNative(final int length);
|
||||
@ -237,7 +237,7 @@ public final class Transfer
|
||||
*/
|
||||
public ByteBuffer buffer()
|
||||
{
|
||||
return transferBuffer;
|
||||
return this.transferBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -249,21 +249,21 @@ public final class Transfer
|
||||
public void setBuffer(final ByteBuffer buffer)
|
||||
{
|
||||
// Native call.
|
||||
setBufferNative(buffer);
|
||||
this.setBufferNative(buffer);
|
||||
|
||||
if (buffer != null)
|
||||
{
|
||||
// Set new length based on buffer's capacity.
|
||||
setLengthNative(buffer.capacity());
|
||||
this.setLengthNative(buffer.capacity());
|
||||
}
|
||||
else
|
||||
{
|
||||
setLengthNative(0);
|
||||
this.setLengthNative(0);
|
||||
}
|
||||
|
||||
// Once we know the native calls have gone through, update the
|
||||
// reference.
|
||||
transferBuffer = buffer;
|
||||
this.transferBuffer = buffer;
|
||||
}
|
||||
|
||||
native void setBufferNative(final ByteBuffer buffer);
|
||||
@ -297,7 +297,7 @@ public final class Transfer
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = (prime * result)
|
||||
+ (int) (transferPointer ^ (transferPointer >>> 32));
|
||||
+ (int) (this.transferPointer ^ (this.transferPointer >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -312,12 +312,12 @@ public final class Transfer
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final Transfer other = (Transfer) obj;
|
||||
if (transferPointer != other.transferPointer)
|
||||
if (this.transferPointer != other.transferPointer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -327,6 +327,6 @@ public final class Transfer
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("libusb transfer 0x%x", transferPointer);
|
||||
return String.format("libusb transfer 0x%x", this.transferPointer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -36,8 +36,8 @@ public final class Usb20ExtensionDescriptor
|
||||
|
||||
/**
|
||||
* Constructs a new USB 2.0 Extension descriptor which can be passed to the
|
||||
* {@link LibUsb#getUsb20ExtensionDescriptor(Context,
|
||||
* BosDevCapabilityDescriptor, Usb20ExtensionDescriptor)} method.
|
||||
* {@link LibUsb#getUsb20ExtensionDescriptor(Context, BosDevCapabilityDescriptor, Usb20ExtensionDescriptor)}
|
||||
* method.
|
||||
*/
|
||||
public Usb20ExtensionDescriptor()
|
||||
{
|
||||
@ -76,7 +76,7 @@ public final class Usb20ExtensionDescriptor
|
||||
public native byte bDevCapabilityType();
|
||||
|
||||
/**
|
||||
* Returns the bitmap of supported device level features.
|
||||
* Returns the bitmap of supported device level features.
|
||||
*
|
||||
* @return The supported device level features.
|
||||
*/
|
||||
@ -90,45 +90,47 @@ public final class Usb20ExtensionDescriptor
|
||||
public String dump()
|
||||
{
|
||||
return String.format("USB 2.0 Extension Descriptor:%n"
|
||||
+ " bLength %18d%n"
|
||||
+ " bDescriptorType %10d%n"
|
||||
+ " bDevCapabilityType %7d%n"
|
||||
+ " bmAttributes %13s%n",
|
||||
bLength() & 0xff,
|
||||
bDescriptorType() & 0xff,
|
||||
bDevCapabilityType() & 0xff,
|
||||
String.format("0x%08x", bmAttributes()));
|
||||
+ " bLength %18d%n" + " bDescriptorType %10d%n"
|
||||
+ " bDevCapabilityType %7d%n" + " bmAttributes %13s%n",
|
||||
this.bLength() & 0xff, this.bDescriptorType() & 0xff,
|
||||
this.bDevCapabilityType() & 0xff,
|
||||
String.format("0x%08x", this.bmAttributes()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj)
|
||||
{
|
||||
if (obj == null) return false;
|
||||
if (obj == this) return true;
|
||||
if (obj.getClass() != getClass()) return false;
|
||||
final Usb20ExtensionDescriptor other =
|
||||
(Usb20ExtensionDescriptor) obj;
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (obj == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (obj.getClass() != this.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final Usb20ExtensionDescriptor other = (Usb20ExtensionDescriptor) obj;
|
||||
return new EqualsBuilder()
|
||||
.append(bDescriptorType(), other.bDescriptorType())
|
||||
.append(bLength(), other.bLength())
|
||||
.append(bDevCapabilityType(), other.bDevCapabilityType())
|
||||
.append(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
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(bLength())
|
||||
.append(bDescriptorType())
|
||||
.append(bDevCapabilityType())
|
||||
.append(bmAttributes())
|
||||
.toHashCode();
|
||||
return new HashCodeBuilder().append(this.bLength())
|
||||
.append(this.bDescriptorType()).append(this.bDevCapabilityType())
|
||||
.append(this.bmAttributes()).toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return dump();
|
||||
return this.dump();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Copyright 2013 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.md for licensing information.
|
||||
*
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
* Based on libusb <http://www.libusb.org/>:
|
||||
*
|
||||
* Copyright 2001 Johannes Erdfelt <johannes@erdfelt.com>
|
||||
* Copyright 2007-2009 Daniel Drake <dsd@gentoo.org>
|
||||
@ -48,7 +48,7 @@ public final class Version implements Comparable<Version>
|
||||
*/
|
||||
public long getPointer()
|
||||
{
|
||||
return versionPointer;
|
||||
return this.versionPointer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,13 +89,9 @@ public final class Version implements Comparable<Version>
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return new HashCodeBuilder()
|
||||
.append(major())
|
||||
.append(minor())
|
||||
.append(micro())
|
||||
.append(nano())
|
||||
.append(rc())
|
||||
.toHashCode();
|
||||
return new HashCodeBuilder().append(this.major()).append(this.minor())
|
||||
.append(this.micro()).append(this.nano()).append(this.rc())
|
||||
.toHashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,19 +105,17 @@ public final class Version implements Comparable<Version>
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
if (this.getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Version other = (Version) obj;
|
||||
|
||||
return new EqualsBuilder()
|
||||
.append(major(), other.major())
|
||||
.append(minor(), other.minor())
|
||||
.append(micro(), other.micro())
|
||||
.append(nano(), other.nano())
|
||||
.append(rc(), other.rc())
|
||||
return new EqualsBuilder().append(this.major(), other.major())
|
||||
.append(this.minor(), other.minor())
|
||||
.append(this.micro(), other.micro())
|
||||
.append(this.nano(), other.nano()).append(this.rc(), other.rc())
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
@ -137,18 +131,17 @@ public final class Version implements Comparable<Version>
|
||||
return 1;
|
||||
}
|
||||
|
||||
return new CompareToBuilder()
|
||||
.append(major(), other.major())
|
||||
.append(minor(), other.minor())
|
||||
.append(micro(), other.micro())
|
||||
.append(nano(), other.nano())
|
||||
.append(rc(), other.rc())
|
||||
return new CompareToBuilder().append(this.major(), other.major())
|
||||
.append(this.minor(), other.minor())
|
||||
.append(this.micro(), other.micro())
|
||||
.append(this.nano(), other.nano()).append(this.rc(), other.rc())
|
||||
.toComparison();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return major() + "." + minor() + "." + micro() + "." + nano() + rc();
|
||||
return this.major() + "." + this.minor() + "." + this.micro() + "."
|
||||
+ this.nano() + this.rc();
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,3 +7,4 @@
|
||||
* Low-Level classes based on the native libusb library.
|
||||
*/
|
||||
package de.ailis.usb4java.libusb;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user