OpenCores
URL https://opencores.org/ocsvn/usb_fpga_2_13/usb_fpga_2_13/trunk

Subversion Repositories usb_fpga_2_13

[/] [usb_fpga_2_13/] [trunk/] [libusbJava-src/] [ch/] [ntb/] [usb/] [Utils.java] - Blame information for rev 2

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.