Upgrade to libusbx-1.0.16-rc3. Only Linux binaries have been updated.

This commit is contained in:
Klaus Reimer 2013-07-09 18:23:10 +02:00
parent baa5f63099
commit 4a47d32920
8 changed files with 25 additions and 42 deletions

View File

@ -5,8 +5,8 @@ DOWNLOADS="$SRCDIR/downloads"
LIBUSB="libusbx"
LIBUSB_VERSION="1.0.16"
LIBUSB_RC="-rc8"
LIBUSBX_VERSION="1.0.15"
LIBUSBX_RC=""
LIBUSBX_VERSION="1.0.16"
LIBUSBX_RC="-rc3"
build()
{

View File

@ -11,6 +11,6 @@ ARCH="x86"
HOST="$ARCH-$OS-gnu"
CFLAGS="-m32"
LIBUSB_CONFIG="--disable-shared"
USB4JAVA_LIBS="-lrt"
USB4JAVA_LIBS="-lrt -ludev"
build

View File

@ -11,7 +11,7 @@ ARCH="x86_64"
HOST="$ARCH-$OS-gnu"
CFLAGS="-m64 -Wl,--wrap=memcpy"
LIBUSB_CONFIG="--disable-shared"
USB4JAVA_LIBS="-lrt"
USB4JAVA_LIBS="-lrt -ludev"
USB4JAVA_CFLAGS="-DWRAP_MEMCPY"
build

View File

@ -166,23 +166,21 @@ JNIEXPORT jint JNICALL METHOD_NAME(LibUsb, getPortNumber)
}
/**
* int getPortPath(Context, Device, byte[])
* int getPortNumbers(Device, byte[])
*/
JNIEXPORT jint JNICALL METHOD_NAME(LibUsb, getPortPath)
JNIEXPORT jint JNICALL METHOD_NAME(LibUsb, getPortNumbers)
(
JNIEnv *env, jclass class, jobject context, jobject device, jbyteArray path
JNIEnv *env, jclass class, jobject device, jbyteArray path
)
{
NOT_NULL(env, device, return 0);
NOT_NULL(env, path, return 0);
struct libusb_context *ctx = unwrapContext(env, context);
if (!ctx && context) return 0;
libusb_device *dev = unwrapDevice(env, device);
if (!dev) return 0;
jsize size = (*env)->GetArrayLength(env, path);
unsigned char buffer[size];
#if defined(LIBUSBX_API_VERSION)
int result = libusb_get_port_path(ctx, dev, buffer, size);
int result = libusb_get_port_numbers(dev, buffer, size);
#else
int result = 0;
#endif

View File

@ -604,8 +604,6 @@ public final class LibUsb
/**
* Get the list of all port numbers from root for the specified device.
*
* @param context
* The context to operate on, or NULL for the default context
* @param device
* A device.
* @param path
@ -614,8 +612,8 @@ public final class LibUsb
* @return The number of elements filled, {@link #ERROR_OVERFLOW} if the
* array is too small
*/
public static native int getPortPath(final Context context,
final Device device, final byte[] path);
public static native int getPortNumbers(final Device device,
final byte[] path);
/**
* Get the the parent from the specified device [EXPERIMENTAL].

View File

@ -153,77 +153,64 @@ public class LibUSBDeviceTest
}
/**
* Tests the {@link LibUsb#getPortPath(Context, Device, byte[])} method.
* Tests the {@link LibUsb#getPortNumbers(Device, byte[])} method.
*/
@Test
public void testGetPortPath()
public void testGetPortNumbers()
{
assumeUsbTestsEnabled();
assumeNotNull(this.device);
byte[] path = new byte[8];
int result = LibUsb.getPortPath(this.context, this.device, path);
int result = LibUsb.getPortNumbers(this.device, path);
assertTrue(result > 0);
assertTrue(result <= path.length);
}
/**
* Tests the {@link LibUsb#getPortPath(Context, Device, byte[])} method with
* Tests the {@link LibUsb#getPortNumbers(Device, byte[])} method with
* 0-sized path buffer.
*/
@Test
public void testGetPortPathWithTooSmallBuffer()
public void testGetPortNumbersWithTooSmallBuffer()
{
assumeUsbTestsEnabled();
assumeNotNull(this.device);
byte[] path = new byte[0];
int result = LibUsb.getPortPath(this.context, this.device, path);
int result = LibUsb.getPortNumbers(this.device, path);
assertEquals(LibUsb.ERROR_OVERFLOW, result);
}
/**
* Tests the {@link LibUsb#getPortPath(Context, Device, byte[])} method
* Tests the {@link LibUsb#getPortNumbers(Device, byte[])} method
* without a device.
*/
@Test(expected = IllegalArgumentException.class)
public void testGetPortPathWithoutDevice()
public void testGetPortNumbersWithoutDevice()
{
assumeUsbTestsEnabled();
LibUsb.getPortPath(this.context, null, new byte[8]);
LibUsb.getPortNumbers(null, new byte[8]);
}
/**
* Tests the {@link LibUsb#getPortPath(Context, Device, byte[])} method
* Tests the {@link LibUsb#getPortNumbers(Device, byte[])} method
* without a buffer.
*/
@Test(expected = IllegalArgumentException.class)
public void testGetPortPathWithoutBuffer()
public void testGetPortNumbersWithoutBuffer()
{
assumeUsbTestsEnabled();
LibUsb.getPortPath(this.context, this.device, null);
LibUsb.getPortNumbers(this.device, null);
}
/**
* Tests {@link LibUsb#getPortPath(Context, Device, byte[])} method with
* uninitialized USB context.
*/
@Test(expected = IllegalStateException.class)
public void testGetPortPathWithUninitializedContext()
{
assumeUsbTestsEnabled();
assumeNotNull(this.device);
final Context context = new Context();
LibUsb.getPortPath(context, this.device, new byte[16]);
}
/**
* Tests {@link LibUsb#getPortPath(Context, Device, byte[])} method with
* Tests {@link LibUsb#getPortNumbers(Device, byte[])} method with
* uninitialized device.
*/
@Test(expected = IllegalStateException.class)
public void testGetPortPathWithUninitializedDevice()
public void testGetPortNumbersWithUninitializedDevice()
{
assumeUsbTestsEnabled();
LibUsb.getPortPath(this.context, new Device(), new byte[16]);
LibUsb.getPortNumbers(new Device(), new byte[16]);
}
/**