mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
Connect up serial_ftdi custom serial
This connects the serial_ftdi implementation to subsurface, and builds libftdi1 for the android builds. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e2c98def26
commit
8d73e4f81c
4 changed files with 43 additions and 2 deletions
|
@ -20,6 +20,7 @@ option(FORCE_LIBSSH "force linking with libssh to workaround libgit2 bug" ON)
|
|||
option(SUBSURFACE_MOBILE "build the QtQuick version for mobile device" OFF)
|
||||
option(FBSUPPORT "allow posting to Facebook" ON)
|
||||
option(BTSUPPORT "enable support for QtBluetooth (requires Qt5.4 or newer)" ON)
|
||||
option(FTDISUPPORT "enable support for libftdi based serial" OFF)
|
||||
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_MODULE_PATH}
|
||||
|
@ -118,6 +119,16 @@ if(NOT NO_MARBLE)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(FTDISUPPORT)
|
||||
message(STATUS "building with libftdi support")
|
||||
pkg_config_library(LIBFTDI libftdi QUIET)
|
||||
if (NOT LIBFTDI_FOUND)
|
||||
pkg_config_library(LIBFTDI libftdi1 REQUIRED)
|
||||
endif()
|
||||
set(SERIAL_FTDI serial_ftdi.c)
|
||||
add_definitions(-DSERIAL_FTDI)
|
||||
endif()
|
||||
|
||||
if(NO_MARBLE)
|
||||
message(STATUS "building without marble widget support")
|
||||
add_definitions(-DNO_MARBLE)
|
||||
|
@ -341,6 +352,7 @@ set(SUBSURFACE_CORE_LIB_SRCS
|
|||
divelogexportlogic.cpp
|
||||
qt-init.cpp
|
||||
qtserialbluetooth.cpp
|
||||
${SERIAL_FTDI}
|
||||
${PLATFORM_SRC}
|
||||
)
|
||||
source_group("Subsurface Core" FILES ${SUBSURFACE_CORE_LIB_SRCS})
|
||||
|
|
|
@ -925,10 +925,17 @@ const char *do_libdivecomputer_import(device_data_t *data)
|
|||
err = translate("gettextFromC", "Unable to open %s %s (%s)");
|
||||
|
||||
#if defined(SSRF_CUSTOM_SERIAL)
|
||||
if (data->bluetooth_mode) {
|
||||
dc_serial_t *serial_device;
|
||||
dc_serial_t *serial_device = NULL;
|
||||
|
||||
if (data->bluetooth_mode) {
|
||||
rc = dc_serial_qt_open(&serial_device, data->context, data->devname);
|
||||
#ifdef SERIAL_FTDI
|
||||
} else if (!strcmp(data->devname, "ftdi")) {
|
||||
rc = dc_serial_ftdi_open(&serial_device, data->context);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (serial_device) {
|
||||
if (rc == DC_STATUS_SUCCESS) {
|
||||
rc = dc_device_custom_open(&data->device, data->context, data->descriptor, serial_device);
|
||||
} else {
|
||||
|
|
|
@ -56,6 +56,7 @@ extern char *dumpfile_name;
|
|||
|
||||
#if SSRF_CUSTOM_SERIAL
|
||||
extern dc_status_t dc_serial_qt_open(dc_serial_t **out, dc_context_t *context, const char *devaddr);
|
||||
extern dc_status_t dc_serial_ftdi_open(dc_serial_t **out, dc_context_t *context);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -28,6 +28,7 @@ LIBGIT2_VERSION=0.23.0
|
|||
LIBSSH2_VERSION=1.6.0
|
||||
LIBUSB_VERSION=1.0.19
|
||||
OPENSSL_VERSION=1.0.1p
|
||||
LIBFTDI_VERSION=1.2
|
||||
|
||||
# arm or x86
|
||||
export ARCH=${1-arm}
|
||||
|
@ -228,6 +229,25 @@ if [ ! -e $PKG_CONFIG_LIBDIR/libusb-1.0.pc ] ; then
|
|||
sed -ie 's/Libs.private: -c/Libs.private: /' $PKG_CONFIG_LIBDIR/libusb-1.0.pc
|
||||
fi
|
||||
|
||||
if [ ! -e libftdi1-${LIBFTDI_VERSION}.tar.bz2 ] ; then
|
||||
wget -O libftdi1-${LIBFTDI_VERSION}.tar.bz2 http://www.intra2net.com/en/developer/libftdi/download/libftdi1-${LIBFTDI_VERSION}.tar.bz2
|
||||
fi
|
||||
if [ ! -e libftdi1-${LIBFTDI_VERSION} ] ; then
|
||||
tar -jxf libftdi1-${LIBFTDI_VERSION}.tar.bz2
|
||||
fi
|
||||
if [ ! -e $PKG_CONFIG_LIBDIR/libftdi1.pc ] ; then
|
||||
mkdir -p libftdi1-build-$ARCH
|
||||
pushd libftdi1-build-$ARCH
|
||||
cmake ../libftdi1-${LIBFTDI_VERSION} -DCMAKE_C_COMPILER=${CC} -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_PREFIX_PATH=${PREFIX} -DSTATICLIBS=ON -DPYTHON_BINDINGS=OFF -DDOCUMENTATION=OFF -DFTDIPP=OFF -DBUILD_TESTS=OFF -DEXAMPLES=OFF
|
||||
make
|
||||
make install
|
||||
popd
|
||||
fi
|
||||
# Blast away the shared version to force static linking
|
||||
if [ -e $PREFIX/lib/libftdi1.so ] ; then
|
||||
rm $PREFIX/lib/libftdi1.so*
|
||||
fi
|
||||
|
||||
if [ ! -e $PKG_CONFIG_LIBDIR/libdivecomputer.pc ] ; then
|
||||
mkdir -p libdivecomputer-build-$ARCH
|
||||
pushd libdivecomputer-build-$ARCH
|
||||
|
@ -278,6 +298,7 @@ cmake $MOBILE_CMAKE \
|
|||
-DNO_USERMANUAL=ON \
|
||||
-DCMAKE_PREFIX_PATH:UNINITIALIZED=${QT5_ANDROID}/android_${QT_ARCH}/lib/cmake \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DFTDISUPPORT=ON \
|
||||
$SUBSURFACE_SOURCE
|
||||
make
|
||||
#make install INSTALL_ROOT=android_build
|
||||
|
|
Loading…
Reference in a new issue