Hello,
I tried to read the chipid in python:
import ftdi
ftdic = ftdi.ftdi_context()
ret = ftdi.ftdi_usb_open(ftdic, 0x0403, 0x6001)
chipid = 0
ftdi.ftdi_read_chipid(ftdic, chipid)
results in a TypeError:
TypeError: in method 'ftdi_read_chipid', argument 2 of type 'unsigned
int *'
Without help from Swig it is not possible to create the correct object.
Inserting in bindings/ftdi.i the line
%pointer_functions(unsigned int, uintp);
after %include "cpointer.i" helps (pointer_class could also be used).
With a little modification in python:
import ftdi
ftdic = ftdi.ftdi_context()
ret = ftdi.ftdi_usb_open(ftdic, 0x0403, 0x6001)
chipid = ftdi.new_uintp()
ftdi.ftdi_read_chipid(ftdic, chipid)
hex(ftdi.uintp_value(chipid))
the correct chipid is printed.
It seems (I'm not an expert in swig), that the *OUTPUT directives are
not correct for
ftdi_read_chipid, otherwise this patch woud not be needed.
Flynn
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|