title: Communicate with smartcard reader through Android USB host
body: <p>I'm trying to send a command to a smart card. I use a <a href="http://www.smartcardfocus.com/images/content/GEMTR.jpg" rel="noreferrer">Gemalto IDBridge CT30 (PC TWIN reader)</a> and a <a href="http://cartesapuce-discount.com/76-371-thickbox/lecteur-de-cartes-a-puce-usb-gempc-tr.jpg" rel="noreferrer">IDBridge K30</a> connected to the Android device over USB.</p>
  
  <p>I try to send a SELECT APDU command over USB:</p>
  
  <pre><code>boolean claim = openedConnection.claimInterface(usbInterface, true);
  byte[] data = new byte[]{
          (byte) 0x00, (byte) 0xA4, (byte) 0x04, (byte) 0x0C,
          (byte) 0x07, (byte) 0xA0, (byte) 0x00, (byte) 0x00,
          (byte) 0x01, (byte) 0x18, (byte) 0x45, (byte) 0x4E};
  </code></pre>
  
  <p>After that I receive an answer:</p>
  
  <pre><code>final int dataTransferred = this.openedConnection.bulkTransfer(endPointOut, data, data.length, TIMEOUT_MS);
  if(!(dataTransferred == 0 || dataTransferred == data.length)) {
      throw new Exception("Error durring sending command [" + dataTransferred + " ; " + data.length + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  }
  
  final byte[] responseBuffer = new byte[endPointIn.getMaxPacketSize()];
  final int dataTransferred = this.openedConnection.bulkTransfer(this.endPointIn, responseBuffer, responseBuffer.length, TIMEOUT_MS);
  Console.writeLine("USB Retrieve: " + dataTransferred + " " + responseBuffer.length);
  if(dataTransferred &gt;= 0){
      return responseBuffer;
  }
  throw new Exception("Error durring receinving response [" + dataTransferred + "]");
  </code></pre>
  
  <p>That answer is</p>
  
  <pre><code>0x00 0x00 0x00 0x00 0x00 0xA0 0x00 0x41 0x03 0x00
  </code></pre>
  
  <p>However, I should get an answer of <strong><code>0x90 0x00</code></strong> according to the <a href="http://labs.a-trust.at/developer/ShowSource.aspx?id=114" rel="noreferrer">test project here</a>.</p>
  
  <p>What am I doing wrong? Can anybody help me? Do I use the correct approach? I'm not using the default package classes of <code>javax.smartcardio</code>. I use the USB interface classes (e.g. <a href="https://developer.android.com/reference/android/hardware/usb/UsbDevice.html" rel="noreferrer">UsbDevice</a>) directly.</p>