Examples of Usb_Config_Descriptor


Examples of ch.ntb.inf.libusbJava.Usb_Config_Descriptor

        }
        bus = bus.getNext();
      }
      textArea.setText(sb.toString());
    } else if (component instanceof Usb_Config_Descriptor) {
      Usb_Config_Descriptor confDesc = (Usb_Config_Descriptor) component;
      StringBuffer sb = new StringBuffer("Usb_Config_Descriptor\n");
      sb.append("\tblenght: 0x"
          + Integer.toHexString(confDesc.getBLength()) + "\n");
      sb.append("\tbDescriptorType: 0x"
          + Integer.toHexString(confDesc.getBDescriptorType() & 0xFF)
          + "\n");
      sb.append("\tbNumInterfaces: 0x"
          + Integer.toHexString(confDesc.getBNumInterfaces() & 0xFF)
          + "\n");
      sb.append("\tbConfigurationValue: 0x"
          + Integer.toHexString(confDesc.getBConfigurationValue() & 0xFF)
          + "\n");
      sb.append("\tiConfiguration: 0x"
          + Integer.toHexString(confDesc.getIConfiguration() & 0xFF)
          + "\n");
      sb.append("\tbmAttributes: 0x"
          + Integer.toHexString(confDesc.getBmAttributes() & 0xFF)
          + "\n");
      sb.append("\tMaxPower [mA]: 0x"
          + Integer.toHexString(confDesc.getMaxPower() & 0xFF) + " ("
          + confDesc.getMaxPower() + ")\n");
      sb.append("\textralen: 0x"
          + Integer.toHexString(confDesc.getExtralen()) + "\n");
      sb.append("\textra: "
          + extraDescriptorToString(confDesc.getExtra()) + "\n");
      // get device handle to retrieve string descriptors
      Usb_Bus bus = rootBus;
      while (bus != null) {
        Usb_Device dev = bus.getDevices();
        while (dev != null) {
          Usb_Config_Descriptor[] tmpConfDesc = dev.getConfig();
          for (int i = 0; i < tmpConfDesc.length; i++) {
            if ((tmpConfDesc.equals(confDesc))
                && (confDesc.getIConfiguration() > 0)) {
              try {
                sb.append("\nString descriptors\n");
                long handle = LibusbJava1.libusb_open(dev);

                try {
                  String configuration = LibusbJava1
                      .libusb_get_string_descriptor_ascii(
                          handle,
                          confDesc.getIConfiguration(),
                          255);
                  if (configuration == null)
                    configuration = "unable to fetch configuration string";
                  sb.append("\tiConfiguration: "
                      + configuration + "\n");
View Full Code Here

Examples of ch.ntb.inf.libusbJava.Usb_Config_Descriptor

    dev.updateDescriptors();
    Usb_Device_Descriptor devDescriptor = dev.getDeviceDescriptor();
    assertNotNull(devDescriptor);
    assertEquals(devinfo.getIdProduct(), devDescriptor.getIdProduct());
    assertEquals(devinfo.getIdVendor(), devDescriptor.getIdVendor());
    Usb_Config_Descriptor confDescriptors[] = dev.getConfigDescriptors();
    assertNotNull(confDescriptors);
    assertTrue(confDescriptors[0].getInterface().length > 0);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.