}
bus = bus.getNext();
}
textArea.setText(sb.toString());
} else if (component instanceof Usb_Config_Descriptor) {
Usb_Config_Descriptor confDesc = (Usb_Config_Descriptor) component;
StringBuffer sb = new StringBuffer("Usb_Config_Descriptor\n");
sb.append("\tblenght: 0x"
+ Integer.toHexString(confDesc.getBLength()) + "\n");
sb.append("\tbDescriptorType: 0x"
+ Integer.toHexString(confDesc.getBDescriptorType() & 0xFF)
+ "\n");
sb.append("\tbNumInterfaces: 0x"
+ Integer.toHexString(confDesc.getBNumInterfaces() & 0xFF)
+ "\n");
sb.append("\tbConfigurationValue: 0x"
+ Integer.toHexString(confDesc.getBConfigurationValue() & 0xFF)
+ "\n");
sb.append("\tiConfiguration: 0x"
+ Integer.toHexString(confDesc.getIConfiguration() & 0xFF)
+ "\n");
sb.append("\tbmAttributes: 0x"
+ Integer.toHexString(confDesc.getBmAttributes() & 0xFF)
+ "\n");
sb.append("\tMaxPower [mA]: 0x"
+ Integer.toHexString(confDesc.getMaxPower() & 0xFF) + " ("
+ confDesc.getMaxPower() + ")\n");
sb.append("\textralen: 0x"
+ Integer.toHexString(confDesc.getExtralen()) + "\n");
sb.append("\textra: "
+ extraDescriptorToString(confDesc.getExtra()) + "\n");
// get device handle to retrieve string descriptors
Usb_Bus bus = rootBus;
while (bus != null) {
Usb_Device dev = bus.getDevices();
while (dev != null) {
Usb_Config_Descriptor[] tmpConfDesc = dev.getConfig();
for (int i = 0; i < tmpConfDesc.length; i++) {
if ((tmpConfDesc.equals(confDesc))
&& (confDesc.getIConfiguration() > 0)) {
try {
sb.append("\nString descriptors\n");
long handle = LibusbJava1.libusb_open(dev);
try {
String configuration = LibusbJava1
.libusb_get_string_descriptor_ascii(
handle,
confDesc.getIConfiguration(),
255);
if (configuration == null)
configuration = "unable to fetch configuration string";
sb.append("\tiConfiguration: "
+ configuration + "\n");