Package javax.usb

Examples of javax.usb.UsbDevice


   * @author Jan Roberts
   *
   */
  private UsbDevice findDevice(UsbHub hub)
  {
    UsbDevice cm19a = null;

    Iterator iterator = hub.getUsbPorts().iterator();

    while (iterator.hasNext())
    {
      UsbPort port = (UsbPort) iterator.next();

      if (port.isUsbDeviceAttached())
      {
        UsbDevice device = port.getUsbDevice();

        /* Is this the device? If so, quit looking */
        if (device.isUsbHub())
        {
          cm19a = findDevice((UsbHub) device);

          if (isCM19ADevice(cm19a))
          {
View Full Code Here


    {
      throw new CM19AException("No virtual root usb hub found");
    }

    /* Find the attached CM19a */
    UsbDevice cm19a = findDevice(virtualRootUsbHub);

    if (cm19a == null)
    {
      throw new CM19AException("No CM19a found; /dev/bus/usb permissions problem?");
    }

    if (logger.isDebugEnabled())
    {
      StringBuilder builder = new StringBuilder("Device found and  configured is ");
      if (!cm19a.isConfigured())
      {
        builder.append("not");
      }
      builder.append(" configured");
      logger.debug(builder.toString());
    }

    UsbConfiguration config = cm19a.getActiveUsbConfiguration();
    if (config == null)
    {
      throw new CM19AException("No active configuration found");
    }

    /* Get the first interface, there should only be one */
    UsbInterface usbInterface = (UsbInterface) config.getUsbInterfaces().get(0);

    logger.debug("Got device; Manufacturer is " + cm19a.getManufacturerString());
    logger.debug("Got interface; Active is " + usbInterface.isActive() + " Claimed is " + usbInterface.isClaimed());

    try
    {
      usbInterface.claim();
View Full Code Here

TOP

Related Classes of javax.usb.UsbDevice

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.