Code cleanups

This commit is contained in:
Klaus Reimer 2013-04-12 21:51:40 +02:00
parent e83a513fed
commit b97266a888
3 changed files with 16 additions and 16 deletions

View File

@ -166,12 +166,14 @@ public final class Usb4JavaConfiguration implements UsbConfiguration
{
if (this.activeSettings.get(number & 0xff) != iface)
{
final int result = LibUSB.setInterfaceAltSetting(this.device.open(),
number,
final int result = LibUSB.setInterfaceAltSetting(
this.device.open(), number,
iface.getUsbInterfaceDescriptor().bAlternateSetting());
if (result < 0)
{
throw new LibUsbException(
"Unable to set alternate interface", result);
}
this.activeSettings.put(number & 0xff, iface);
}
}

View File

@ -23,9 +23,7 @@ public interface PollfdListener
* @param events
* events to monitor for.
* @param userData
* User data pointer specified in
* {@link LibUSB#setPollfdNotifiers(Context, PollfdListener, Object)}
* call.
* User data pointer.
*/
void pollfdAdded(FileDescriptor fd, int events, Object userData);
@ -39,10 +37,7 @@ public interface PollfdListener
* @param fd
* The file descriptor to stop monitoring.
* @param userData
* User data pointer specified in
* {@link LibUSB#setPollfdNotifiers(Context, PollfdListener, Object)}
* call
*
* User data pointer.
*/
void pollfdRemoved(FileDescriptor fd, Object userData);
}

View File

@ -2,6 +2,7 @@
* Copyright (C) 2013 Klaus Reimer <k@ailis.de>
* See LICENSE.txt for licensing information.
*/
package de.ailis.usb4java.utils;
import java.nio.ByteBuffer;
@ -12,7 +13,7 @@ import de.ailis.usb4java.libusb.LibUSB;
/**
* Utility functions used for descriptor dumps.
*
*
* @author Klaus Reimer (k@ailis.de)
*/
public final class DumpUtils
@ -20,7 +21,7 @@ public final class DumpUtils
/** Mapping from USB class id to USB class name. */
private static final Map<Integer, String> CLASS_NAMES =
new HashMap<Integer, String>();
static
{
CLASS_NAMES.put(LibUSB.CLASS_PER_INTERFACE, "Per interface");
@ -37,11 +38,13 @@ public final class DumpUtils
CLASS_NAMES.put(LibUSB.CLASS_VIDEO, "Video");
CLASS_NAMES.put(LibUSB.CLASS_VENDOR_SPEC, "Vendor-specific");
CLASS_NAMES.put(LibUSB.CLASS_APPLICATION, "Application");
CLASS_NAMES.put(LibUSB.CLASS_PERSONAL_HEALTHCARE, "Personal Healthcare");
CLASS_NAMES.put(LibUSB.CLASS_PERSONAL_HEALTHCARE,
"Personal Healthcare");
CLASS_NAMES.put(LibUSB.CLASS_DIAGNOSTIC_DEVICE, "Diagnostic Device");
CLASS_NAMES.put(LibUSB.CLASS_WIRELESS, "Wireless");
}
/**
* Private constructor to prevent instantiation.
*/
@ -76,10 +79,10 @@ public final class DumpUtils
{
return String.format("%x.%02x", bcd >> Byte.SIZE, bcd & 0xff);
}
/**
* Returns a hex dump of the specified byte buffer.
*
*
* @param bytes
* The bytes to dump.
* @return The hex dump.
@ -101,5 +104,5 @@ public final class DumpUtils
}
if (i % columns != 0) builder.append(String.format("%n"));
return builder.toString();
}
}
}