sorry about the delay as I haven't picked up email on this account for
I also haven't written code using the bindings for a while as my
immediate need is done and dusted.
The swig typedef solution works (have used it before) as does using
ctypes module. I normally avoid doing this unless absolutely necessary
as it necessitates more manual intervention in the glue for maintenance.
I've just whittled down some code as way of example of how I have it
The main difference appears to be that I am using ftdi_write_data not
ftdi_write to write serial string...this avoids all the hassles you are
eg a crude snippet to talk to matrox orbital LCD could be
[I'm used pyusb for enumeration at the time. Typically on linux its also
quite easy to use the /sys interface]
import time, usb, ftdi
def __init__(self, context, ftdi):
def text(self, text):
self.ftdi.ftdi_write_data(self.context, text, len(text))
#lets try for usb enum
while not found:
print "finding dev"
for bus in usb.busses():
for dev in bus.devices:
if dev.idVendor==0x1b3d and dev.idProduct==0x157:
if found: break
print "dev found"
#we now connect via ftdi
ftdi.ftdi_usb_open(context, 0x1b3d, 0x157 )
ftdi.ftdi_set_line_property( context, ftdi.BITS_8, ftdi.EVEN,
return lcd(context, ftdi)
On 03/17/10 12:16, Jonathan Moreton wrote:
> Thank you Thomas that was helpful, but not what I am trying to do.
> What i am trying to do is send a serial string out using the
> ftdi_write() method.
> can I do the following with out breaking anything?
> Change the function to take a string instead of unsigned char *
> Many Thanks
> Jonathan Moreton
> On Tue, 2010-03-16 at 22:58 +0100, Thomas Jarosch wrote:
>> Hello Jonathan,
>> On 03/13/2010 05:20 PM, Jonathan Moreton wrote:
>>> I am using the python bindings for libftdi what type do i need to set
>>> the buf to when using ftdi_write_data as I get
>>> TypeError: in method 'ftdi_write_data', argument 2 of type 'unsigned
>>> char *'
>> I found a small piece of python code using the wrapper
>> on this german speaking website:
>> Scroll down for the code. Maybe it helps.
>> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
>> To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx