Beispiel #1
0
  /**
   * Initializes the socket using a bulk-only device.
   *
   * @exception IOException if the interface is already claimed by another driver module; or if the
   *     configuration, interface, or endpoints can't be accessed; and for other reasons.
   * @exception IllegalArgumentException if the interface doesn't have exactly two endpoints, for
   *     bulk input and bulk output.
   */
  public USBSocket(Device dev) throws IOException {
    DeviceDescriptor info = dev.getDeviceDescriptor();

    if (info.getNumConfigurations() != 1 || dev.getConfiguration().getNumInterfaces() != 1
    // or that interface has alternates
    ) throw new IllegalArgumentException();
    init(dev.getConfiguration().getInterface(0, 0));
  }
Beispiel #2
0
 /**
  * Initializes the socket using a bulk-only interface on a device which may have additional
  * interfaces.
  *
  * @exception IOException if the interface is already claimed by another driver module, or if the
  *     endpoints can't be accessed.
  * @exception IllegalArgumentException if the interface doesn't have exactly two endpoints, for
  *     bulk input and bulk output.
  */
 public USBSocket(Interface intf) throws IOException {
   init(intf);
 }