Converted to multi-module maven project.
This commit is contained in:
parent
03cef5357b
commit
17130ec21b
@ -1,168 +0,0 @@
|
||||
import javax.usb.UsbConst;
|
||||
import javax.usb.UsbDevice;
|
||||
import javax.usb.UsbDeviceDescriptor;
|
||||
import javax.usb.UsbHostManager;
|
||||
import javax.usb.UsbHub;
|
||||
import javax.usb.UsbPort;
|
||||
import javax.usb.UsbServices;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011 Klaus Reimer <k@ailis.de>
|
||||
* See LICENSE.txt for licensing information.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Test
|
||||
*
|
||||
* @author k
|
||||
*/
|
||||
|
||||
public class Test
|
||||
{
|
||||
private static int indentLevel = 0;
|
||||
|
||||
public static String indent()
|
||||
{
|
||||
final StringBuilder str = new StringBuilder();
|
||||
for (int i = 0; i < indentLevel; i++) str.append(" ");
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
public static String getSpeedString(final Object speed)
|
||||
{
|
||||
if (speed == UsbConst.DEVICE_SPEED_FULL)
|
||||
return "Full";
|
||||
else if (speed == UsbConst.DEVICE_SPEED_LOW)
|
||||
return "Low";
|
||||
else if (speed == UsbConst.DEVICE_SPEED_UNKNOWN)
|
||||
return "Unknown";
|
||||
else
|
||||
throw new RuntimeException("Unknown speed object: " + speed);
|
||||
}
|
||||
|
||||
public static void dumpHub(final UsbHub hub) throws Exception
|
||||
{
|
||||
System.out.println(indent() + "Manufacturer: " + hub.getManufacturerString());
|
||||
System.out.println(indent() + "Product: " + hub.getProductString());
|
||||
System.out.println(indent() + "Serial number: " + hub.getSerialNumberString());
|
||||
System.out.println(indent() + "Speed: " + getSpeedString(hub.getSpeed()));
|
||||
System.out.println(indent() + "Devices: " + hub.getAttachedUsbDevices().size());
|
||||
System.exit(1);
|
||||
|
||||
indentLevel++;
|
||||
for (byte i = 0; i < hub.getAttachedUsbDevices().size(); i++)
|
||||
{
|
||||
System.out.println(indent() + "Device " + i + ":");
|
||||
indentLevel++;
|
||||
final UsbDevice device = (UsbDevice) hub.getAttachedUsbDevices().get(i);
|
||||
dumpDevice(device);
|
||||
indentLevel--;
|
||||
}
|
||||
indentLevel--;
|
||||
|
||||
/*
|
||||
System.out.println(indent() + "Ports: " + hub.getUsbPorts().size());
|
||||
|
||||
indentLevel++;
|
||||
for (byte i = 1; i <= hub.getNumberOfPorts(); i++)
|
||||
{
|
||||
System.out.println(indent() + "Port " + i + ":");
|
||||
indentLevel++;
|
||||
final UsbPort port = hub.getUsbPort(i);
|
||||
dumpPort(port);
|
||||
indentLevel--;
|
||||
}
|
||||
indentLevel--;
|
||||
*/
|
||||
}
|
||||
|
||||
public static void dumpPort(final UsbPort port) throws Exception
|
||||
{
|
||||
System.out.println(indent() + "Port number: " + port.getPortNumber());
|
||||
final UsbDevice device = port.getUsbDevice();
|
||||
if (device != null) dumpDevice(device);
|
||||
}
|
||||
|
||||
public static void dumpDevice(final UsbDevice device) throws Exception
|
||||
{
|
||||
System.out.println(indent() + "Configured: " + device.isConfigured());
|
||||
System.out.println(indent() + "Is Hub: " + device.isUsbHub());
|
||||
if (device.isUsbHub())
|
||||
{
|
||||
// dumpHub((UsbHub) device);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(indent() + "Manufacturer: " + device.getManufacturerString());
|
||||
System.out.println(indent() + "Product: " + device.getProductString());
|
||||
System.out.println(indent() + "Serial number: " + device.getSerialNumberString());
|
||||
System.out.println(indent() + "Speed: " + getSpeedString(device.getSpeed()));
|
||||
}
|
||||
final UsbDeviceDescriptor descriptor = device.getUsbDeviceDescriptor();
|
||||
System.out.println(indent() + "VendorId: " + String.format("%04x", descriptor.idVendor()));
|
||||
System.out.println(indent() + "ProductId: " + String.format("%04x", descriptor.idProduct()));
|
||||
}
|
||||
|
||||
public static void main(final String args[]) throws Exception
|
||||
{
|
||||
final UsbServices services = UsbHostManager.getUsbServices();
|
||||
|
||||
// System.out.println("Implementation Description: ");
|
||||
// System.out.println(services.getImpDescription());
|
||||
// System.out.println("Implementation version: " + services.getImpVersion());
|
||||
// System.out.println("API version: " + services.getApiVersion());
|
||||
final UsbHub rootUsbHub = services.getRootUsbHub();
|
||||
if (rootUsbHub != null)
|
||||
{
|
||||
System.out.println("Root hub:");
|
||||
//indentLevel++;
|
||||
System.out.println("POrts:" + rootUsbHub.getNumberOfPorts());
|
||||
for (final Object item: rootUsbHub.getUsbPorts())
|
||||
{
|
||||
final UsbPort port = (UsbPort) item;
|
||||
System.out.println(port.getUsbDevice().getSerialNumberString());
|
||||
System.out.println(port.getPortNumber());
|
||||
}
|
||||
//dumpHub(rootUsbHub);
|
||||
//indentLevel--;
|
||||
}
|
||||
|
||||
/*
|
||||
services.addUsbServicesListener(new UsbServicesListener()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void usbDeviceDetached(final UsbServicesEvent event)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.println("Detached: " +event.getUsbDevice().getProductString());
|
||||
}
|
||||
catch (final Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void usbDeviceAttached(final UsbServicesEvent event)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.println("Attached: " +event.getUsbDevice().getProductString());
|
||||
}
|
||||
catch (final Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
// while (true)
|
||||
// {
|
||||
// Thread.sleep(100);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
* See LICENSE.txt for licensing information.
|
||||
*/
|
||||
|
||||
package de.ailis.usb4java.jni;
|
||||
package de.ailis.usb4java;
|
||||
|
||||
|
||||
/**
|
||||
@ -3,7 +3,7 @@
|
||||
* See LICENSE.txt for licensing information.
|
||||
*/
|
||||
|
||||
package de.ailis.usb4java.jni;
|
||||
package de.ailis.usb4java;
|
||||
|
||||
|
||||
/**
|
||||
@ -3,7 +3,7 @@
|
||||
* See LICENSE.txt for licensing information.
|
||||
*/
|
||||
|
||||
package de.ailis.usb4java.jni;
|
||||
package de.ailis.usb4java;
|
||||
|
||||
|
||||
/**
|
||||
@ -3,7 +3,7 @@
|
||||
* See LICENSE.txt for licensing information.
|
||||
*/
|
||||
|
||||
package de.ailis.usb4java.jni;
|
||||
package de.ailis.usb4java;
|
||||
|
||||
|
||||
/**
|
||||
@ -3,7 +3,7 @@
|
||||
* See LICENSE.txt for licensing information.
|
||||
*/
|
||||
|
||||
package de.ailis.usb4java.jni;
|
||||
package de.ailis.usb4java;
|
||||
|
||||
|
||||
/**
|
||||
@ -3,7 +3,7 @@
|
||||
* See LICENSE.txt for licensing information.
|
||||
*/
|
||||
|
||||
package de.ailis.usb4java.jni;
|
||||
package de.ailis.usb4java;
|
||||
|
||||
|
||||
/**
|
||||
@ -3,7 +3,7 @@
|
||||
* See LICENSE.txt for licensing information.
|
||||
*/
|
||||
|
||||
package de.ailis.usb4java.jni;
|
||||
package de.ailis.usb4java;
|
||||
|
||||
|
||||
/**
|
||||
@ -3,7 +3,7 @@
|
||||
* See LICENSE.txt for licensing information.
|
||||
*/
|
||||
|
||||
package de.ailis.usb4java.jni;
|
||||
package de.ailis.usb4java;
|
||||
|
||||
|
||||
/**
|
||||
@ -3,7 +3,7 @@
|
||||
* See LICENSE.txt for licensing information.
|
||||
*/
|
||||
|
||||
package de.ailis.usb4java.jni;
|
||||
package de.ailis.usb4java;
|
||||
|
||||
|
||||
/**
|
||||
@ -5,15 +5,6 @@
|
||||
|
||||
package de.ailis.usb4java;
|
||||
|
||||
import de.ailis.usb4java.jni.USB;
|
||||
import de.ailis.usb4java.jni.USB_Bus;
|
||||
import de.ailis.usb4java.jni.USB_Config_Descriptor;
|
||||
import de.ailis.usb4java.jni.USB_Handle;
|
||||
import de.ailis.usb4java.jni.USB_Device;
|
||||
import de.ailis.usb4java.jni.USB_Device_Descriptor;
|
||||
import de.ailis.usb4java.jni.USB_Endpoint_Descriptor;
|
||||
import de.ailis.usb4java.jni.USB_Interface;
|
||||
import de.ailis.usb4java.jni.USB_Interface_Descriptor;
|
||||
|
||||
|
||||
/**
|
||||
27
usb4java-jsr80/pom.xml
Normal file
27
usb4java-jsr80/pom.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>usb4java</artifactId>
|
||||
<groupId>de.ailis.usb4java</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>de.ailis.usb4java</groupId>
|
||||
<artifactId>usb4java-jsr80</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>usb4java-jsr80</name>
|
||||
<description>The usb4java JSR80 implementation.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>de.ailis.usb4java</groupId>
|
||||
<artifactId>usb4java-jni</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.usb</groupId>
|
||||
<artifactId>usb</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -7,8 +7,6 @@ package de.ailis.usb4java;
|
||||
|
||||
import javax.usb.UsbConfigurationDescriptor;
|
||||
|
||||
import de.ailis.usb4java.jni.USB_Config_Descriptor;
|
||||
|
||||
|
||||
/**
|
||||
* UsbConfigurationDescriptor implementation of usb4java.
|
||||
@ -20,8 +20,6 @@ import javax.usb.UsbPort;
|
||||
import javax.usb.UsbStringDescriptor;
|
||||
import javax.usb.event.UsbDeviceListener;
|
||||
|
||||
import de.ailis.usb4java.jni.USB_Device;
|
||||
|
||||
|
||||
/**
|
||||
* UsbDevice implementation of usb4java.
|
||||
@ -11,8 +11,6 @@ import javax.usb.UsbDevice;
|
||||
import javax.usb.UsbHub;
|
||||
import javax.usb.UsbPort;
|
||||
|
||||
import de.ailis.usb4java.jni.USB_Device;
|
||||
|
||||
|
||||
/**
|
||||
* UsbHub implementation of usb4java.
|
||||
@ -7,8 +7,6 @@ package de.ailis.usb4java;
|
||||
|
||||
import javax.usb.UsbInterfaceDescriptor;
|
||||
|
||||
import de.ailis.usb4java.jni.USB_Interface_Descriptor;
|
||||
|
||||
|
||||
/**
|
||||
* UsbInterfaceDescriptor implementation of usb4java.
|
||||
@ -15,13 +15,6 @@ import javax.usb.UsbInterfaceDescriptor;
|
||||
import javax.usb.UsbServices;
|
||||
import javax.usb.event.UsbServicesListener;
|
||||
|
||||
import de.ailis.usb4java.jni.USB;
|
||||
import de.ailis.usb4java.jni.USB_Bus;
|
||||
import de.ailis.usb4java.jni.USB_Config_Descriptor;
|
||||
import de.ailis.usb4java.jni.USB_Device;
|
||||
import de.ailis.usb4java.jni.USB_Device_Descriptor;
|
||||
import de.ailis.usb4java.jni.USB_Interface;
|
||||
import de.ailis.usb4java.jni.USB_Interface_Descriptor;
|
||||
|
||||
|
||||
/**
|
||||
@ -14,5 +14,16 @@ package de.ailis.usb4java;
|
||||
|
||||
public class VirtualRootUsbHub extends UsbHubImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param device
|
||||
*/
|
||||
|
||||
public VirtualRootUsbHub()
|
||||
{
|
||||
super(null);
|
||||
}
|
||||
// TODO Implement me
|
||||
}
|
||||
@ -10,14 +10,13 @@
|
||||
* Native methods for the USB class.
|
||||
*
|
||||
* @author Klaus Reimer <k@ailis.de>
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include <usb.h>
|
||||
#include "USBBus.h"
|
||||
#include "USBDevice.h"
|
||||
#include "USBDevHandle.h"
|
||||
#include "USB_Bus.h"
|
||||
#include "USB_Device.h"
|
||||
#include "USB_Handle.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
#include <jni.h>
|
||||
#include <usb.h>
|
||||
#include "USBDevice.h"
|
||||
#include "USB_Device.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -7,4 +7,4 @@
|
||||
extern jobject wrap_usb_bus(JNIEnv *env, struct usb_bus *bus);
|
||||
extern struct usb_bus *unwrap_usb_bus(JNIEnv *env, jobject obj);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@ -15,9 +15,9 @@
|
||||
|
||||
#include <jni.h>
|
||||
#include <usb.h>
|
||||
#include "USBBus.h"
|
||||
#include "USBDeviceDescriptor.h"
|
||||
#include "USBConfigDescriptor.h"
|
||||
#include "USB_Bus.h"
|
||||
#include "USB_Device_Descriptor.h"
|
||||
#include "USB_Config_Descriptor.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
#include <jni.h>
|
||||
#include <usb.h>
|
||||
#include "USBBus.h"
|
||||
#include "USB_Bus.h"
|
||||
|
||||
|
||||
/**
|
||||
Loading…
Reference in New Issue
Block a user