title: Smart Card Reader T0 T1 communication on APDU level
body: <p>I am struggle to understand what protocol I have to use to communicate with the card T0 or T1? So, correct me if I am wrong, but the reader actually decides by itself what protocol to use to communicate with the card if the card supports both. </p>
  
  <p><em>So my logic right now is:</em></p>
  
  <pre><code>// if ATR(T1) -&gt; set_params(T1 structure) -&gt; T1 APDU communication
  // if ATR(T0) -&gt; set_params(T0 structure) -&gt; T0 APDU communication
  </code></pre>
  
  <p>But it turned out that the logic is wrong and it accidentally worked for majority of readers. I have just discovered the reader that expects T0 communication even if the card ATR returns T1.</p>
  
  <p><strong>Q:</strong> What is the logic must be to determine what protocol to use? And if there is a spec behind it, can you please point me out to it.</p>
  
  <p><em>Edited: I forgot to mention that my code is at pre-boot environment (UEFI) before the OS. So I don't have (use) any APIs whatsoever. My code is at byte-stream APDU level and talks directly to hardware using UEFI UsbIo communication.</em></p>
  
  <p>Thanks to all!</p>
  
  <p>All the best,</p>
  
  <p>Alex</p>