Commit graph

5 commits

Author SHA1 Message Date
Tomaz Canabrava
4c0156e3d5 Move all core-functionality to subsurface-core
And adapt a new CMakeLists.txt file for it. On the way I've also
found out that we where double-compilling a few files. I've also
set the subsurface-core as a include_path but that was just to
reduce the noise on this commit, since I plan to remove it from
the include path to make it obligatory to specify something like

 include "subsurface-core/dive.h"

for the header files. Since the app is growing quite a bit we ended
up having a few different files with almost same name that did
similar things, I want to kill that (for instance Dive.h, dive.h,
PrintDive.h and such).

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:48 -07:00
Miika Turkia
51ce83ed20 Fix memory leaks in serial ftdi
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-09 21:33:49 -07:00
Anton Lundin
e2c98def26 Turn serial_ftdi.c into a custom_serial
This cleans up serial_ftdi.c from being a libdivecomputer source and
making it into a subsurface custom_serial.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:59:49 -07:00
Anton Lundin
3104508247 Re-indent and style up serial ftdi
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:59:42 -07:00
Venkatesh Shukla
f33843ed35 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>
2015-08-20 22:58:45 -07:00