Finding the details of the single USB device plugged using java
<p>pardon my english as english is not my main language.</p>

<p>I am currently a student - to be frank and i am trying to work on my project .</p>

<p>Languages used is JAVA and IDE is eclipse. </p>

<p>Currently i used LIBUSB for my project which i downloaded from <a href="http://usb4java.org/" rel="nofollow noreferrer">http://usb4java.org/</a> . it is pretty helpful and i managed to get a list of details of my devices.
<strong>So my problem is... let say i just want to identified for example device 004.
Is there any suggestion on this. ?</strong> i tried with scanning it two time and compare the output but failed due to the datatype given is not match. At first i thought that the datatype could be arraylist but is not. Is there another way to store the output to text file so i can do comparison? </p>

<p>my codes which i took from the libusb example online. </p>

<pre><code>public class UsbBench {
/**
 * Main method.
 * 
 * @param args
 *            Command-line arguments (Ignored)
 * @throws IOException 
 */
public static void main(String[] args) throws IOException 
{
    // Create the libusb context
    Context context = new Context();

    // Initialize the libusb context
    int result = LibUsb.init(context);
    if (result &lt; 0)
    {
        throw new LibUsbException("Unable to initialize libusb", result);
    }

    // Read the USB device list
    DeviceList list = new DeviceList();

    result = LibUsb.getDeviceList(context, list);
    if (result &lt; 0)
    {
        throw new LibUsbException("Unable to get device list", result);
    }

    try
    {
        // Iterate over all devices and list them
        for (Device device: list)
        {
            int address = LibUsb.getDeviceAddress(device);
            int busNumber = LibUsb.getBusNumber(device);
            DeviceDescriptor descriptor = new DeviceDescriptor();
            result = LibUsb.getDeviceDescriptor(device, descriptor);
            if (result &lt; 0)
            {
                throw new LibUsbException(
                    "Unable to read device descriptor", result);
            }

        }

    }
    finally
    {
        // Ensure the allocated device list is freed
        LibUsb.freeDeviceList(list, true);
    }



    // Deinitialize the libusb context
    LibUsb.exit(context);
}
</code></pre>

<p>}</p>

<p>And it is working good also. OUTPUT:</p>

<pre><code>Bus 002, Device 003: Vendor 1bcf, Product 2c6e
Bus 001, Device 002: Vendor 06cb, Product 2970
Bus 001, Device 003: Vendor 0461, Product 4ded
Bus 001, Device 001: Vendor 8086, Product 8c31
Bus 002, Device 001: Vendor 8086, Product 8c26
Bus 002, Device 004: Vendor 04ca, Product 300b
Bus 002, Device 005: Vendor 8087, Product 8000
</code></pre>

<p><strong>So my problem is... let say i just want to identified for example device 004.
Is there any suggestion on this. ?</strong> this is also my first time in stackoverflow. i humblely seek your expertise. thanks. thanks.</p>