diff options
author | Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in> | 2015-08-21 00:19:41 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-08-20 22:58:45 -0700 |
commit | f33843ed35563c93110a961fde4ad45112f7dba4 (patch) | |
tree | 4a74a8771fb001c4418bedae486635eb78c10de3 /divesite.h | |
parent | 9ddc21a47628d48bcc3e1ff1b0c210e82cf1031d (diff) | |
download | subsurface-f33843ed35563c93110a961fde4ad45112f7dba4.tar.gz |
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.
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.
[Anton Lundin: This code was originally intended to be included in
libdivecomputer, but because we now got the custom-serial
patches, its included in subsurface instead, and wired in
from there - renamed the resulting file to serial_ftdi.c]
Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Rename serial_ftdi.c for subsurface source
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divesite.h')
0 files changed, 0 insertions, 0 deletions