title: Python-escpos how to find an specific printer with printer.Usb
body: <p>I am trying to print on a EPSON TM-20II printer, but I need to be able to print out from two different printers, same model. I can't filter the Usb search with bus or address values, it just prints on the same one. I can print perfectly though, so I have no issue with any library, maybe I am confused with the printer.Usb method from python-escpos library behaviour.</p>
  
  <p>I tried listing all of my printers, got the vendorId, the productId, the bus and address of every printer, but when I try to find my printer by all of those filters, it just prints on the same one that matches the vendorId and the productId, not using the address or the bus. I disconnected the printer that was being found, and it uses the second one just fine.</p>
  
  <p>First, this is the code to get all the printers:</p>
  
  <pre class="lang-py prettyprint-override"><code>
  def getAllPrinters():
      dev = usb.core.find(find_all=1)
      # loop through devices, printing vendor and product ids in decimal and hex
      for cfg in dev:
          sys.stdout.write('Hexadecimal VendorID=' + hex(cfg.idVendor) + ' &amp; ProductID=' + hex(cfg.idProduct) + '\n')
          sys.stdout.write("Address=" + str(cfg.address) + '\n')
          sys.stdout.write("Bus=" + str(cfg.bus) + '\n'+"\n")
  
  </code></pre>
  
  <p>With this code I got this output:</p>
  
  <pre><code>Hexadecimal VendorID=0x8086 &amp; ProductID=0xa12f
  Address=1
  Bus=1
  
  Hexadecimal VendorID=0x408 &amp; ProductID=0xa060
  Address=3
  Bus=1
  
  Hexadecimal VendorID=0x408 &amp; ProductID=0xa060
  Address=3
  Bus=1
  
  Hexadecimal VendorID=0x4ca &amp; ProductID=0x3016
  Address=2
  Bus=1
  
  Hexadecimal VendorID=0x4b8 &amp; ProductID=0xe15
  Address=16
  Bus=1
  
  Hexadecimal VendorID=0x4b8 &amp; ProductID=0xe15
  Address=17
  Bus=1
  </code></pre>
  
  <p>The ones with the VendorID= 0x4b8 and ProductID = 0xe15 are both of my EPSON TM-20II printers.</p>
  
  <p>This is what I am doing to print on a specific one, at least what I think it does:</p>
  
  <pre class="lang-py prettyprint-override"><code>def printInvoiceFooter():
      p = printer.Usb(0x04b8,0xe15, profile="TM-T88III",address=17,bus=1)
  
      p.set(align="center")
  
      prevConfig = open("invoiceConfig.txt","rb")
      config = pickle.load(prevConfig)
  
      footerText = config["footerText"]
      headerText = config["headerText"]
  
      p.text(headerText + "\n")
      p.text(footerText)
  
      p.cut()
  </code></pre>
  
  <p>And no matter if I place or not the address and bus tags on:</p>
  
  <pre class="lang-py prettyprint-override"><code>#This
  p = printer.Usb(0x04b8,0xe15, profile="TM-T88III",address=17,bus=1)
  #Does the same thing as this
  p = printer.Usb(0x04b8,0xe15, profile="TM-T88III")
  </code></pre>
  
  <p>It just prints on the same one.</p>
  
  <p>I expected that if I place the address and bus tags on printer.Usb() it would try to get the printer on that bus and address that matches that vendor, but it just gets the first one that matches the vendor and prints on that one.</p>