title: SetupComm, SetCommState, SetCommTimeouts fail with USB device
body: <p>i am opening a USB device:</p>
  <p><img src="https://i.stack.imgur.com/mNukr.png" alt="enter image description here" /></p>
  <p>for communication using <code>CreateFile</code>:</p>
  <pre><code>HANDLE hUsb = CreateFile(&quot;\\.\LCLD9&quot;,
        GENERIC_READ | GENERIC_WRITE, 
        0, 
        null, 
        OPEN_EXISTING, 
        FILE_FLAG_OVERLAPPED, 
        0);
  </code></pre>
  <p>The call succeeds (i.e. <strong>hUsb</strong> is not equal to <code>INVALID_HANDLE_VALUE</code>). But then it comes time to do what we do with every serial port:</p>
  <ul>
  <li><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa363439%28v=vs.85%29.aspx" rel="nofollow noreferrer"><strong>SetupComm</strong></a> (set receive and transit buffer sizes)</li>
  <li><a href="http://msdn.microsoft.com/en-us/library/aa363436%28VS.85%29.aspx" rel="nofollow noreferrer"><strong>SetCommState</strong></a> (set flow-control, baud rate, etc)</li>
  <li><a href="http://msdn.microsoft.com/en-us/library/aa363437%28v=vs.85%29.aspx" rel="nofollow noreferrer"><strong>SetCommTimeouts</strong></a> (set timeouts)</li>
  </ul>
  <p>Each of these calls returns a <strong>GetLastError()</strong> code of <strong><code>1</code></strong>. E.g.:</p>
  <pre><code>SetupComm(hUsb, 1024, 1024);
  </code></pre>
  <p>Why are operations to configure the serial device failing when using a &quot;USB&quot; serial device, but work when using a <em>&quot;virtual COM port&quot;</em>? Do USB devices not support such baud rates, buffers, flow control, and timeouts?</p>
  <p>If this is a limitation/feature of Universal Serial devices, how can i detect that a handle refers to a <em>&quot;Universal Serial Device&quot;</em>, rather than a <em>&quot;COMM Port&quot;</em>? For example, the user is the one who specifies which port to use:</p>
  <ul>
  <li>\.\COM5</li>
  <li>\.\LCLD9</li>
  </ul>
  <hr />
  <p>Other serial functions that fail when talking to Universal Serial Bus serial device:</p>
  <ul>
  <li><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa363258%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>GetCommModemStatus</code></a> (with error code 1)</li>
  <li><code>ReadFile</code> (with error code 6)</li>
  <li><code>PurgeComm</code> (with error code 6)</li>
  <li><code>WriteFile</code> (with error code 6)</li>
  </ul>
  <p>Which begs the larger question, how do you communicate with a USB device once it's been opened with <code>CreateFile</code>?</p>