git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@223 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
42 lines
949 B
Java
42 lines
949 B
Java
/*
|
|
* Java libusb wrapper
|
|
* Copyright (c) 2005-2006 Andreas Schläpfer <libusb@drip.ch>
|
|
*
|
|
* This library is covered by the LGPL, read LGPL.txt for details.
|
|
*/
|
|
package ch.ntb.usb.demo;
|
|
|
|
import ch.ntb.usb.LibusbJava;
|
|
import ch.ntb.usb.Usb_Bus;
|
|
import ch.ntb.usb.Utils;
|
|
|
|
/**
|
|
* Initalises Libusb and prints the bus(ses) with attached devices to the
|
|
* standard out.<br>
|
|
*
|
|
*
|
|
* @author schlaepfer
|
|
*
|
|
*/
|
|
public class LogBus {
|
|
|
|
private static void logBus() {
|
|
// if you don't use the ch.ntb.usb.Device class you must initialise
|
|
// Libusb before use
|
|
LibusbJava.usb_init();
|
|
LibusbJava.usb_find_busses();
|
|
LibusbJava.usb_find_devices();
|
|
|
|
// retrieve a object tree representing the bus with its devices and
|
|
// descriptors
|
|
Usb_Bus bus = LibusbJava.usb_get_busses();
|
|
|
|
// log the bus structure to standard out
|
|
Utils.logBus(bus);
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
logBus();
|
|
}
|
|
}
|