- demo files added
git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@223 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
41
java/test/ch/ntb/usb/demo/LogBus.java
Normal file
41
java/test/ch/ntb/usb/demo/LogBus.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Java libusb wrapper
|
||||
* Copyright (c) 2005-2006 Andreas Schl<68>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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user