serial_ftdi.c for communication with ftdi devices

This script is based on serial_posix.c and is primarily meant to work on
android, but could be used elsewhere as well. This script communicates with
libftdi devices connected to the system using libftdi library.

ftdi_read_data returns 0 if no data is received from the device. Allowing to
continue on recieving 0 might end up in an infinite loop. But it works in
OSTC3. This needs to be checked further.

libftdi returns -3 when it could not find any device corresponding to the pid
and vid given. (Different from -3 of libusb which means you do not have
permissions to access the device) Use this to return value to check for other
accepted chipsets including the custom pids used by divecomputer manufacturers
such as Cressi (Leonardo), Suunto and Oceanic.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Check for libftdi, include it in Required.private

Added check for libftdi during configure. This is necessary as libftdi would be
needed for communication on android. Suitable modifications are also made to
enable cross building for android platform.

If you are building for android, you would need libftdi package. Hence, add this
in Required.private so that it may be included automatically while cross
compilation.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Pass a void * instead of const char *

Name is not suitable for every platform. Hence, instead of passing const char
*name, it is better to pass a void * which can be used to pass anything to the
serial_open function. For serial_posix, name is required, for serial_ftdi, int
usb_fd is required. Incorporate these as well.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Implement exponential backoff on 0 return

ftdi_read_data returns the number of bytes read (+ve), 0 when there is no data
to read, and negative when there is an error.
Instead of infinitely waiting for the data to appear, it is better to implement
an exponential backoff which times out after MAX_BACKOFF.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Check for ftdi_usb_open_fd

If ftdi_usb_open_fd is present in libftdi, then use ftdi_usb_open_fd passing fd.
Else use ftdi_usb_open.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>