Hi fellows,
I will try to give further information related to my problem.
I am facing difficulties in order to send USB commands to an RFID reader.
This is the command reference of the device:
https://github.com/mti-rfid/RFID_Explorer
I am working with the MTI RU-824 model.
The manufacturer of the device only provide a driver for Windows (using
.Net), but we need to run the device on Linux. That's why I need to write
few lines of code in Python as a new "driver".
I am using PyUSB for accessing the device, and this is few lines of my code:
============================================================================
import usb.core
import usb.util
import sys
VENDOR_ID = 0x24e9
PRODUCT_ID = 0x0824
device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
if device is None:
sys.exit("Could not find Id System Barcode Reader.")
else:
print 'Device detected'
device.set_configuration()
cfg = device.get_active_configuration()
interface_number = cfg[(0, 0)].bInterfaceNumber
alternate_setting = usb.control.get_interface(device, interface_number)
usb_interface = usb.util.find_descriptor(
cfg, bInterfaceNumber=interface_number,
bAlternateSetting=alternate_setting
)
endpoint_out = usb.util.find_descriptor(
usb_interface,
# match the first OUT endpoint
custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress)
== usb.util.ENDPOINT_OUT
)
endpoint_in = usb.util.find_descriptor(
usb_interface,
# match the first IN endpoint
custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress)
== usb.util.ENDPOINT_IN
)
endpoint_out.write('0x01')
print endpoint_in.read(len('0x01'), 1000)
=============================================================================
My question is on the last 2 lines.
I am using endpoint_out to send a command and endpoint_in to read data from
the reader. Am I correct?
The problem is, when I run the code, there is an error message like this:
usb.core.USBError: [Errno 110] Operation timed out
Anyone can give a clue?
Thank you.
Budi
=========================
<boedy.b...@gmail.com> <http://goo.gl/T5NDnD> <http://goo.gl/4xmCrj>
<http://goo.gl/f2Dj7Q> <http://goo.gl/TlJuEd>
<http://goo.gl/d6J1aE> <http://goo.gl/8ezaYx>
=========================
*Please consider the environment *
*before printing this email*
On Sun, Feb 9, 2014 at 1:08 PM, Setia Budi <boedy.b...@gmail.com> wrote:
> Thanks for the USB reading reference, I will read it in order to get some
> basic understanding about USB.
> But if there is anyone who had an experience working with pyusb and and
> kind of RFID reader, I would be grateful to have some advices.
>
> Kindest regards,
>
> Budi
>
> =========================
> <boedy.b...@gmail.com> <http://goo.gl/T5NDnD> <http://goo.gl/4xmCrj>
> <http://goo.gl/f2Dj7Q> <http://goo.gl/TlJuEd>
>
> <http://goo.gl/d6J1aE> <http://goo.gl/8ezaYx>
> =========================
> *Please consider the environment *
> *before printing this email*
>
>
> On Sun, Feb 9, 2014 at 2:01 AM, Ian Daniher <it.dani...@gmail.com> wrote:
>
>> I'm personally a fan of USB in a Nutshell /
>> http://www.beyondlogic.org/usbnutshell/usb1.shtml.
>>
>> If you have the source to the .NET library, you ought to be able to
>> figure out out the supported requests. Have you emailed them for more /
>> better documentation?
>>
>>
>> On Sat, Feb 8, 2014 at 6:11 AM, Wander Lairson Costa <
>> wander.lair...@gmail.com> wrote:
>>
>>> 2014-02-08 5:30 GMT-02:00 Setia Budi <boedy.b...@gmail.com>:
>>> >
>>> > Anyone has an experience to read RFID tags using MTI RU-824 RFID
>>> reader in Python (using pylab)?
>>> > To be honest, I have zero experience with accessing USB devices or any
>>> hardware without and driver. I can easily read the tags using this reader
>>> in C# since the manufacturer provide a library which is only suitable for
>>> .Net.
>>> > However, I need to make the device to be able to operate under linux
>>> and python is the best option for me to start. I have read a bit about
>>> pylab from here: http://pyusb.sourceforge.net/docs/1.0/tutorial.html
>>> >
>>> > My specific question is how to instruct the reader to start reading
>>> and how to get the data from the reader?
>>> >
>>> > At the moment I already have EP (I assume EP stands for EndPoint).
>>> What can I do with this EP?
>>> >
>>> > I know, this can be a silly question, but I am totally new in USB
>>> world.
>>> >
>>>
>>> The best start it to read a basic USB tutorial, so you can learn about
>>> descriptors and transfer types, once you understand the basics of USB,
>>> the PyUSB tutorial will make a lot more sense for you.
>>>
>>>
>>> --
>>> Best Regards,
>>> Wander Lairson Costa
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Managing the Performance of Cloud-Based Applications
>>> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
>>> Read the Whitepaper.
>>>
>>> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> pyusb-users mailing list
>>> pyusb-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Managing the Performance of Cloud-Based Applications
>> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
>> Read the Whitepaper.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
>> _______________________________________________
>> pyusb-users mailing list
>> pyusb-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>>
>>
>
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience. Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users