- print extra descriptors as hex array

git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@244 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
spandi
2007-02-19 19:22:46 +00:00
parent 0f627b66c6
commit 11f8d93094
3 changed files with 18 additions and 7 deletions

View File

@@ -309,7 +309,7 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
+ confDesc.getMaxPower() + ")\n");
sb.append("\textralen: 0x"
+ Integer.toHexString(confDesc.getExtralen()) + "\n");
sb.append("\textra: " + confDesc.getExtra() + "\n");
sb.append("\textra: " + extraDescriptorToString(confDesc.getExtra()) + "\n");
// get device handle to retrieve string descriptors
Usb_Bus bus = rootBus;
while (bus != null) {
@@ -382,7 +382,7 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
+ Integer.toHexString(intDesc.getIInterface()) + "\n");
sb.append("\textralen: 0x"
+ Integer.toHexString(intDesc.getExtralen()) + "\n");
sb.append("\textra: " + intDesc.getExtra() + "\n");
sb.append("\textra: " + extraDescriptorToString(intDesc.getExtra()) + "\n");
// get device handle to retrieve string descriptors
Usb_Bus bus = rootBus;
while (bus != null) {
@@ -446,8 +446,21 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
+ Integer.toHexString(epDesc.getBSynchAddress()) + "\n");
sb.append("\textralen: 0x"
+ Integer.toHexString(epDesc.getExtralen()) + "\n");
sb.append("\textra: " + epDesc.getExtra() + "\n");
sb.append("\textra: " + extraDescriptorToString(epDesc.getExtra()) + "\n");
textArea.setText(sb.toString());
}
}
private String extraDescriptorToString(byte[] extra) {
if (extra != null) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < extra.length; i++) {
sb.append("0x");
sb.append(Integer.toHexString(extra[i] & 0xff));
sb.append(' ');
}
return sb.toString();
}
return null;
}
}

View File

@@ -402,10 +402,8 @@ public class UsbView extends JFrame {
}
void expandAll(JTree tree) {
int row = 0;
while (row < tree.getRowCount()) {
for (int row = 0; row < tree.getRowCount(); row++) {
tree.expandRow(row);
row++;
}
}
}