title: libusb_control_transfer() never returns
body: <p>I am communicating with a <a href="https://www.cypress.com/products/ez-usb-fx3-superspeed-usb-30-peripheral-controller" rel="nofollow noreferrer">Cypress FX3 kit</a> device.</p>
  
  <p>I send the information using:</p>
  
  <pre><code>unsigned int file_size;
  unsigned short wLength = 16;
  unsigned int timeout = 1000;
  unsigned short wValue = 0, wIndex = 1;
  
  /* Here I get my file_size value */
  file_size = 4000; // For the sake of the example.
  
  rStatus = libusb_control_transfer(
              device_handle,             /* a handle for the device to communicate with */
              WRITE_REQUEST_TYPE,        /* bmRequestType: the request type field for the setup packet */
              VND_CMD_SLAVESER_CFGLOAD,  /* bRequest: the request field for the setup packet */
              wValue,                    /* wValue: the value field for the setup packet */
              wIndex,                    /* wIndex: the index field for the setup packet */
              (unsigned char *) &amp;file_size,  /* *data: a suitably-sized data buffer */
              wLength,                   /* wLength: the length field for the setup packet. The data buffer should be at least this size. */
              timeout);                  /* timeout (in millseconds) that this function should wait before giving up due to no response being received. For an unlimited timeout, use value 0. */
  </code></pre>
  
  <p>Now my program is getting the correct information. I send UART messages to my computer and indeed the FX3 firmware is getting what it needs to get and get's on with what it need, however the cpp program <strong>never exits</strong> the <code>libusb_control_transfer</code> function.</p>
  
  <p>Shouldn't at least the timeout prevent this function from never returning? Or if it doesn't prevent it because it was able to send data... Is it waiting for an ACK that the FX3 firmware doesn't send? I have no idea how to debug this.</p>
  
  <p>In some occasions I also get <code>Process finished with exit code 139 (interrupted by signal 11: SIGSEGV).</code> Inside the <code>libusb_control_transfer</code> (I did a print to chek it was indeed inside there).</p>