Python bindings for ftdi_read_data() broken

Bug #1155973 reported by Christian Unhold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libftdi (Ubuntu)
New
Undecided
Unassigned

Bug Description

Regarding the Python bindings for libftdi, binary package python-ftdi 0.20-1 on precise, built from source package libftdi.
I is not possible to use the Python bindings for function ftdi_read_data().

Here is the C function description from the upstream documentation [1]:
int ftdi_read_data (
  struct ftdi_context * ftdi,
  unsigned char * buf,
  int size)
Parameters:
    ftdi pointer to ftdi_context
    buf Buffer to store data in
    size Size of the buffer
Return values:
    -666: USB device unavailable
    <0: error code from libusb_bulk_transfer()
    0: no data was available
    >0: number of bytes read

All my attempts to use the Python binding of this function failed.
Example:
 ReadData = ctypes.c_char * readCount
 readData = ReadData()
 actualReadCount = ftdi.ftdi_read_data(ftdiContext, ctypes.byref(readData), readCount)
Gives exception:

I am quite sure that there is no way to use it correctly.
The usage examples in the source package leave out the read function.

[1] http://www.intra2net.com/en/developer/libftdi/documentation/

Revision history for this message
Christian Unhold (unhold) wrote :

Missing exception:
TypeError: in method 'ftdi_read_data', argument 2 of type 'unsigned char *'

Revision history for this message
Christian Unhold (unhold) wrote :

The Python binding for ftdi_read_data() was changed in the new upstream [1] release 1.0 and can now be used in this way:
returnCode, readData = ftdi.ftdi_read_data(ftdiContext, maxSize)

[1] git://developer.intra2net.com/libftdi

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.