Improved dump output.
FIxed endless loop in tree dump.
This commit is contained in:
parent
c073024c3a
commit
3ca70baf17
@ -12,7 +12,7 @@
|
||||
<include>*</include>
|
||||
</includes>
|
||||
<fileMode>644</fileMode>
|
||||
<lineEnding>unix</lineEnding>
|
||||
<lineEnding>keep</lineEnding>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<include>*</include>
|
||||
</includes>
|
||||
<fileMode>644</fileMode>
|
||||
<lineEnding>unix</lineEnding>
|
||||
<lineEnding>keep</lineEnding>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<include>*</include>
|
||||
</includes>
|
||||
<fileMode>644</fileMode>
|
||||
<lineEnding>unix</lineEnding>
|
||||
<lineEnding>keep</lineEnding>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<include>*</include>
|
||||
</includes>
|
||||
<fileMode>644</fileMode>
|
||||
<lineEnding>unix</lineEnding>
|
||||
<lineEnding>keep</lineEnding>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<include>*</include>
|
||||
</includes>
|
||||
<fileMode>644</fileMode>
|
||||
<lineEnding>unix</lineEnding>
|
||||
<lineEnding>keep</lineEnding>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
|
||||
@ -615,7 +615,7 @@ public final class USB
|
||||
final ByteBuffer buffer = ByteBuffer
|
||||
.allocateDirect(MAX_DESCRIPTOR_SIZE);
|
||||
final int len = usb_get_descriptor(handle, USB_DT_STRING, 0, buffer);
|
||||
if (len < 0) return null;
|
||||
if (len < 2) return null;
|
||||
final short[] languages = new short[(len - 2) / 2];
|
||||
if (languages.length == 0) return languages;
|
||||
buffer.position(2);
|
||||
|
||||
@ -103,9 +103,9 @@ public final class USB_Bus
|
||||
.filename();
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
builder.append(String.format("Bus:%n" +
|
||||
" dirname %15s%n" +
|
||||
" dirname %23s%n" +
|
||||
" location %15d%n" +
|
||||
" root_dev %15s%n",
|
||||
" root_dev %22s%n",
|
||||
dirname(), location(), rootDev));
|
||||
USB_Device device = devices();
|
||||
while (device != null)
|
||||
|
||||
@ -130,8 +130,8 @@ public final class USB_Device
|
||||
{
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
builder.append(String.format("Device:%n" +
|
||||
" filename %5s%n" +
|
||||
" bus %5s%n" +
|
||||
" filename %20s%n" +
|
||||
" bus %25s%n" +
|
||||
" num_children %5d%n" +
|
||||
" devnum %5d%n",
|
||||
filename(), bus().dirname(), num_children(), devnum()));
|
||||
@ -142,6 +142,7 @@ public final class USB_Device
|
||||
" "));
|
||||
for (final USB_Config_Descriptor descriptor : config())
|
||||
{
|
||||
if (descriptor == null) continue;
|
||||
builder.append(descriptor.toString(handle).replaceAll("(?m)^",
|
||||
" "));
|
||||
}
|
||||
|
||||
@ -24,7 +24,8 @@ public class Dump
|
||||
{
|
||||
/**
|
||||
* Dumps the device tree. Please note that the displayed tree can only
|
||||
* display devices to which the user has write access.
|
||||
* display devices to which the user has write access. On some platforms
|
||||
* the tree can't be dumped at all.
|
||||
*/
|
||||
|
||||
private static void dumpDeviceTree()
|
||||
@ -36,10 +37,11 @@ public class Dump
|
||||
while (bus != null)
|
||||
{
|
||||
final USB_Device root = bus.root_dev();
|
||||
if (root == null) continue;
|
||||
|
||||
System.out.format("Bus %s%n", bus.dirname());
|
||||
dumpSubDeviceTree(bus.root_dev(), " ");
|
||||
if (root != null)
|
||||
{
|
||||
System.out.format("Bus %s%n", bus.dirname());
|
||||
dumpSubDeviceTree(bus.root_dev(), " ");
|
||||
}
|
||||
bus = bus.next();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user