Package org.usb4java

Examples of org.usb4java.DeviceDescriptor


    public void setUp()
    {
        if (isUsbTestsEnabled())
        {
            LibUsb.init(null);
            this.descriptor = new DeviceDescriptor();
        }
    }
View Full Code Here


        }
        try
        {
            for (final Device device : list)
            {
                final DeviceDescriptor descriptor = new DeviceDescriptor();
                if (LibUsb.getDeviceDescriptor(device, descriptor) != 0)
                {
                    continue;
                }
                this.vendorId = descriptor.idVendor();
                this.productId = descriptor.idProduct();
                final ConfigDescriptor config = new ConfigDescriptor();
                if (LibUsb.getActiveConfigDescriptor(device, config) < 0)
                {
                    return null;
                }
View Full Code Here

     */
    @Test(expected = IllegalArgumentException.class)
    public void testGetDeviceDescriptorWithoutDevice()
    {
        assumeUsbTestsEnabled();
        LibUsb.getDeviceDescriptor(null, new DeviceDescriptor());
    }
View Full Code Here

    @Test
    public void testGetDeviceDescriptor()
    {
        assumeUsbTestsEnabled();
        assumeNotNull(this.device);
        final DeviceDescriptor desc = new DeviceDescriptor();
        LibUsb.getDeviceDescriptor(this.device, desc);
        desc.bcdDevice();
        desc.bcdUSB();
        assertEquals(LibUsb.DT_DEVICE, desc.bDescriptorType());
        desc.bDeviceClass();
        desc.bDeviceProtocol();
        desc.bDeviceSubClass();
        assertTrue(desc.bLength() > 0);
        desc.bMaxPacketSize0();
        desc.bNumConfigurations();
    }
View Full Code Here

     */
    @Test(expected = IllegalStateException.class)
    public void testGetDeviceDescriptorWithUninitializedDevice()
    {
        assumeUsbTestsEnabled();
        LibUsb.getDeviceDescriptor(new Device(), new DeviceDescriptor());
    }
View Full Code Here

TOP

Related Classes of org.usb4java.DeviceDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.