Dear all,
I have further question regarding the use of multiple identical usb reader.
For example I have two physical USB port on my computer, let's call them
usb1 and usb2.
Then I attach two identical usb device to them. Let's call them device1 and
device2.
Then I write this Python script
devices = tuple(usb.core.find(find_all=True, idVendor=0x1, idProduct=0x2))
My question is, how to make sure that devices[0] is always refer to the usb
device which is connected to usb1 and device[1] is always refer to the usb
device attach to usb2.
I found that there is no consistency every time I call this function:
usb.core.find(find_all=True, idVendor=0x1, idProduct=0x2)
Anyone could assist me? Thank you :)
Kind regards,
Budi
On Fri, Sep 5, 2014 at 4:29 PM, Setia Budi <boedy.b...@gmail.com> wrote:
> It works :)
> Thank you for the clue. I do appreciate it :)
>
> Kind regards,
> Budi
>
>
> On Thu, Sep 4, 2014 at 8:40 PM, Wander Lairson Costa <
> wander.lair...@gmail.com> wrote:
>
>> 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
>>
>
>
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users