<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-flowed"
 style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">Dear
List,<br>
<br>
This one is way beyond my comprehension skills, I just don't understand
what I'm doing wrong.<br>
<br>
I am trying to read the chipid from an FTDI chip based USB key (DLP-D, 
<a class="moz-txt-link-freetext"
 href="http://www.ftdichip.com/Products/EvaluationKits/DLP-D.htm">http://www.ftdichip.com/Products/EvaluationKits/DLP-D.htm</a>
), using:<br>
<br>
- the ftd2xx module <a href="http://pypi.python.org/pypi/ftd2xx/0.1">http://pypi.python.org/pypi/ftd2xx/0.1</a><br>
- the ftd2xx.dll which comes with the driver install<br>
- the chipid dll (1.1.0) from here: <a class="moz-txt-link-freetext"
 href="http://www.ftdichip.com/Projects/FTDIChip-ID.htm">http://www.ftdichip.com/Projects/FTDIChip-ID.htm</a>
<br>
- a ctypes interface I wrote by hand (only 7 functions to wrap, I
thought it'd be easy!)<br>
<br>
The ftd2xx is used for testing, to open / close the device.<br>
<br>
My Problem is that neither of the following two wrapped functions (with
the exact same arguments) return the right result (full chipid.py
library attached):<br>
<br>
   def FTID_GetDeviceLocationID(DeviceIndex):
<br>
       n = DWORD()
<br>
       status = ftchipid.FTID_GetDeviceLocationID(DeviceIndex,
ctypes.byref(n))
<br>
<br>
       if status != FTID_SUCCESS:
<br>
           raise DeviceError,FTID_GetErrorCodeString("EN",status)
<br>
<br>
       return n.value
<br>
<br>
   def FTID_GetDeviceChipID(DeviceIndex):
<br>
       n = DWORD()
<br>
       status = ftchipid.FTID_GetDeviceChipID(DeviceIndex,
ctypes.byref(n))
<br>
<br>
       if status != FTID_SUCCESS:
<br>
           raise DeviceError,FTID_GetErrorCodeString("EN",status)
<br>
<br>
       return n.value
<br>
<br>
* On my machine (XP, 32 bits), if I plug two keys in, I can get the
device chip id from the device with index=1. The one with index=0
always gives the message "Invalid device handle."
<br>
* I get the wrong location id as well, 0 instead of 0x21...
<br>
* the FTID_GetNumDevices function also uses a byref, c_ulong and works.
<br>
* FTDI's win32 console example returns the right results (and uses c
unsigned longs) - available from <a
 href="http://www.ftdichip.com/Projects/FTDIChip-ID.htm">http://www.ftdichip.com/Projects/FTDIChip-ID.htm</a>
<br>
<br>
Any help appreciated!<br>
<br>
Regards,
<br>
Egor
<br>
<br>
</div>
</body>
</html>