summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRALOVICH, Kristof <tade60@freemail.hu>2014-08-11 18:37:48 +0200
committerRALOVICH, Kristof <tade60@freemail.hu>2014-08-11 18:37:48 +0200
commit367788f6468a94e1d7e23d6cb6b863b264063d9f (patch)
tree7e5f4a04c1435fec98f61447d56fca9407e23ac2
parent55ccd71f73276006712f9247284aa825b49a0281 (diff)
parentf8b57e68586505af4ef38a6ff5d35b2fd1ad5f48 (diff)
Merge branch 'master' of https://code.google.com/p/antpm
-rw-r--r--.travis.yml92
-rw-r--r--docs/PROTOCOL_HELP.txt14
-rw-r--r--docs/maintainer.txt47
-rwxr-xr-xscripts/coverity_scan_script.sh117
-rw-r--r--scripts/debian/control2
-rwxr-xr-xscripts/do_cov.sh8
-rw-r--r--src/SerialTty.cpp52
-rw-r--r--src/gant/antlib.c4
8 files changed, 281 insertions, 55 deletions
diff --git a/.travis.yml b/.travis.yml
index 6acfd2f..921dc6a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,45 +1,47 @@
-language: cpp
-script: cmake
-compiler:
- - clang
- - gcc
-notifications:
- email:
- recipients:
- - tade60@freemail.hu
- on_success: always
- on_failure: always
-branches:
- only:
- - master
- - coverity_scan
-before_install:
- - sudo apt-get update
- - uname -a
- - free
- - cat /proc/cpuinfo
- - g++ -v
- - clang++ -v
-install: sudo apt-get install libboost-dev libboost-date-time-dev libboost-thread-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-test-dev libusb-dev libxml2-dev valgrind
-before_script: mkdir cmake-build
-script:
- - cd cmake-build
- - cmake ../src -DCMAKE_BUILD_TYPE=Release -DUSE_BOOST_TEST=TRUE -DCMAKE_INSTALL_PREFIX=/usr && make -j4 && make test ARGS=-j99
- - make clean
- - cmake ../src -DCMAKE_BUILD_TYPE=Debug -DUSE_BOOST_TEST=TRUE -DCMAKE_INSTALL_PREFIX=/usr && make -j4 && make test ARGS=-j99
- - make clean
-
-env:
- global:
- - secure: "TwkmQpkzvrzW58QB9igH+8wATcWSyW+oWkWKUkCfjjZ4zEz5WA8v1CGk3/ABA1EllvdCxcMXwvP66A8NKQYET79lQxPXBK+l9GtC2gco4M3wZ5afW+5BCnsTehQLzKqM+2CK7Zlab7RKQ4g9/X8XTjrD5gN3rmVkgz2+dNKZ/N0="
-
-addons:
- coverity_scan:
- project:
- name: "ralovich/antpm"
- description: "Build submitted via Travis CI"
- notification_email: ralovich@in.tum.de
- build_command_prepend: "mkdir cmake-build && cd cmake-build && cmake ../src -DCMAKE_BUILD_TYPE=Debug -DUSE_BOOST_TEST=TRUE -DCMAKE_INSTALL_PREFIX=/usr && make clean"
- build_command: "make -j4"
- branch_pattern: coverity_scan
-
+# -*- coding: iso-8859-2-unix -*-
+env:
+ global:
+ - secure: "DF3a8vcQ7iU7AA4Ons5Ct05G/nhvr7bM8hYHd9B7x7h9tzaGJUgnESXCqiejtoR72fR626iGRXpD/O3h0pvj3OS9IywkuUXaNetnse8/xGZ+aKX+w7Dzvrrg8Q/07xazoR6cIzNJ/FyWWoKoY71gIMRHeOx5pebHyRkIxxFbUIw="
+
+addons:
+ coverity_scan:
+ project:
+ name: "ralovich/antpm"
+ description: "ANT+minus Build submitted via Travis CI"
+ notification_email: ralovich@in.tum.de
+ build_command_prepend: "pwd && cd cmake-build && pwd && cmake ../src -DCMAKE_BUILD_TYPE=Debug -DUSE_BOOST_TEST=TRUE"
+ build_command: "make -j 4"
+ branch_pattern: coverity_scan
+ build_script_url: "https://raw.githubusercontent.com/ralovich/antpm/master/scripts/coverity_scan_script.sh"
+
+language: cpp
+script: cmake
+compiler:
+ - clang
+ - gcc
+notifications:
+ email:
+ recipients:
+ - ralovich@in.tum.de
+ on_success: always
+ on_failure: always
+branches:
+ only:
+ - master
+ - coverity_scan
+before_install:
+ - sudo apt-get update
+ - uname -a
+ - free
+ - cat /proc/cpuinfo
+ - g++ -v
+ - clang++ -v
+install: sudo apt-get install libboost-dev libboost-date-time-dev libboost-thread-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-test-dev libusb-dev libxml2-dev valgrind
+before_script: mkdir cmake-build
+script:
+ - cd cmake-build
+ - cmake ../src -DCMAKE_BUILD_TYPE=Release -DUSE_BOOST_TEST=TRUE -DCMAKE_INSTALL_PREFIX=/usr && make -j4 && make test ARGS=-j99
+ - make clean
+ - cmake ../src -DCMAKE_BUILD_TYPE=Debug -DUSE_BOOST_TEST=TRUE -DCMAKE_INSTALL_PREFIX=/usr && make -j4 && make test ARGS=-j99
+ - make clean
+
diff --git a/docs/PROTOCOL_HELP.txt b/docs/PROTOCOL_HELP.txt
index d773726..0c09178 100644
--- a/docs/PROTOCOL_HELP.txt
+++ b/docs/PROTOCOL_HELP.txt
@@ -6,22 +6,22 @@
1) Install VirtualBox on linux, including proprietary oracle usb extensions from www.virtualbox.org. The Open Source edition in the distribution does not support USB.
-2) Install win xp with service pack 3 in vbox, set up usb filter to pass through all devices
+2) Install win xp with service pack 3 in vbox, set up usb filter to pass through all devices
3) Install garmin's ant agent in virtual xp, but do not start it!
-4) Plug in your USB2ANT stick to the host, make sure the cp210x driver didn't grab it, by unloading cp210x kernel module: "rmmod cp210x".
+4) Plug in your USB2ANT stick to the host, make sure the cp210x driver didn't grab it, by unloading cp210x kernel module: "rmmod cp210x".
5) Make sure usbmon kernel driver is loaded on the host: "modprobe usbmon"
6) Under linux host, figure out usb bus address of your USB2ANT stick: "lsusb" (e.g.: "Bus 005 Device 001: ID 1d6b:0001 USB2ANT ..." means our bus number is 5)
-7) We need to increase usbmon lower threshold for message truncation to say 100 characters. For this build the usbmon tool:
- # git clone https://code.google.com/p/antpm/
- # cd antpm/3rd_party/usbmon-6/
- # make
+7) We need to increase usbmon lower threshold for message truncation to say 100 characters. For this build the usbmon tool:
+ # git clone https://code.google.com/p/antpm/
+ # cd antpm/3rd_party/usbmon-6/
+ # make
-8) Start capturing usb traffic under linux host: "./usbmon -i <USB bus> -fu -s 100 > ~/ant-usb-log-001.usbmon"
+8) Start capturing usb traffic under linux host: "./usbmon -i <USB bus> -fu -s 100 > ~/ant-usb-log-001.usbmon"
9) Start garmin's ant agent in virtual xp. Once the download is done, quit ant agent. Also terminate the above "cat" process. The dump of your usb communication is now saved to ~/ant-usb-log-001.usbmon.
diff --git a/docs/maintainer.txt b/docs/maintainer.txt
index e0ad785..19c51cb 100644
--- a/docs/maintainer.txt
+++ b/docs/maintainer.txt
@@ -122,7 +122,52 @@ apt-get source bc
pbuilder build *.dsc
** building the actual package
+rm -r cmake-build
git reset --hard HEAD
+git clean -f -X
+git clean -f -d
pristine-tar checkout antpm_1.14.orig.tar.gz
mv antpm_1.14.orig.tar.gz ..
-git-pbuilder -us -uc
+DIST=sid ARCH=i386 git-pbuilder --update
+DIST=sid ARCH=i386 git-pbuilder -us -uc
+
+** managing patches on top of the package with quilt
+* http://pkg-perl.alioth.debian.org/howto/quilt.html
+*** Creating a Patch
+To create a patch, run quilt new $patch_name. If you want .patch
+extension, you need to give it explicitly.
+This creates a new patch entry in debian/patches. This patch also
+becomes the topmost or current patch. This is the patch that is at the
+top of the stack.
+Now choose what file you want to change in that patch and run quilt
+edit $file. quilt notes the current state of the file and launches
+your $EDITOR so you can edit the file.
+Repeat the quilt edit command for every file you want to be changed by
+that patch.
+When you're finished, run quilt refresh. This compares the noted state
+of the edited files with their present state, and produces a patch in
+debian/patches.
+Note that this patch is currently applied. Check it with quilt
+applied.
+If the package is already being maintained in the pkg-perl Git
+repository, it is necessary to tell Git that you have added new
+files. You can do this with git add debian/patches ; git commit.
+
+***Applying and Unapplying Patches
+Now that we have the patch applied, let's play with it. quilt pop
+unapplies the topmost patch. quilt push applies the next patch in the
+series. You may see the list of unapplied patches with quilt
+unapplied.
+
+***Editing Patches
+To edit a patch, you have to first make it current (be on the top of
+the stack of applied patches). If the patch is already applied (but
+not the top), run quilt pop $patch_name; if it is not, run quilt push
+$patch_name. Now that the patch is on the top of the stack, run quilt
+edit $file as before. You can edit files that were already in the
+patch and you can edit new files. When you're done, remember to tell
+this to quilt by running quilt refresh.
+
+***Other Commands
+quilt delete deletes, quilt rename renames a patch. There are a lot
+more. See the manual page.
diff --git a/scripts/coverity_scan_script.sh b/scripts/coverity_scan_script.sh
new file mode 100755
index 0000000..23429d6
--- /dev/null
+++ b/scripts/coverity_scan_script.sh
@@ -0,0 +1,117 @@
+#!/bin/sh
+
+set -e
+
+# Environment check
+echo -e "\033[33;1mNote: PROJECT_NAME and COVERITY_SCAN_TOKEN are available on Project Settings page on scan.coverity.com\033[0m"
+[ -z "$COVERITY_SCAN_PROJECT_NAME" ] && echo "ERROR: COVERITY_SCAN_PROJECT_NAME must be set" && exit 1
+#[ -z "$COVERITY_SCAN_NOTIFICATION_EMAIL" ] && echo "ERROR: COVERITY_SCAN_NOTIFICATION_EMAIL must be set" && exit 1
+[ -z "$COVERITY_SCAN_BRANCH_PATTERN" ] && echo "ERROR: COVERITY_SCAN_BRANCH_PATTERN must be set" && exit 1
+[ -z "$COVERITY_SCAN_BUILD_COMMAND" ] && echo "ERROR: COVERITY_SCAN_BUILD_COMMAND must be set" && exit 1
+[ -z "$COVERITY_SCAN_TOKEN" ] && echo "ERROR: COVERITY_SCAN_TOKEN must be set" && exit 1
+
+PLATFORM=`uname`
+TOOL_ARCHIVE=/tmp/cov-analysis-${PLATFORM}.tgz
+TOOL_URL=https://scan.coverity.com/download/${PLATFORM}
+TOOL_BASE=/tmp/coverity-scan-analysis
+UPLOAD_URL="https://scan.coverity.com/builds"
+SCAN_URL="https://scan.coverity.com"
+
+# Do not run on pull requests
+if [ "${TRAVIS_PULL_REQUEST}" = "true" ]; then
+ echo -e "\033[33;1mINFO: Skipping Coverity Analysis: branch is a pull request.\033[0m"
+ exit 0
+fi
+
+# Verify this branch should run
+IS_COVERITY_SCAN_BRANCH=`ruby -e "puts '${TRAVIS_BRANCH}' =~ /\\A$COVERITY_SCAN_BRANCH_PATTERN\\z/ ? 1 : 0"`
+if [ "$IS_COVERITY_SCAN_BRANCH" = "1" ]; then
+ echo -e "\033[33;1mCoverity Scan configured to run on branch ${TRAVIS_BRANCH}\033[0m"
+else
+ echo -e "\033[33;1mCoverity Scan NOT configured to run on branch ${TRAVIS_BRANCH}\033[0m"
+ exit 1
+fi
+
+# Verify upload is permitted
+AUTH_RES=`curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted`
+if [ "$AUTH_RES" = "Access denied" ]; then
+ echo -e "\033[33;1mCoverity Scan API access denied. Check COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN.\033[0m"
+ exit 1
+else
+ AUTH=`echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['upload_permitted']"`
+ if [ "$AUTH" = "true" ]; then
+ echo -e "\033[33;1mCoverity Scan analysis authorized per quota.\033[0m"
+ else
+ WHEN=`echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['next_upload_permitted_at']"`
+ echo -e "\033[33;1mCoverity Scan analysis NOT authorized until $WHEN.\033[0m"
+ exit 1
+ fi
+fi
+
+if [ ! -d $TOOL_BASE ]; then
+ # Download Coverity Scan Analysis Tool
+ if [ ! -e $TOOL_ARCHIVE ]; then
+ echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m"
+ wget -nv -O $TOOL_ARCHIVE $TOOL_URL --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN"
+ fi
+
+ # Extract Coverity Scan Analysis Tool
+ echo -e "\033[33;1mExtracting Coverity Scan Analysis Tool...\033[0m"
+ mkdir -p $TOOL_BASE
+ pushd $TOOL_BASE
+ tar xzf $TOOL_ARCHIVE
+ popd
+fi
+
+TOOL_DIR=`find $TOOL_BASE -type d -name 'cov-analysis*'`
+export PATH=$TOOL_DIR/bin:$PATH
+echo $PATH
+
+# Build
+echo -e "\033[33;1mRunning Coverity Scan Analysis Tool....\033[0m"
+COV_BUILD_OPTIONS=""
+#COV_BUILD_OPTIONS="--return-emit-failures 8 --parse-error-threshold 85"
+RESULTS_DIR="cov-int"
+pwd
+echo "COVERITY_SCAN_BUILD_COMMAND_PREPEND=${COVERITY_SCAN_BUILD_COMMAND_PREPEND}"
+eval "${COVERITY_SCAN_BUILD_COMMAND_PREPEND}"
+pwd
+ls -las
+echo "CB=cov-build --dir $RESULTS_DIR $COV_BUILD_OPTIONS $COVERITY_SCAN_BUILD_COMMAND"
+COVERITY_UNSUPPORTED=1 cov-build --dir $RESULTS_DIR $COV_BUILD_OPTIONS $COVERITY_SCAN_BUILD_COMMAND
+echo "++++++++++++++++++++++++++++++"
+cat $RESULTS_DIR/build-log.txt
+echo "++++++++++++++++++++++++++++++"
+pwd
+cov-build --dir $RESULTS_DIR $COV_BUILD_OPTIONS $COVERITY_SCAN_BUILD_COMMAND
+echo "++++++++++++++++++++++++++++++"
+cat $RESULTS_DIR/build-log.txt
+echo "++++++++++++++++++++++++++++++"
+pwd
+cov-import-scm --dir $RESULTS_DIR --scm git --log $RESULTS_DIR/scm_log.txt 2>&1
+
+# Upload results
+echo -e "\033[33;1mTarring Coverity Scan Analysis results...\033[0m"
+RESULTS_ARCHIVE=analysis-results.tgz
+tar czvf $RESULTS_ARCHIVE $RESULTS_DIR
+SHA=`git rev-parse --short HEAD`
+
+exit 0
+
+echo -e "\033[33;1mUploading Coverity Scan Analysis results...\033[0m"
+response=$(curl \
+ --silent --write-out "\n%{http_code}\n" \
+ --form project=$COVERITY_SCAN_PROJECT_NAME \
+ --form token=$COVERITY_SCAN_TOKEN \
+ --form email=$COVERITY_SCAN_NOTIFICATION_EMAIL \
+ --form file=@$RESULTS_ARCHIVE \
+ --form version=$SHA \
+ --form description="Travis CI build" \
+ $UPLOAD_URL)
+status_code=$(echo "$response" | sed -n '$p')
+if [ "$status_code" != "201" ]; then
+ TEXT=$(echo "$response" | sed '$d')
+ echo -e "\033[33;1mCoverity Scan upload failed: $TEXT.\033[0m"
+ # changed the following
+ exit 1
+fi
diff --git a/scripts/debian/control b/scripts/debian/control
index 24929a7..bbd6d3e 100644
--- a/scripts/debian/control
+++ b/scripts/debian/control
@@ -3,7 +3,7 @@ Maintainer: Kristof Ralovich <tade60@freemail.hu>
Section: misc
Priority: optional
Standards-Version: 3.9.4
-Build-Depends: debhelper (>= 8), devscripts (>= 2.10), g++ (>= 4.4) | clang (>= 3.0), libboost-dev (>= 1.41) | libboost1.41-dev, cmake (>= 2.8), libusb-dev, libxml2-dev, pkg-config (>= 0.25), libboost-thread-dev,libboost-filesystem-dev,libboost-system-dev,libboost-date-time-dev,libboost-program-options-dev,libboost-test-dev
+Build-Depends: debhelper (>= 8), devscripts (>= 2.10), g++ (>= 4.4) | clang (>= 3.0), libboost-dev (>= 1.41) | libboost1.41-dev, cmake (>= 2.8), libusb-dev, libxml2-dev, pkg-config (>= 0.25), libboost-thread-dev,libboost-filesystem-dev,libboost-system-dev,libboost-date-time-dev,libboost-program-options-dev,libboost-test-dev,libboost-atomic-dev
Homepage: https://code.google.com/p/antpm/
Vcs-Git: https://code.google.com/p/antpm/
Vcs-Browser: https://code.google.com/p/antpm/source/browse/
diff --git a/scripts/do_cov.sh b/scripts/do_cov.sh
new file mode 100755
index 0000000..416aebf
--- /dev/null
+++ b/scripts/do_cov.sh
@@ -0,0 +1,8 @@
+
+PATH=~/bin/cov/cov-analysis-linux64-7.5.0/bin:$PATH
+
+mkdir build-cov
+(cd build-cov && cmake ../src -DCMAKE_BUILD_TYPE=Debug -DUSE_BOOST_TEST=TRUE)
+(cd build-cov && cov-build --dir cov-int make -j 4)
+
+
diff --git a/src/SerialTty.cpp b/src/SerialTty.cpp
index 5fe98b9..6612909 100644
--- a/src/SerialTty.cpp
+++ b/src/SerialTty.cpp
@@ -33,14 +33,18 @@
#include <algorithm>
#include <vector>
#include <string>
-#include <boost/thread/thread_time.hpp>
+#include <boost/version.hpp>
+#include <boost/thread/thread_time.hpp>
#include <boost/filesystem.hpp>
#include "Log.hpp"
#include "common.hpp"
#include "DeviceSettings.hpp"
+#ifndef IUCLC
+# define IUCLC 0
+#endif
namespace fs = boost::filesystem;
using namespace std;
@@ -89,10 +93,56 @@ find_file_starts_with(const fs::path & dir,
for( fs::directory_iterator dir_iter(dir) ; dir_iter != end_iter ; ++dir_iter)
{
fs::path p = *dir_iter;
+/// from http://www.boost.org/doc/libs/1_49_0/libs/filesystem/v2/doc/index.htm
+
+/// Version 3, a major revision with many new and improved features,
+/// is also available. Version 3 may break some user code written for
+/// Version 2.
+
+// To ease the transition, Boost releases 1.44 through 1.47 will
+// supply both V2 and V3. Version 2 is the default version for Boost
+// release 1.44 and 1.45. Version 3 will be the default starting with
+// release 1.46.
+
+// Define macro BOOST_FILESYSTEM_VERSION as 3 to use Version 3. This
+// will be the default for release 1.46 and later.
+
+// Define macro BOOST_FILESYSTEM_VERSION as 2 to use Version 2. This
+// is the default for release 1.44 and 1.45.
+
+// You may define the BOOST_FILESYSTEM_VERSION macro:
+
+
+// On the build command line; the exact format depends on your
+// compiler or IDE
+
+
+// In your code, before including any filesystem header, #define
+// BOOST_FILESYSTEM_VERSION n
+
+
+// #define BOOST_FILESYSTEM_VERSION n in boost/config/user.hpp. Note
+// #that this approach applies to all uses of Boost.Filesystem.
+
+// Existing code should be moved to version 3 as soon as
+// convenient. New code should be written for version 3.
+
+// Version 2 is deprecated, and will not be included in Boost releases
+// 1.48 and later.
+
+#if (((BOOST_VERSION/100000)==1) && (((BOOST_VERSION / 100) % 1000)<44)) // BOOST_FILESYSTEM_VERSION==2
+ if(std::string(p.leaf()).find(start)==0)
+ {
+ return std::string(p.leaf());
+ }
+#elif BOOST_FILESYSTEM_VERSION==3
if(p.leaf().string().find(start)==0)
{
return p.leaf().string();
}
+#else
+# error "Unsupported boost filesystem version" ##BOOST_FILESYSTEM_VERSION
+#endif
}
return "";
}
diff --git a/src/gant/antlib.c b/src/gant/antlib.c
index 8b3c58d..e879b8d 100644
--- a/src/gant/antlib.c
+++ b/src/gant/antlib.c
@@ -28,6 +28,10 @@
#define MAXCHAN 32
#define BSIZE 8*10000
+#ifndef IUCLC
+# define IUCLC 0
+#endif
+
#define uchar unsigned char
#define hexval(c) ((c >= '0' && c <= '9') ? (c-'0') : ((c&0xdf)-'A'+10))