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 ] 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

> á á á á á á 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(Main á): End Collection, data=none

> á á á Endpoint Descriptor:

> á á á á bLength á á á á á á á á 7

> á á á á bDescriptorType á á á á 5

> á á á á bEndpointAddress á á 0x01 áEP 1 OUT

> á á á á bmAttributes á á á á á á3

> á á á á á Transfer Type á á á á á áInterrupt

> á á á á á Synch Type á á á á á á á None

> á á á á á Usage Type á á á á á á á Data

> á á á á wMaxPacketSize á á 0x0040 á1x 64 bytes

> á á á á bInterval á á á á á á á 1

> á á á Endpoint Descriptor:

> á á á á bLength á á á á á á á á 7

> á á á á bDescriptorType á á á á 5

> á á á á bEndpointAddress á á 0x82 áEP 2 IN

> á á á á bmAttributes á á á á á á3

> á á á á á Transfer Type á á á á á áInterrupt

> á á á á á Synch Type á á á á á á á None

> á á á á á Usage Type á á á á á á á Data

> á á á á wMaxPacketSize á á 0x0040 á1x 64 bytes

> á á á á bInterval á á á á á á á 1

> Device Status: á á 0x0001

> á Self Powered

>



To begin with, your former code can be summed up to this (with latest

git PyUSB):



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()



device.write(0x01, [0x01]) ---> you probably meant [0x01] or '\x01'

instead of '0x01'

print device.read(0x82, 64, 1000)



If you are still getting a read timeout, that is probably because the

0x01 command means nothing to the device.



--

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=124407151&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                        
                  
------------------------------------------------------------------------------
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

Reply via email to