Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
Some time ago I have problems with one device.I was reading 5 bytes and the device sends 6, and I was getting the time out. Try ever read 64 bytes (the max lenght of the endpoint).There are not problems read more that the device sends; but if you try read 16 andthe device sends 17 it gives a timeout. device.write(0x01, complete_command_packet)print device.read(0x82, 64, 0, 1000) Date: Thu, 13 Feb 2014 15:06:08 +1100 From: boedy.b...@gmail.com To: pyusb-users@lists.sourceforge.net Subject: Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab I missed one parameter: device.write(0x01, complete_command_packet)print device.read(0x82, 16, 0, 1000) Now I have the same error:áusb.core.USBError: [Errno 110] Operation timed out I need to re-read the command reference manual for the device. Kindest regards,Budi = áá á á á =Please consider the environmentá before printing this email On Thu, Feb 13, 2014 at 1:48 PM, Setia Budi boedy.b...@gmail.com wrote: I re-read the reference manual for the reader and I made few changes on the data which I need to send.At the moment I am quite sure about the format of the data which I need to send (header, device_id, command_id, parameters, crc16). This is the update for the code == HEADER = bytearray([0x4D, 0x54, 0x49, 0x43])DEVICE_ID = bytearray([0x00]) COMMAND_ID = bytearray([0x03]) # for retrieving the operation modePARAMETERS = bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) command_packet = HEADER + DEVICE_ID + COMMAND_ID + PARAMETERS checksum = crc16(command_packet) complete_command_packet = command_packet + bytearray([checksum 0xff, ((checksum 8) 0xFF)]) device.write(0x01, complete_command_packet) print device.read(0x82, 16, 1000) = I found an different error message when the device.read method is invoked. AttributeError: 'NoneType' object has no attribute 'bInterfaceNumber' Any idea about the error message? Kindest regards, Budi =áá á á á =Please consider the environmentá before printing this email On Wed, Feb 12, 2014 at 11:06 PM, Setia Budi boedy.b...@gmail.com wrote: Ok I will give a try tomorrow :)Thank you for the advice :)Budi = áá á á á =Please consider the environmentá before printing this email On Wed, Feb 12, 2014 at 9:52 PM, Wander Lairson Costa wander.lair...@gmail.com wrote: 2014-02-11 20:11 GMT-02:00 Setia Budi boedy.b...@gmail.com: This is the output for lsusb -v -d 24e9:0824 Bus 002 Device 007: ID 24e9:0824 Device Descriptor: á bLength á á á á á á á á18 á bDescriptorType á á á á 1 á bcdUSB á á á á á á á 1.10 á bDeviceClass á á á á á255 Vendor Specific Class á bDeviceSubClass á á á á 0 á bDeviceProtocol á á á 255 á bMaxPacketSize0 á á á á 8 á idVendor á á á á á 0x24e9 á idProduct á á á á á0x0824 á bcdDevice á á á á á á0.01 á iManufacturer á á á á á 1 MICROELECTRONICS TECHNOLOGY INC. á iProduct á á á á á á á á2 MTI UHF RFID PRODUCT á iSerial á á á á á á á á 3 1326U0002 á bNumConfigurations á á á1 á Configuration Descriptor: á á bLength á á á á á á á á 9 á á bDescriptorType á á á á 2 á á wTotalLength á á á á á 41 á á bNumInterfaces á á á á á1 á á bConfigurationValue á á 1 á á iConfiguration á á á á á0 á á bmAttributes á á á á 0xc0 á á á Self Powered á á MaxPower á á á á á á á500mA á á Interface Descriptor: á á á bLength á á á á á á á á 9 á á á bDescriptorType á á á á 4 á á á bInterfaceNumber á á á á0 á á á bAlternateSetting á á á 0 á á á bNumEndpoints á á á á á 2 á á á bInterfaceClass á á á á 3 Human Interface Device á á á bInterfaceSubClass á á á0 No Subclass á á á bInterfaceProtocol á á á0 None á á á iInterface á á á á á á á0 á á á á HID Device Descriptor: á á á á á bLength á á á á á á á á 9 á á á á á bDescriptorType á á á á33 á á á á á bcdHID á á á á á á á 1.11 á á á á á bCountryCode á á á á á á0 Not supported á á á á á bNumDescriptors á á á á 1 á á á á á bDescriptorType á á á á34 Report á á á á á wDescriptorLength á á á98 á á á á á Report Descriptor: (length is 98) á á á á á á Item(Global): Usage Page, data= [ 0x00 0xff ] 65280 á á á á á á á á á á á á á á (null) á á á á á á Item(Local ): Usage, data= [ 0x01 ] 1 á á á á á á á á á á á á á á (null) á á á á á á Item(Main á): Collection, data= [ 0x01 ] 1 á á á á á á á á á á á á á á Application á á á á á á Item(Global): Report ID, data= [ 0x43 ] 67 á á á á á á Item(Global): Report Count, data= [ 0x0f ] 15 á á á á á á Item(Global): Report Size, data= [ 0x08 ] 8 á á á á á á Item(Global): Logical Minimum, data= [ 0x00 ] 0 á á á á á á Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 á á á á á á Item(Local ): Usage, data= [ 0x01
Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
Ok I will give a try tomorrow :) Thank you for the advice :) 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 Wed, Feb 12, 2014 at 9:52 PM, Wander Lairson Costa wander.lair...@gmail.com wrote: 2014-02-11 20:11 GMT-02:00 Setia Budi boedy.b...@gmail.com: This is the output for lsusb -v -d 24e9:0824 Bus 002 Device 007: ID 24e9:0824 Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 0 bDeviceProtocol 255 bMaxPacketSize0 8 idVendor 0x24e9 idProduct 0x0824 bcdDevice0.01 iManufacturer 1 MICROELECTRONICS TECHNOLOGY INC. iProduct2 MTI UHF RFID PRODUCT iSerial 3 1326U0002 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 500mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType33 bcdHID 1.11 bCountryCode0 Not supported bNumDescriptors 1 bDescriptorType34 Report wDescriptorLength 98 Report Descriptor: (length is 98) Item(Global): Usage Page, data= [ 0x00 0xff ] 65280 (null) Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Global): Report ID, data= [ 0x43 ] 67 Item(Global): Report Count, data= [ 0x0f ] 15 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report ID, data= [ 0x52 ] 82 Item(Global): Report Count, data= [ 0x0f ] 15 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report ID, data= [ 0x42 ] 66 Item(Global): Report Count, data= [ 0x17 ] 23 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report ID, data= [ 0x41 ] 65 Item(Global): Report Count, data= [ 0x3f ] 63 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report ID, data= [ 0x49 ] 73 Item(Global): Report Count, data= [ 0x3f ] 63 Item(Global):
Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
I missed one parameter: device.write(0x01, complete_command_packet) print device.read(0x82, 16, 0, 1000) Now I have the same error: usb.core.USBError: [Errno 110] Operation timed out I need to re-read the command reference manual for the device. 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 Thu, Feb 13, 2014 at 1:48 PM, Setia Budi boedy.b...@gmail.com wrote: I re-read the reference manual for the reader and I made few changes on the data which I need to send. At the moment I am quite sure about the format of the data which I need to send (header, device_id, command_id, parameters, crc16). This is the update for the code == HEADER = bytearray([0x4D, 0x54, 0x49, 0x43]) DEVICE_ID = bytearray([0x00]) COMMAND_ID = bytearray([0x03]) # for retrieving the operation mode PARAMETERS = bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) command_packet = HEADER + DEVICE_ID + COMMAND_ID + PARAMETERS checksum = crc16(command_packet) complete_command_packet = command_packet + bytearray([checksum 0xff, ((checksum 8) 0xFF)]) device.write(0x01, complete_command_packet) print device.read(0x82, 16, 1000) = I found an different error message when the device.read method is invoked. AttributeError: 'NoneType' object has no attribute 'bInterfaceNumber' Any idea about the error message? 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 Wed, Feb 12, 2014 at 11:06 PM, Setia Budi boedy.b...@gmail.com wrote: Ok I will give a try tomorrow :) Thank you for the advice :) 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 Wed, Feb 12, 2014 at 9:52 PM, Wander Lairson Costa wander.lair...@gmail.com wrote: 2014-02-11 20:11 GMT-02:00 Setia Budi boedy.b...@gmail.com: This is the output for lsusb -v -d 24e9:0824 Bus 002 Device 007: ID 24e9:0824 Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 0 bDeviceProtocol 255 bMaxPacketSize0 8 idVendor 0x24e9 idProduct 0x0824 bcdDevice0.01 iManufacturer 1 MICROELECTRONICS TECHNOLOGY INC. iProduct2 MTI UHF RFID PRODUCT iSerial 3 1326U0002 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 500mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType33 bcdHID 1.11 bCountryCode0 Not supported bNumDescriptors 1 bDescriptorType34 Report wDescriptorLength 98 Report Descriptor: (length is 98) Item(Global): Usage Page, data= [ 0x00 0xff ] 65280 (null) Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Global): Report ID, data= [ 0x43 ] 67 Item(Global): Report Count, data= [ 0x0f ] 15 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Output, data= [ 0x02 ] 2
Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
2014-02-11 3:56 GMT-02:00 Setia Budi boedy.b...@gmail.com: 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? Does this happen on write or read operation? -- Best Regards, Wander Lairson Costa -- 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=124407151iu=/4140/ostg.clktrk ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
it happens on read operation. 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 Tue, Feb 11, 2014 at 10:06 PM, Wander Lairson Costa wander.lair...@gmail.com wrote: 2014-02-11 3:56 GMT-02:00 Setia Budi boedy.b...@gmail.com: 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? Does this happen on write or read operation? -- Best Regards, Wander Lairson Costa -- 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=124407151iu=/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=124407151iu=/4140/ostg.clktrk___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
2014-02-11 9:09 GMT-02:00 Setia Budi boedy.b...@gmail.com: it happens on read operation. Could you please post the output of the following command? lsusb -v -d 24e9:0824 On Tue, Feb 11, 2014 at 10:06 PM, Wander Lairson Costa wander.lair...@gmail.com wrote: 2014-02-11 3:56 GMT-02:00 Setia Budi boedy.b...@gmail.com: 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? Does this happen on write or read operation? -- Best Regards, Wander Lairson Costa -- 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=124407151iu=/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=124407151iu=/4140/ostg.clktrk ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users -- Best Regards, Wander Lairson Costa -- 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=124407151iu=/4140/ostg.clktrk ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
There is one thing which I am not quite sure whether it is right or wrong. This is my understanding, there are two types of endpoint, endpoint out and endpoint in. Every time we want to send a command to the device, we sent the command through endpoint out, on the other hand, if we want to read data from the device, we read it from endpoint in. is that correct? 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 Tue, Feb 11, 2014 at 10:15 PM, Setia Budi boedy.b...@gmail.com wrote: I left the RFID reader at my office. Tomorrow morning I will send the lsusb output. It's 10:14 pm in Tasmania :) 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 Tue, Feb 11, 2014 at 10:11 PM, Wander Lairson Costa wander.lair...@gmail.com wrote: 2014-02-11 9:09 GMT-02:00 Setia Budi boedy.b...@gmail.com: it happens on read operation. Could you please post the output of the following command? lsusb -v -d 24e9:0824 On Tue, Feb 11, 2014 at 10:06 PM, Wander Lairson Costa wander.lair...@gmail.com wrote: 2014-02-11 3:56 GMT-02:00 Setia Budi boedy.b...@gmail.com: 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? Does this happen on write or read operation? -- Best Regards, Wander Lairson Costa -- 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=124407151iu=/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=124407151iu=/4140/ostg.clktrk ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net
Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
2014-02-11 9:18 GMT-02:00 Setia Budi boedy.b...@gmail.com: There is one thing which I am not quite sure whether it is right or wrong. This is my understanding, there are two types of endpoint, endpoint out and endpoint in. Every time we want to send a command to the device, we sent the command through endpoint out, on the other hand, if we want to read data from the device, we read it from endpoint in. is that correct? Actually your device can have more than one read and/or write endpoint. Your device can even be more than one logical device, it is called a composite device, with each logical device having its own set of endpoints. -- Best Regards, Wander Lairson Costa -- 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=124407151iu=/4140/ostg.clktrk ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
This is the output for lsusb -v -d 24e9:0824 Bus 002 Device 007: ID 24e9:0824 Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 0 bDeviceProtocol 255 bMaxPacketSize0 8 idVendor 0x24e9 idProduct 0x0824 bcdDevice0.01 iManufacturer 1 MICROELECTRONICS TECHNOLOGY INC. iProduct2 MTI UHF RFID PRODUCT iSerial 3 1326U0002 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 41 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 500mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 0 None iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType33 bcdHID 1.11 bCountryCode0 Not supported bNumDescriptors 1 bDescriptorType34 Report wDescriptorLength 98 Report Descriptor: (length is 98) Item(Global): Usage Page, data= [ 0x00 0xff ] 65280 (null) Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Global): Report ID, data= [ 0x43 ] 67 Item(Global): Report Count, data= [ 0x0f ] 15 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Output, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report ID, data= [ 0x52 ] 82 Item(Global): Report Count, data= [ 0x0f ] 15 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report ID, data= [ 0x42 ] 66 Item(Global): Report Count, data= [ 0x17 ] 23 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report ID, data= [ 0x41 ] 65 Item(Global): Report Count, data= [ 0x3f ] 63 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report ID, data= [ 0x49 ] 73 Item(Global): Report Count, data= [ 0x3f ] 63 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Local ): Usage, data= [ 0x01 ] 1 (null) Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report ID, data= [ 0x45 ] 69 Item(Global): Report Count, data= [ 0x17 ] 23 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0
Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
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=121051231iu=/4140/ostg.clktrk ___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
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=121051231iu=/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=121051231iu=/4140/ostg.clktrk___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users
Re: [pyusb-users] Reading RFID tag using MTI RU-824 via pylab
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=121051231iu=/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=121051231iu=/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=121051231iu=/4140/ostg.clktrk___ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users