Package ch.ntb.usb

Class Usb_Device_Descriptor

java.lang.Object
ch.ntb.usb.Usb_Descriptor
ch.ntb.usb.Usb_Device_Descriptor

public class Usb_Device_Descriptor extends Usb_Descriptor
Represents the descriptor of a USB device.
A USB device can only have one device descriptor. It specifies some basic, yet important information about the device.

The length of the device descriptor is Usb_Descriptor.USB_DT_DEVICE_SIZE and the type is Usb_Descriptor.USB_DT_DEVICE.
  • Field Details

    • USB_CLASS_PER_INTERFACE

      public static final int USB_CLASS_PER_INTERFACE
      Device and/or interface class codes.
      See Also:
    • USB_CLASS_AUDIO

      public static final int USB_CLASS_AUDIO
      Device and/or interface class codes.
      See Also:
    • USB_CLASS_COMM

      public static final int USB_CLASS_COMM
      Device and/or interface class codes.
      See Also:
    • USB_CLASS_HID

      public static final int USB_CLASS_HID
      Device and/or interface class codes.
      See Also:
    • USB_CLASS_PRINTER

      public static final int USB_CLASS_PRINTER
      Device and/or interface class codes.
      See Also:
    • USB_CLASS_MASS_STORAGE

      public static final int USB_CLASS_MASS_STORAGE
      Device and/or interface class codes.
      See Also:
    • USB_CLASS_HUB

      public static final int USB_CLASS_HUB
      Device and/or interface class codes.
      See Also:
    • USB_CLASS_DATA

      public static final int USB_CLASS_DATA
      Device and/or interface class codes.
      See Also:
    • USB_CLASS_VENDOR_SPEC

      public static final int USB_CLASS_VENDOR_SPEC
      Device and/or interface class codes.
      See Also:
  • Constructor Details

    • Usb_Device_Descriptor

      public Usb_Device_Descriptor()
  • Method Details

    • getBcdDevice

      public short getBcdDevice()
      Returns the device release number.
      Assigned by the manufacturer of the device.
      Returns:
      the device release number
    • getBcdUSB

      public short getBcdUSB()
      Returns the USB specification number to which the device complies to.
      This field reports the highest version of USB the device supports. The value is in binary coded decimal with a format of 0xJJMN where JJ is the major version number, M is the minor version number and N is the sub minor version number.
      Examples: USB 2.0 is reported as 0x0200, USB 1.1 as 0x0110 and USB 1.0 as 0x100
      Returns:
      the USB specification number to which the device complies to
    • getBDeviceClass

      public byte getBDeviceClass()
      Returns the class code (Assigned by www.usb.org)
      If equal to zero, each interface specifies it's own class code. If equal to 0xFF, the class code is vendor specified. Otherwise the field is a valid class code.
      Returns:
      the class code
    • getBDeviceProtocol

      public byte getBDeviceProtocol()
      Returns the protocol code (Assigned by www.usb.org)
      Returns:
      the protocol code
    • getBDeviceSubClass

      public byte getBDeviceSubClass()
      Returns the subclass code (Assigned by www.usb.org)
      Returns:
      the subclass code
    • getBMaxPacketSize0

      public byte getBMaxPacketSize0()
      Returns the maximum packet size for endpoint zero.
      Valid sizes are 8, 16, 32, 64.
      Returns:
      the maximum packet size for endpoint zero
    • getBNumConfigurations

      public byte getBNumConfigurations()
      Returns the number of possible configurations supported at its current speed.
      Returns:
      the number of possible configurations supported at its current speed
    • getIdProduct

      public short getIdProduct()
      Returns the product ID (Assigned by www.usb.org)
      Returns:
      the product ID
    • getIdVendor

      public short getIdVendor()
      Returns the Vendor ID (Assigned by www.usb.org)
      Returns:
      the Vendor ID
    • getIManufacturer

      public byte getIManufacturer()
      Returns the index of the manufacturer string descriptor.
      If this value is 0, no string descriptor is used.
      Returns:
      the index of the manufacturer string descriptor
    • getIProduct

      public byte getIProduct()
      Returns the index of the product string descriptor.
      If this value is 0, no string descriptor is used.
      Returns:
      the index of the product string descriptor
    • getISerialNumber

      public byte getISerialNumber()
      Returns the index of serial number string descriptor.
      If this value is 0, no string descriptor is used.
      Returns:
      the index of serial number string descriptor
    • toString

      public String toString()
      Overrides:
      toString in class Object