usb4java-javax icon indicating copy to clipboard operation
usb4java-javax copied to clipboard

UsbDeviceDescriptor.bDeviceClass() method not working on Linux

Open philipp-michelfeit opened this issue 1 year ago • 0 comments

UsbDeviceDescriptor.bDeviceClass() method not working !

Example code:

private String dumpName(final UsbDevice device)
            throws UnsupportedEncodingException, UsbException {
        // Read the string descriptor indices from the device descriptor.
        // If they are missing then ignore the device.
        final UsbDeviceDescriptor desc = device.getUsbDeviceDescriptor();
        final byte iManufacturer = desc.iManufacturer();
        final byte iProduct = desc.iProduct();
        final byte deviceClass = desc.bDeviceClass();
        
        if (iProduct == 0 && iManufacturer == 0) {
            return null;
        }

        // Dump the device name
        return device.getString(iManufacturer) + " " + device.getString(iProduct) + " (" + device.getString(deviceClass) + ")";
    }

philipp-michelfeit avatar Nov 30 '24 21:11 philipp-michelfeit