title: Unable to read information from USB with PyUSB in Windows 10. (Connects ok)
body: <p>I am running Python 3 with Anaconda in a Windows 10 machine.</p>
  
  <p>I am trying to connect to a usb barcode scanner in order to read barcodes and store them in variables in other python routine. I have found an example using PyUSB library and tried it. After a few modifications I was able to run it without raising errors. The program connects to the usb with the following code:</p>
  
  <pre><code>import usb.core
  import usb.util
  
  def main():
      # Find usb device
      dev = usb.core.find(idVendor=0x05E0, idProduct=0x1200)
  
      # Raise error if device not found
      if dev is None:
          raise ValueError('Device not found')
  
      else:
          # Set configuration of device
          dev.set_configuration()
  
          endpoint = dev[0][(0,0)][0]
  
          data = None
  
          while True:
              try:
                  dev.read(endpoint.bEndpointAddress, endpoint.wMaxPacketSize, timeout=1) 
                  print(data)
  
              except usb.core.USBError as e:
                  data = None
                  if e.args == ('Operation timed out',):
                      print("ERROR")
                      continue
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>As I say the program runs correctly and finds the usb. Nonetheless, <strong>data (barcode number) is never printed because the program seems to get stuck at following line</strong>:</p>
  
  <pre><code>dev.read(endpoint.bEndpointAddress, endpoint.wMaxPacketSize, timeout=1) 
  </code></pre>
  
  <p>Can you help me?</p>
  
  <p>Thank you very much in advance!</p>