1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
/*
* Java libusb wrapper
* Copyright (c) 2005-2006 Andreas Schlaepfer <spandi at users.sourceforge.net>
*
* http://libusbjava.sourceforge.net
* This library is covered by the LGPL, read LGPL.txt for details.
*/
package ch.ntb.usb;
import java.io.PrintStream;
public class Utils {
public static void logBus(Usb_Bus bus) {
logBus(bus, System.out);
}
public static void logBus(Usb_Bus bus, PrintStream out) {
Usb_Bus usb_Bus = bus;
while (usb_Bus != null) {
out.println(usb_Bus.toString());
Usb_Device dev = usb_Bus.getDevices();
while (dev != null) {
out.println("\t" + dev.toString());
// Usb_Device_Descriptor
Usb_Device_Descriptor defDesc = dev.getDescriptor();
out.println("\t\t" + defDesc.toString());
// Usb_Config_Descriptor
Usb_Config_Descriptor[] confDesc = dev.getConfig();
for (int i = 0; i < confDesc.length; i++) {
out.println("\t\t" + confDesc[i].toString());
Usb_Interface[] int_ = confDesc[i].getInterface();
if (int_ != null) {
for (int j = 0; j < int_.length; j++) {
out.println("\t\t\t" + int_[j].toString());
Usb_Interface_Descriptor[] intDesc = int_[j]
.getAltsetting();
if (intDesc != null) {
for (int k = 0; k < intDesc.length; k++) {
out.println("\t\t\t\t"
+ intDesc[k].toString());
Usb_Endpoint_Descriptor[] epDesc = intDesc[k]
.getEndpoint();
if (epDesc != null) {
for (int e = 0; e < epDesc.length; e++) {
out.println("\t\t\t\t\t"
+ epDesc[e].toString());
}
}
}
}
}
}
}
dev = dev.getNext();
}
usb_Bus = usb_Bus.getNext();
}
}
}
|