Tried to read 1024 byes, however, still the timeout error.
-------------------------------
Traceback (most recent call last):
  File "code.py", line 15, in <module>
    received = dev.read(0x81, 1024, 0, 5000)
  File "C:\Python26\lib\site-packages\usb\core.py", line 624, in read
    self.__get_timeout(timeout)
  File "C:\Python26\lib\site-packages\usb\_debug.py", line 53, in do_trace
    return f(*args, **named_args)
  File "C:\Python26\lib\site-packages\usb\backend\libusb01.py", line
448, in bulk_read
    timeout)
  File "C:\Python26\lib\site-packages\usb\backend\libusb01.py", line
531, in __read
    timeout
  File "C:\Python26\lib\site-packages\usb\backend\libusb01.py", line
364, in _check
    raise USBError(errmsg)
usb.core.USBError: libusb0-dll:err [_usb_reap_async] timeout error
 ---------------------------------------------------------------

Could it be related to com port opening or baudrate?

I notice that this code stops timing out the moment manufacturer's
demo application opens the com port explicitly. Also, if I set a
baudrate higher than 9600 to the reader, I start receiving the
complete data.

Any help/insight?

Sridev

On Mon, Jan 3, 2011 at 4:36 PM, wander.lairson <wander.lair...@gmail.com> wrote:
> 2011/1/1 Sridev Nair <sksridevn...@gmail.com>:
>> Hi,
>>
>> I have been working with pyUSB (Python 2.6) for last couple of days on
>> Windows. It works great and I could access the auto-id reader within
>> no time.  However, there is this read command timing out issue which I
>> am unable to resolve. In fact it is a bit weird since it seem to work
>> when I parallely run the demo application of the same reader provided
>> by the manufacturer.  The device driver spec, code & error output are
>> below.
>>
>> Any help in solving the problem?
>>
>> Sridev
>>
>> ---------------------------device specs-----------------------
>>
>> Device:
>>  Device class: 0
>>  Device sub class: 0
>>  Device protocol: 0
>>  Max packet size: 64
>>  idVendor: 4292
>>  idProduct: 33266
>>  Device Version: 256
>>  Configuration: 1
>>    Total length: 32
>>    selfPowered: 0
>>    remoteWakeup: 0
>>    maxPower: 200
>>    Interface: 0
>>    Alternate Setting: 0
>>      Interface class: 255
>>      Interface sub class: 0
>>      Interface protocol: 0
>>      Endpoint: 0x81
>>        Type: 2
>>        Max packet size: 64
>>        Interval: 0
>>      Endpoint: 0x1
>>        Type: 2
>>        Max packet size: 64
>>        Interval: 0
>>
>> ----------------------------code--------------------------------
>> import usb.core
>> import usb.util
>>
>> dev = usb.core.find(idVendor=0x10c4, idProduct=0x81f2)
>>
>> if dev is None:
>>    raise ValueError('No Device')
>>
>> dev.set_configuration()
>>
>> msg = [0x03, 0x02, 0x00, 0x03, 0x07, 0xD0, 0x03]
>>
>> bytes = dev.write(0x01, msg, 0, 2000)
>>
>> received = dev.read(0x81, bytes, 0, 5000)
>>
> Try to read about 1024 bytes, instead of the same data read. If there
> is more data in the device buffer than you ask for, this may happen.
>
> --
> Best Regards,
> Wander Lairson Costa
> LCoN - Laboratório de Computação Natural - Natural Computing Laboratory
> (http://www.mackenzie.com.br/lcon.html)
> Programa de Pós-Graduação em Engenharia Elétrica (PPGEE)
> Faculdade de Computação e Informática (FCI)
> Universidade Presbiteriana Mackenzie - SP - Brazil
>
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment, and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> pyusb-users mailing list
> pyusb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to