2014-09-03 22:49 GMT-03:00 Setia Budi <boedy.b...@gmail.com>:
> Dear all,
> Currently I have been wrote a simple Python script (using PyUSB) to
> communicate with an RFID reader. It is working well so far.
> Recently I need to deal with control to RFID reader from a single computer.
> I am aware about this documentation page
> https://github.com/walac/pyusb/blob/master/docs/tutorial.rst which mention
> about dealing with multiple identical devices, however, I couldn't
> understand it.
> Is anyone can help me with some examples to deal with this situation? Real
> example would be very helpful for me :)
>

If you use usb.core.find(find_all=True, IdVendor=..., idProduct...)
you will get all devices connected with the idVendor and idProduct
supplied as an iterator. Each one is connected to a bus and has an
associated address (just a id number in the bus).

For example, if you have two devices connected and their idVendor and
idProduct are, respectively, 0x1 and 0x2:

devices = tuple(usb.core.find(find_all=True, idVendor=0x1, idProduct=0x2))

print devices[0].bus, devices[0].address
print devices[1].bus, devices[1].address

devices[0].set_configuration()
devices[1].set_configuration()

Did you get it?

-- 
Best Regards,
Wander Lairson Costa

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to