Thank you for the pointers, Manu & Wander!

Now I have a better understanding. However, this simple control message code
is throwing up the error,

ctypes.ArgumentError: argument 3: <type 'exceptions.TypeError'>: wrong type

Tried all tricks, still am I missing something? Any help appreciated

Best Regards,
Sridev

-------Code -------------
import usb

buses = usb.busses()

for bus in buses:
   for device in bus.devices:
       if device.idVendor == 0x10C4 and device.idProduct == 0x81f2:
           reader = device

readerHandler = reader.open()

readerHandler.setConfiguration(1)
readerHandler.claimInterface(0)

#get reader info command - first command as per vendor docs - hex string
msg_str = "020200013803"

data = 64
results = readerHandler.controlMsg(64, msg_str, data, timeout=1000)
print results

reader.releaseInterface()

reader.close()
--------Code-----------

-----------Error
Traceback (most recent call last):
  File "simplectrlmsg.py", line 44, in <module>
    results = readerHandler.controlMsg(64, msg_str, data, timeout=1000)
  File "C:\Python26\lib\site-packages\usb\legacy.py", line 203, in
controlMsg
    timeout = timeout
  File "C:\Python26\lib\site-packages\usb\core.py", line 668, in
ctrl_transfer
    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 488, in
ctrl_transfer
    timeout
ctypes.ArgumentError: argument 3: <type 'exceptions.TypeError'>: wrong type
------------Error------------------------

On Tue, Jan 4, 2011 at 12:00 AM, Emmanuel Blot <eblot...@gmail.com> wrote:

> > Any help/insight?
>
> Just a thought:
> Are you sure the USB device does not expect some configuration (using
> control request, such as parity, baudrate, ...) prior to sending the
> actual data to the serial output ?
>
> That might explain why it works when the demo code opens the port (it
> may explicitly configure the USB device).
>
> You might want to spy on the USB communication link to observe the
> actual packets (on Windows, HHD USB tools are great to do so, and I
> think there is a demo version of this [cheap] software application)
> sent with the demo application.
>
> You may also want to have a look at the Linux kernel driver (for
> example, http://lxr.free-electrons.com/source/drivers/usb/serial/cp210x.c)
> to help understanding how the CP210 USB device works.
>
> Cheers,
> Manu
>
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
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