Hello everyone,

I am a total newbie to pythonUSB.

I am using the PyUSB interface for one of the devices which has a FTDI chip.

I could read the device ID and get the serial number of it.

I need to read and write data to the device.

The example provided on the website is not sufficient to read or write data.

Could you provide some examples which i could try out so that i can talk
with the device?

I have refered the programmers guide for D2XX programming but it seems to be
written for C programming.
I tried to modify to suit to a python environment.

For eg,  in the code below:

# ----------
# import the PyUSB module
import d2xx
global EventDword,TxBytes,RxBytes,
BytesReceived
EventDword =TxBytes=RxBytes=BytesReceived=0
# list devices by description, returns tuple of attached devices description
strings
d = d2xx.listDevices(d2xx.OPEN_BY_DESCRIPTION)
print d

# list devices by serial, returns tuple of attached devices serial strings
d = d2xx.listDevices() # implicit d2xx.OPEN_BY_SERIAL_NUMBER
print d

h = d2xx.open(0)
print h

# get queue status
print h.getQueueStatus()

# set RX/TX timeouts
h.setTimeouts(1000,1000)

print h.read(5)


# ----------
The python interpreter exits once it reaches print h.read(5).

I need read data from the device and write to it as well.

The device is  data acquisition system which is connected to the PC via a
USB cable.

The output received for execution of the code till it reaches the Read is as
below:

>> ('USB Interface IF-U1',)
>>> ('EAT2QBD0',)
>>> <FtobjType object at 0x00A17300>
>>> 0
[Dbg]>>>

This tells me that i am connected to the device and get the object of it.
But i need to use it and read and write data from the device as well.

Any help in this regard is highly appreciated.


Regards
Karthik


On 22 December 2010 01:51, Andrew Errington <a.erring...@lancaster.ac.uk>wrote:

> On Wed, December 22, 2010 05:50, Tormod Volden wrote:
> > On Tue, Dec 21, 2010 at 1:36 PM, Andrew Errington wrote:
> >
> >> code and a compiled binary.  Unfortunately the binary was compiled for
> >> a different Product ID than the device I have.  Doubleplus unfortunately
> >> the source code for the .lib file which actually sends the data packets
> >> to the device is already compiled.  I have the header file, but not the
> >> source.
> >
> > If only the Product ID is wrong (but the code would otherwise work
> > with your device) I would have tried binary patching to change the ID. If
> > you know the ID it is built for and can do some disassembly, you might
> > have a chance to find the right bytes to patch.
>
> Yes, it's a good idea, thank you.  I did think about this already, but I
> can not be sure that the Product ID in the compiled code is the same as
> the sample source code.  Probably it is, but even so, it is a 16-bit
> value, and I don't know if it will be encoded as two bytes together.  If I
> cannot find a compiler then I will try to hack the binary.
>
> Best wishes,
>
> Andrew
>
>
>
> ------------------------------------------------------------------------------
> Forrester recently released a report on the Return on Investment (ROI) of
> Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
> within 7 months.  Over 3 million businesses have gone Google with Google
> Apps:
> an online email calendar, and document program that's accessible from your
> browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
> _______________________________________________
> pyusb-users mailing list
> pyusb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>



-- 
Thanks and Regards,

Karthikeyan.V
Transmission Controls HIL LAB
Tel: +44 (0)2476 206717
kvenk...@jaguarlandrover.com <g...@jaguarlandrover.com>

Land Rover, Banbury Road, Gaydon, Warwick, CV35 ORR, UK. Registered in
England and Wales Number: 4019301.
Jaguar Cars Limited, Abbey Road, Whitley, Coventry, CV3 4LF, UK. Registered
in England Number: 1672070.
------------------------------------------------------------------------------
Forrester recently released a report on the Return on Investment (ROI) of
Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
within 7 months.  Over 3 million businesses have gone Google with Google Apps:
an online email calendar, and document program that's accessible from your 
browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to