libftdi Archives

Subject: Re: Reading Pins with Python

From: Jim Paris <jim@xxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 31 May 2012 14:46:53 -0400
tux gurl wrote:
> Hello there!
> 
> I've been trying to read the pins on my UM232R using libftdi v0.20 and I am
> not having any luck.
> Can someone point me in the right direction?
> 
> This is a snippet of my current code and the error that pops up:
> 
> pins = ftdi.new_ucharp()
> ftdi.ftdi_read_data(ftdic, pins, 1)
> print hex(ftdi.ucharp_value(pins))
> 
> 
> Traceback (most recent call last):
>   File "./test.py", line 54, in <module>
>     ftdi.ftdi_read_data(ftdic, pins, 1)
> TypeError: in method 'ftdi_read_data', argument 2 of type 'unsigned char *'
> Any help would be greatly appreciated!

The Python bindings are kind of a mess.  The ftdi.ftdi_read_data and
ftdi.ftdi_read_pins functions are basically unusable in the current
0.20 bindings, which is what's available as the "python-ftdi" package
on Debian and Ubuntu.

It seems [1] that Michel Zou has done some work to fix things in the
unreleased 1.x branch.  Unfortunately those patches also remove the
ftdi_* prefix from all functions, so even the parts that _did_ work on
0.20 are no longer compatible.

If 0.x is going to continue being the released version, it would
probably make sense to bring those patches there as well, so at least
they're compatible.  Otherwise pushing to drop 0.x and release 1.x
would really help simplify all of this.

-jim

[1] http://developer.intra2net.com/git/?p=libftdi&a=search&s=python

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread