[Pkg-running-devel] [openambit] 01/04: Merge upstream git as of 20140714

Christian Perrier bubulle at moszumanska.debian.org
Mon Jul 14 14:05:32 UTC 2014


This is an automated email from the git hooks/post-receive script.

bubulle pushed a commit to branch master
in repository openambit.

commit a4e4ec3ee141792e743dfee44382f3527df8cb70
Author: Christian Perrier <bubulle at debian.org>
Date:   Mon Jul 14 16:02:10 2014 +0200

    Merge upstream git as of 20140714
---
 README                                         |  10 +-
 debian/changelog                               |  17 --
 debian/compat                                  |   1 -
 debian/control                                 |  87 ---------
 debian/copyright                               |  65 -------
 debian/docs                                    |   1 -
 debian/gbp.conf                                |   2 -
 debian/libambit0-dev.install                   |   1 -
 debian/libambit0.install                       |   1 -
 debian/openambit.install                       |   4 -
 debian/patches/01_FixDesktopCategory           |  10 --
 debian/patches/series                          |   1 -
 debian/rules                                   |  29 ---
 debian/source/format                           |   1 -
 src/example/ambitconsole.c                     |   4 +-
 src/libambit/libambit.c                        |  77 +++++---
 src/libambit/libambit.h                        |  10 +-
 src/libambit/libambit_int.h                    |   3 -
 src/libambit/pmem20.c                          |  13 +-
 src/openambit/CMakeLists.txt                   |   4 +-
 src/openambit/confirmbetadialog.ui             |   2 +-
 src/openambit/deployment/99-suunto-ambit.rules |   3 +
 src/openambit/deployment/openambit.desktop     |   4 +-
 src/openambit/logentry.cpp                     |  41 +++++
 src/openambit/logentry.h                       |   3 +
 src/openambit/logstore.cpp                     |  66 +++++--
 src/openambit/main.cpp                         |   3 -
 src/openambit/mainwindow.cpp                   |  18 +-
 src/openambit/mainwindow.h                     |   2 +
 src/openambit/mainwindow.ui                    |  16 +-
 src/openambit/movescount/movescountjson.cpp    |  16 +-
 src/openambit/movescount/movescountxml.cpp     |   5 +-
 wireshark_dissector/AUTHORS                    |   2 +-
 wireshark_dissector/ambit-dissector.c          | 235 +++++++++++++++++--------
 34 files changed, 370 insertions(+), 387 deletions(-)

diff --git a/README b/README
index 0f45808..9d4a924 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
 OPENAMBIT
 =========
 
-The openambit source repository contains of several parts.
+The openambit source repository consists of several parts.
 Each part is briefly described below.
 Most people would like to use both the device communication
 library (libambit) and the GUI (openambit). The build / install
-scripts described below makes your life easier if you are
+scripts described below make your life easier if you are
 like most people.
 You can choose to run the GUI from the build folder or install
 it to your system.
@@ -13,7 +13,7 @@ it to your system.
 BUILD SCRIPT
 ============
 Builds libambit and openambit in one command
-> cd YOUR/git/REPO/loaction
+> cd YOUR/git/REPO/location
 > ./build.sh
 
 
@@ -21,14 +21,14 @@ BUILD AND INSTALL SCRIPT
 ========================
 Builds and install libambit and openambit in one command.
 Note that the script will try to run sudo to install things.
-> cd YOUR/git/REPO/loaction
+> cd YOUR/git/REPO/location
 > ./install.sh
 
 
 DEPENDENCIES
 ============
 To be able to build libambit and openambit the following libraries
-(and their header files) needs to be available:
+(and their header files) need to be available:
  - libudev
  - libusb
  - libqjson
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index ac3b3ad..0000000
--- a/debian/changelog
+++ /dev/null
@@ -1,17 +0,0 @@
-openambit (0.2-2) unstable; urgency=low
-
-  * Properly specify BSD-3-clause license for
-    openambit-0.2/wireshark_dissector/*
-  * Properly specidy alternative BSD-3-clause or HIDAPI licenses
-    for openambit-0.2/src/libambit/hid*
-
- -- Christian Perrier <bubulle at debian.org>  Tue, 08 Jul 2014 07:58:19 +0200
-
-openambit (0.2-1) unstable; urgency=low
-
-  * Initial release . Closes: #746652
-  * Fix category used by upstream in the desktop file because it is not
-    one registered at http://standards.freedesktop.org/menu-spec/1.0/apa.html.
-    Use: Education;Sports
-
- -- Christian Perrier <bubulle at debian.org>  Thu, 01 May 2014 11:53:02 +0200
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index ec63514..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/debian/control b/debian/control
deleted file mode 100644
index c1b91c9..0000000
--- a/debian/control
+++ /dev/null
@@ -1,87 +0,0 @@
-Source: openambit
-Section: utils
-Priority: optional
-Maintainer: Debian running development group <pkg-running-devel at lists.alioth.debian.org>
-Uploaders: Christian Perrier <bubulle at debian.org>
-Build-Depends: debhelper (>= 9~), cmake, libusb-1.0-0-dev, libudev-dev, libqjson-dev, libqt4-dev, zlib1g-dev
-Standards-Version: 3.9.5
-Homepage: http://openambit.org/
-Vcs-Git: git://git.debian.org/pkg-running/openambit.git
-Vcs-Browser: http://git.debian.org/?p=pkg-running/openambit.git;a=summary
-
-Package: openambit
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: utilities for Suunto Ambit sport watches
- This package provides software that helps communicating with Suunto Ambit
- outdoor watches.
- .
- OpenAmbit offers the following features:
-  - Read logs from device and save them in XML files;
-  - Upload logs to movescount.com;
-  - Update orbital data (for faster GPS sync) to the device.
- .
- It doesn't have the following features (but may include them in future
- releases):
-  - Sync user settings from movescount to device;
-  - Sync apps, routes etc from movescount to device.
- .
- The application is divided in 2 parts, libambit which is a basic
- C-library that does the device-communication, and the openambit GUI
- application that writes the logs to XML files and synchronize with
- movescount. The movescount parts is completely optional, and needs
- to be manually enabled in the UI.
- .
- This package provides the GUI interface.
-
-Package: libambit0
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: utilities for Suunto Ambit sport watches
- This package provides software that helps communicating with Suunto Ambit
- outdoor watches.
- .
- OpenAmbit offers the following features:
-  - Read logs from device and save them in XML files;
-  - Upload logs to movescount.com;
-  - Update orbital data (for faster GPS sync) to the device.
- .
- It doesn't have the following features (but may include them in future
- releases):
-  - Sync user settings from movescount to device;
-  - Sync apps, routes etc from movescount to device.
- .
- The application is divided in 2 parts, libambit which is a basic
- C-library that does the device-communication, and the openambit GUI
- application that writes the logs to XML files and synchronize with
- movescount. The movescount parts is completely optional, and needs
- to be manually enabled in the UI.
- .
- This package provides the shared library.
-
-Package: libambit0-dev
-Architecture: any
-Section: libdevel
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: utilities for Suunto Ambit sport watches
- This package provides software that helps communicating with Suunto Ambit
- outdoor watches.
- .
- OpenAmbit offers the following features:
-  - Read logs from device and save them in XML files;
-  - Upload logs to movescount.com;
-  - Update orbital data (for faster GPS sync) to the device.
- .
- It doesn't have the following features (but may include them in future
- releases):
-  - Sync user settings from movescount to device;
-  - Sync apps, routes etc from movescount to device.
- .
- The application is divided in 2 parts, libambit which is a basic
- C-library that does the device-communication, and the openambit GUI
- application that writes the logs to XML files and synchronize with
- movescount. The movescount parts is completely optional, and needs
- to be manually enabled in the UI.
- .
- This package provides the development files.
-
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644
index e54e1d6..0000000
--- a/debian/copyright
+++ /dev/null
@@ -1,65 +0,0 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: openambit
-Source: http://openambit.org
-
-Files: src/libambit/hid.c src/libambit/hid-libusb.c
-Copyright: 2009 Alan Ott
-License: GPL-3 or BSD-3-Clause or HIDAPI
-
-Files: wireshark_dissector/*
-Copyright: 2013 Emil Ljungdahl <emil at kratern.se>
-License: BSD-3-clause
-
-Files: *
-Copyright: 2013,2014 Emil Ljungdahl <emil at kratern.se>
-License: GPL-3
-
-Files: debian/*
-Copyright: 2014 Christian Perrier <bubulle at debian.org>
-License: GPL-3
-
-License: GPL-3
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- .
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
- .
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>.
- .
- On Debian systems, the complete text of the GNU General
- Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
-
-License: BSD-3-clause
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- .
- 1. Redistributions of source code must retain the copyright
-    notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the copyright
-    notice, this list of conditions and the following disclaimer in the
-    documentation and/or other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products
-    derived from this software without specific prior written permission.
- .
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-License: HIDAPI
- This software may be used by anyone for any reason so
- long as the copyright notice in the source files
- remains intact.
diff --git a/debian/docs b/debian/docs
deleted file mode 100644
index e845566..0000000
--- a/debian/docs
+++ /dev/null
@@ -1 +0,0 @@
-README
diff --git a/debian/gbp.conf b/debian/gbp.conf
deleted file mode 100644
index 2ae6b8a..0000000
--- a/debian/gbp.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[git-buildpackage]
-compression = gz
diff --git a/debian/libambit0-dev.install b/debian/libambit0-dev.install
deleted file mode 100644
index 41a1414..0000000
--- a/debian/libambit0-dev.install
+++ /dev/null
@@ -1 +0,0 @@
-usr/include/*
diff --git a/debian/libambit0.install b/debian/libambit0.install
deleted file mode 100644
index 3ddde58..0000000
--- a/debian/libambit0.install
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/*/lib*.so.*
diff --git a/debian/openambit.install b/debian/openambit.install
deleted file mode 100644
index 5e98487..0000000
--- a/debian/openambit.install
+++ /dev/null
@@ -1,4 +0,0 @@
-lib/udev/rules.d/99-suunto-ambit.rules
-usr/bin/openambit
-usr/share/applications/openambit.desktop
-usr/share/icons/
diff --git a/debian/patches/01_FixDesktopCategory b/debian/patches/01_FixDesktopCategory
deleted file mode 100644
index 0e3f58e..0000000
--- a/debian/patches/01_FixDesktopCategory
+++ /dev/null
@@ -1,10 +0,0 @@
-Index: git/src/openambit/deployment/openambit.desktop
-===================================================================
---- git.orig/src/openambit/deployment/openambit.desktop
-+++ git/src/openambit/deployment/openambit.desktop
-@@ -6,4 +6,4 @@
- TryExec=openambit
- Exec=openambit
- Icon=openambit
--Categories=Utility;SyncUtility
-+Categories=Education;Sports
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index 91b7180..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1 +0,0 @@
-01_FixDesktopCategory
diff --git a/debian/rules b/debian/rules
deleted file mode 100755
index 75ab07f..0000000
--- a/debian/rules
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/make -f
-# -*- makefile -*-
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
-CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
-CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
-LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
-
-%:
-	dh $@ 
-
-override_dh_auto_build:
-	mkdir libambit-build
-	cd libambit-build && cmake ../src/libambit -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} $(CFLAGS)" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} $(CXXFLAGS)"
-	cd libambit-build && $(MAKE) -j$(NUMCPUS)
-	mkdir openambit-build
-	cd openambit-build && cmake ../src/openambit -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} $(CFLAGS)" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} $(CXXFLAGS)"
-	cd openambit-build && $(MAKE) -j$(NUMCPUS)
-
-INSTDIR=../debian/tmp/
-override_dh_install:
-	cd libambit-build && $(MAKE) install DESTDIR=$(INSTDIR)
-	cd openambit-build && $(MAKE) install DESTDIR=$(INSTDIR)
-	pwd
-	ls -lR
-	dh_install
diff --git a/debian/source/format b/debian/source/format
deleted file mode 100644
index 163aaf8..0000000
--- a/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/src/example/ambitconsole.c b/src/example/ambitconsole.c
index 4fb6bd0..18a5ed1 100644
--- a/src/example/ambitconsole.c
+++ b/src/example/ambitconsole.c
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
         libambit_device_info_get(ambit_object, &info);
 
         if (libambit_device_supported(ambit_object)) {
-            printf("Device: %s, serial: %s, FW version: %d.%d.%d\n", info.name, info.serial, info.fw_version[0], info.fw_version[1], info.fw_version[2]);
+            printf("Device: %s, serial: %s, FW version: %d.%d.%d\n", info.name, info.serial, info.fw_version[0], info.fw_version[1], info.fw_version[2] | (info.fw_version[3] << 8));
 
             if (libambit_device_status_get(ambit_object, &status) == 0) {
                 printf("Current charge: %d%%\n", status.charge);
@@ -44,7 +44,7 @@ int main(int argc, char *argv[])
             libambit_log_read(ambit_object, log_skip_cb, log_data_cb, NULL, ambit_object);
         }
         else {
-            printf("Device: %s (fw_version: %d.%d.%d) is not supported yet!\n", info.name, info.fw_version[0], info.fw_version[1], info.fw_version[2]);
+            printf("Device: %s (fw_version: %d.%d.%d) is not supported yet!\n", info.name, info.fw_version[0], info.fw_version[1], info.fw_version[2] | (info.fw_version[3] << 8));
         }
 
         libambit_close(ambit_object);
diff --git a/src/libambit/libambit.c b/src/libambit/libambit.c
index b16a77c..a7a00eb 100644
--- a/src/libambit/libambit.c
+++ b/src/libambit/libambit.c
@@ -22,15 +22,23 @@
 #include "libambit.h"
 #include "libambit_int.h"
 
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
 /*
  * Local definitions
  */
 #define SUUNTO_USB_VENDOR_ID 0x1493
 
-struct ambit_supported_device_s {
+typedef struct ambit_known_device_s ambit_known_device_t;
+
+struct ambit_known_device_s {
     uint16_t vid;
     uint16_t pid;
     char *model;
@@ -45,13 +53,15 @@ struct ambit_supported_device_s {
  */
 static int device_info_get(ambit_object_t *object, ambit_device_info_t *info);
 static int lock_log(ambit_object_t *object, bool lock);
+static uint32_t version_number(const uint8_t version[4]);
 
 /*
  * Static variables
  */
-static ambit_supported_device_t supported_devices[] = {
+static ambit_known_device_t known_devices[] = {
     { SUUNTO_USB_VENDOR_ID, 0x001a, "Colibri", {0x01,0x01,0x02,0x00}, "Suunto Ambit2 S", true, 0x0400 },
     { SUUNTO_USB_VENDOR_ID, 0x0019, "Duck", {0x01,0x01,0x02,0x00}, "Suunto Ambit2", true, 0x0400 },
+    { SUUNTO_USB_VENDOR_ID, 0x001d, "Greentit", {0x00,0x00,0x00,0x00}, "Suunto Ambit2 R", true, 0x0400 },
     { SUUNTO_USB_VENDOR_ID, 0x001a, "Colibri", {0x00,0x02,0x03,0x00}, "Suunto Ambit2 S", false, 0x0400 },
     { SUUNTO_USB_VENDOR_ID, 0x0019, "Duck", {0x00,0x02,0x03,0x00}, "Suunto Ambit2", false, 0x0400 },
     { SUUNTO_USB_VENDOR_ID, 0x001a, "Colibri", {0x00,0x02,0x02,0x00}, "Suunto Ambit2 S (up to 0.2.2)", false, 0x0200 },
@@ -64,6 +74,8 @@ static ambit_supported_device_t supported_devices[] = {
     { 0x0000, 0x0000, NULL, {0x00,0x00,0x00,0x00}, NULL, false }
 };
 
+static uint8_t komposti_version[] = { 0x01, 0x08, 0x01, 0x00 };
+
 /*
  * Public functions
  */
@@ -73,19 +85,21 @@ ambit_object_t *libambit_detect(void)
     struct hid_device_info *devs, *cur_dev;
     ambit_object_t *ret_object = NULL;
     int i;
-    ambit_supported_device_t *device = NULL;
+    ambit_known_device_t *device = NULL;
+    char *path = NULL;
 
     LOG_INFO("Searching devices");
 
     devs = hid_enumerate(0x0, 0x0);
     cur_dev = devs;
     while (cur_dev) {
-        for (i=0; i<sizeof(supported_devices)/sizeof(supported_devices[0]); i++) {
-            LOG_INFO("vendor_id=%04x, product_id=%04x", cur_dev->vendor_id, cur_dev->product_id);
-            if (cur_dev->vendor_id == supported_devices[i].vid && cur_dev->product_id == supported_devices[i].pid) {
+        LOG_INFO("vendor_id=%04x, product_id=%04x", cur_dev->vendor_id, cur_dev->product_id);
+        for (i=0; i<sizeof(known_devices)/sizeof(known_devices[0]); i++) {
+            if (cur_dev->vendor_id == known_devices[i].vid && cur_dev->product_id == known_devices[i].pid) {
                 LOG_INFO("match!");
                 // Found at least one supported row, lets remember that!
-                device = &supported_devices[i];
+                device = &known_devices[i];
+                path = strdup (cur_dev->path);
                 break;
             }
         }
@@ -113,24 +127,18 @@ ambit_object_t *libambit_detect(void)
             // Get device info to resolve supported functionality
             if (device_info_get(ret_object, &ret_object->device_info) == 0) {
                 // Let's resolve the correct device
-                for (i=0; i<sizeof(supported_devices)/sizeof(supported_devices[0]); i++) {
-                    if (device->vid == supported_devices[i].vid &&
-                        device->pid == supported_devices[i].pid &&
-                        strncmp(device->model, ret_object->device_info.model, LIBAMBIT_MODEL_NAME_LENGTH) == 0 &&
-                        (ret_object->device_info.fw_version[0] > device->min_sw_version[0] ||
-                         (ret_object->device_info.fw_version[0] == device->min_sw_version[0] &&
-                          (ret_object->device_info.fw_version[1] > device->min_sw_version[1] ||
-                           (ret_object->device_info.fw_version[1] == device->min_sw_version[1] &&
-                            (ret_object->device_info.fw_version[2] > device->min_sw_version[2] ||
-                             (ret_object->device_info.fw_version[2] == device->min_sw_version[2] &&
-                              (ret_object->device_info.fw_version[3] >= device->min_sw_version[3])))))))) {
+                for (i=0; i<sizeof(known_devices)/sizeof(known_devices[0]); i++) {
+                    if (ret_object->vendor_id == known_devices[i].vid &&
+                        ret_object->product_id == known_devices[i].pid &&
+                        strncmp(ret_object->device_info.model, known_devices[i].model, LIBAMBIT_MODEL_NAME_LENGTH) == 0 &&
+                        (version_number (ret_object->device_info.fw_version) >= version_number (known_devices[i].min_sw_version))) {
                         // Found matching entry, reset to this one!
-                        device = &supported_devices[i];
+                        device = &known_devices[i];
                         break;
                     }
                 }
-                ret_object->device = device;
                 strncpy(ret_object->device_info.name, device->name, LIBAMBIT_PRODUCT_NAME_LENGTH);
+                ret_object->device_info.is_supported = device->supported;
 
                 // Initialize pmem
                 libambit_pmem20_init(ret_object, device->pmem20_chunksize);
@@ -144,10 +152,19 @@ ambit_object_t *libambit_detect(void)
             }
         }
         else {
+#ifdef DEBUG_PRINT_ERROR
+            int error = 0;
+            int fd = 0;
+            if (path) fd = open (path, O_RDWR);
+            if (-1 == fd) error = errno;
+            else close (fd);
+#endif
             LOG_ERROR("Failed to open device \"%s (%s)\"", device->name, device->model);
+            LOG_ERROR("Reason: %s", (error ? strerror(error) : "Unknown"));
         }
     }
 
+    if (path) free (path);
     return ret_object;
 }
 
@@ -170,8 +187,8 @@ bool libambit_device_supported(ambit_object_t *object)
 {
     bool ret = false;
 
-    if (object != NULL && object->device != NULL) {
-        ret = object->device->supported;
+    if (object != NULL) {
+        ret = object->device_info.is_supported;
     }
 
     return ret;
@@ -181,7 +198,7 @@ int libambit_device_info_get(ambit_object_t *object, ambit_device_info_t *info)
 {
     int ret = -1;
 
-    if (object != NULL && object->device != NULL) {
+    if (object != NULL) {
         if (info != NULL) {
             memcpy(info, &object->device_info, sizeof(ambit_device_info_t));
         }
@@ -280,7 +297,7 @@ int libambit_gps_orbit_header_read(ambit_object_t *object, uint8_t data[8])
     size_t replylen = 0;
     int ret = -1;
 
-    if (libambit_protocol_command(object, ambit_command_gps_orbit_head, NULL, 0, &reply_data, &replylen, 0) == 0 && replylen == 9) {
+    if (libambit_protocol_command(object, ambit_command_gps_orbit_head, NULL, 0, &reply_data, &replylen, 0) == 0 && replylen >= 9) {
         memcpy(data, &reply_data[1], 8);
         libambit_protocol_free(reply_data);
 
@@ -492,14 +509,13 @@ void libambit_log_entry_free(ambit_log_entry_t *log_entry)
 
 static int device_info_get(ambit_object_t *object, ambit_device_info_t *info)
 {
-    uint8_t send_data[] = { 0x01, 0x06, 0x14, 0x00 };
     uint8_t *reply_data = NULL;
     size_t replylen;
     int ret = -1;
 
     LOG_INFO("Reading device info");
 
-    if (libambit_protocol_command(object, ambit_command_device_info, send_data, sizeof(send_data), &reply_data, &replylen, 1) == 0) {
+    if (libambit_protocol_command(object, ambit_command_device_info, komposti_version, sizeof(komposti_version), &reply_data, &replylen, 1) == 0) {
         if (info != NULL) {
             memcpy(info->model, reply_data, 16);
             info->model[16] = 0;
@@ -511,7 +527,7 @@ static int device_info_get(ambit_object_t *object, ambit_device_info_t *info)
         ret = 0;
     }
     else {
-        LOG_WARNING("Failed to read log info");
+        LOG_WARNING("Failed to device info");
     }
 
     libambit_protocol_free(reply_data);
@@ -549,3 +565,10 @@ static int lock_log(ambit_object_t *object, bool lock)
     return ret;
 }
 
+static uint32_t version_number(const uint8_t version[4])
+{
+    return (  (version[0] << 24)
+            | (version[1] << 16)
+            | (version[2] <<  0)
+            | (version[3] <<  8));
+}
diff --git a/src/libambit/libambit.h b/src/libambit/libambit.h
index 570c0a3..28d7ef2 100644
--- a/src/libambit/libambit.h
+++ b/src/libambit/libambit.h
@@ -42,6 +42,7 @@ typedef struct ambit_device_info_s {
     char serial[LIBAMBIT_SERIAL_LENGTH+1];
     uint8_t fw_version[4];
     uint8_t hw_version[4];
+    bool is_supported;
 } ambit_device_info_t;
 
 typedef struct ambit_device_status_s {
@@ -309,7 +310,7 @@ typedef struct ambit_log_header_s {
     uint32_t heartrate_min_time;    /* ms */
     uint8_t  peak_training_effect;  /* effect scale 0.1 */
     uint8_t  activity_type;
-    char     activity_name[16];
+    char     activity_name[16+1];
     int16_t  temperature_max;       /* degree celsius scale 0.1 */
     int16_t  temperature_min;       /* degree celsius scale 0.1 */
     uint32_t temperature_max_time;  /* ms */
@@ -324,8 +325,11 @@ typedef struct ambit_log_header_s {
 
     uint8_t  unknown1[5];
     uint8_t  unknown2;
-    uint8_t  unknown3[6];
-    uint8_t  unknown4[8];
+    uint8_t  cadence_max;           /* rpm */
+    uint8_t  cadence_avg;           /* rpm */
+    uint8_t  unknown3[4];
+    uint32_t cadence_max_time;      /* ms */
+    uint8_t  unknown4[4];
     uint8_t  unknown5[4];
     uint8_t  unknown6[24];
 } ambit_log_header_t;
diff --git a/src/libambit/libambit_int.h b/src/libambit/libambit_int.h
index 4286859..f8d0a37 100644
--- a/src/libambit/libambit_int.h
+++ b/src/libambit/libambit_int.h
@@ -26,14 +26,11 @@
 #include "hidapi/hidapi.h"
 #include "libambit.h"
 
-typedef struct ambit_supported_device_s ambit_supported_device_t;
-
 struct ambit_object_s {
     hid_device *handle;
     uint16_t vendor_id;
     uint16_t product_id;
     uint16_t sequence_no;
-    ambit_supported_device_t *device;
     ambit_device_info_t device_info;
 
     struct {
diff --git a/src/libambit/pmem20.c b/src/libambit/pmem20.c
index b3646ea..5cd0e5d 100644
--- a/src/libambit/pmem20.c
+++ b/src/libambit/pmem20.c
@@ -379,6 +379,7 @@ int libambit_pmem20_log_parse_header(uint8_t *data, size_t datalen, ambit_log_he
     log_header->peak_training_effect = read8inc(data, &offset);
     log_header->activity_type = read8inc(data, &offset);
     memcpy(log_header->activity_name, data + offset, 16);
+    log_header->activity_name[16] = 0;
     offset += 16;
     log_header->heartrate_min = read8inc(data, &offset);
 
@@ -390,8 +391,11 @@ int libambit_pmem20_log_parse_header(uint8_t *data, size_t datalen, ambit_log_he
     log_header->samples_count = read32inc(data, &offset);
     log_header->energy_consumption = read16inc(data, &offset);
 
-    memcpy(log_header->unknown3, data+offset, 6);
-    offset += 6;
+    log_header->cadence_max = read8inc(data, &offset);
+    log_header->cadence_avg = read8inc(data, &offset);
+
+    memcpy(log_header->unknown3, data+offset, 4);
+    offset += 4;
 
     log_header->speed_max_time = read32inc(data, &offset);
     log_header->altitude_max_time = read32inc(data, &offset);
@@ -400,9 +404,10 @@ int libambit_pmem20_log_parse_header(uint8_t *data, size_t datalen, ambit_log_he
     log_header->heartrate_min_time = read32inc(data, &offset);
     log_header->temperature_max_time = read32inc(data, &offset);
     log_header->temperature_min_time = read32inc(data, &offset);
+    log_header->cadence_max_time = read32inc(data, &offset);
 
-    memcpy(log_header->unknown4, data+offset, 8);
-    offset += 8;
+    memcpy(log_header->unknown4, data+offset, 4);
+    offset += 4;
 
     log_header->first_fix_time = read16inc(data, &offset)*1000;
     log_header->battery_start = read8inc(data, &offset);
diff --git a/src/openambit/CMakeLists.txt b/src/openambit/CMakeLists.txt
index 9ce4fd1..51706d5 100644
--- a/src/openambit/CMakeLists.txt
+++ b/src/openambit/CMakeLists.txt
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 2.8.5)
 project (OPENAMBIT)
 
-set (OPENAMBIT_VERSION 0.2)
+set (OPENAMBIT_VERSION HEAD)
 
 # Where to lookup modules
 set(CMAKE_MODULE_PATH "${OPENAMBIT_SOURCE_DIR}/cmake")
@@ -12,7 +12,7 @@ find_package(Qt4 REQUIRED)
 find_package(libambit REQUIRED)
 find_package(UDev REQUIRED)
 find_package(ZLIB REQUIRED)
-find_package(QJSON REQUIRED)
+find_package(QJSON 0.8.0 REQUIRED)
 
 include(${QT_USE_FILE})
 include(GNUInstallDirs)
diff --git a/src/openambit/confirmbetadialog.ui b/src/openambit/confirmbetadialog.ui
index 58cfd65..95ad1b2 100644
--- a/src/openambit/confirmbetadialog.ui
+++ b/src/openambit/confirmbetadialog.ui
@@ -52,7 +52,7 @@ p, li { white-space: pre-wrap; }
 <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
 <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Please use this software at <span style=" text-decoration: underline;">your own</span> risk and only if you understand the risks involved.</p>
 <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you decide to use Openambit please consider <a href="https://sourceforge.net/p/openambit/tickets/"><span style=" text-decoration: underline; color:#0000ff;">reporting bugs</span></a> so we can make it better.</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you decide to use Openambit please consider <a href="https://github.com/openambitproject/openambit/issues/new"><span style=" text-decoration: underline; color:#0000ff;">reporting bugs</span></a> so we can make it better.</p>
 <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
 <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Thanks </p>
 <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier'; color:#008000;"><br /></p>
diff --git a/src/openambit/deployment/99-suunto-ambit.rules b/src/openambit/deployment/99-suunto-ambit.rules
index e45c05c..51b68de 100644
--- a/src/openambit/deployment/99-suunto-ambit.rules
+++ b/src/openambit/deployment/99-suunto-ambit.rules
@@ -11,3 +11,6 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="1493", ATTRS{idProduct}=="0019", MODE="0666
 
 # Colibri (a.k.a Suunto Ambit2 S)
 SUBSYSTEMS=="usb", ATTRS{idVendor}=="1493", ATTRS{idProduct}=="001a", MODE="0666"
+
+# Greentit (a.k.a Suunto Ambit2 R)
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="1493", ATTRS{idProduct}=="001d", MODE="0666"
diff --git a/src/openambit/deployment/openambit.desktop b/src/openambit/deployment/openambit.desktop
index ab454ca..ca75dc0 100644
--- a/src/openambit/deployment/openambit.desktop
+++ b/src/openambit/deployment/openambit.desktop
@@ -1,9 +1,9 @@
 [Desktop Entry]
-Version=0.2
+Version=HEAD
 Type=Application
 Name=Openambit
 Comment=Open source synchronization for Suunto Ambit series
 TryExec=openambit
 Exec=openambit
 Icon=openambit
-Categories=Utility;SyncUtility
+Categories=Utility;Education;Sports
diff --git a/src/openambit/logentry.cpp b/src/openambit/logentry.cpp
index 57131a6..351585f 100644
--- a/src/openambit/logentry.cpp
+++ b/src/openambit/logentry.cpp
@@ -136,3 +136,44 @@ LogEntry::~LogEntry()
 
     logEntry = NULL;
 }
+
+bool LogEntry::isUploaded(){
+    if (this->movescountId == NULL){
+        return false;
+    }
+    return true;
+}
+
+QString LogEntry::toHtml(){
+    QString log_html;
+
+    log_html += "<h1>" + QString(this->logEntry->header.activity_name) + "</h1>";
+    if (this->isUploaded()){
+        log_html += "<a href='http://www.movescount.com/moves/move" + this->movescountId + "'>see on movescount.com</a>";
+    }
+    else {
+        log_html += "Not uploaded yet";
+    }
+    log_html += "<h2>Details</h2>";
+    log_html += "<h4>" + this->time.toString() + "</h4>";
+    log_html += "<h4>Duration: " + QTime(0, 0, 0,0 ).addMSecs(this->logEntry->header.duration).toString("HH:mm:ss") + "</h4>";
+    log_html += "<h4>Distance: " + QString::number(this->logEntry->header.distance) + " m</h4>";
+    log_html += "<h2>Training values</h2>";
+    log_html += "<h4>Avg HR: " + QString::number(this->logEntry->header.heartrate_avg) + " bpm</h4>";
+    log_html += "<h4>Max HR: " + QString::number(this->logEntry->header.heartrate_max) + " bpm</h4>";
+    log_html += "<h4>Min HR: " + QString::number(this->logEntry->header.heartrate_min) + " bpm</h4>";
+    log_html += "<h4>PTE: " + QString::number(this->logEntry->header.peak_training_effect/10.0) + "</h4>";
+    log_html += "<h2>Device</h2>";
+    log_html += "<h4>Name: " + QString(this->deviceInfo->name) + "</h4>";
+    log_html += "<h4>Variant: " + QString(this->deviceInfo->model) + "</h4>";
+    log_html += "<h4>Serial: " + QString(this->deviceInfo->serial) + "</h4>";
+    //log_string += "Device info: " + QString::number(this->deviceInfo->fw_version) + "\n";
+    //log_string += "Device info: " + QString::number(this->deviceInfo->hw_version) + "\n";
+
+    //log_string += "Personal Settings: " + this->personalSettings + "\n";
+
+
+    return log_html;
+}
+
+
diff --git a/src/openambit/logentry.h b/src/openambit/logentry.h
index 73f08c4..7ed148f 100644
--- a/src/openambit/logentry.h
+++ b/src/openambit/logentry.h
@@ -34,6 +34,9 @@ public:
 
     LogEntry& operator=(const LogEntry &rhs);
 
+    QString toHtml();
+    bool isUploaded();
+
     QString device;
     QDateTime time;
     QString movescountId;
diff --git a/src/openambit/logstore.cpp b/src/openambit/logstore.cpp
index 0d9c9c2..12eb85d 100644
--- a/src/openambit/logstore.cpp
+++ b/src/openambit/logstore.cpp
@@ -562,6 +562,22 @@ void LogStore::XMLReader::readLogHeader()
                 }
             }
         }
+        else if (xml.name() == "Cadence") {
+            while (xml.readNextStartElement()) {
+                if (xml.name() == "Avg") {
+                    logEntry->logEntry->header.cadence_avg = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "Max") {
+                    logEntry->logEntry->header.cadence_max = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "MaxTime") {
+                    logEntry->logEntry->header.cadence_max_time = xml.readElementText().toUInt();
+                }
+                else {
+                    xml.skipCurrentElement();
+                }
+            }
+        }
         else if (xml.name() == "Altitude") {
             while (xml.readNextStartElement()) {
                 if (xml.name() == "Max") {
@@ -613,6 +629,7 @@ void LogStore::XMLReader::readLogHeader()
             QByteArray ba = xml.readElementText().toLocal8Bit();
             const char *c_str = ba.data();
             strncpy(logEntry->logEntry->header.activity_name, c_str, 16);
+            logEntry->logEntry->header.activity_name[16] = 0;
         }
         else if (xml.name() == "Temperature") {
             while (xml.readNextStartElement()) {
@@ -670,7 +687,14 @@ void LogStore::XMLReader::readLogHeader()
         else if (xml.name() == "Unknown3") {
             QByteArray val = xml.readElementText().toLocal8Bit();
             const char *c_str = val.data();
-            for (int i=0; i<6 && i<val.length()/2; i++) {
+            // Handle previously unknown cadence data
+            if (val.length() == 12) {
+                sscanf(c_str, "%2hhx", &logEntry->logEntry->header.cadence_max);
+                c_str += 2 * sizeof(char);
+                sscanf(c_str, "%2hhx", &logEntry->logEntry->header.cadence_avg);
+                c_str += 2 * sizeof(char);
+            }
+            for (int i=0; i<4 && i<val.length()/2; i++) {
                 sscanf(c_str, "%2hhx", &logEntry->logEntry->header.unknown3[i]);
                 c_str += 2 * sizeof(char);
             }
@@ -678,7 +702,18 @@ void LogStore::XMLReader::readLogHeader()
         else if (xml.name() == "Unknown4") {
             QByteArray val = xml.readElementText().toLocal8Bit();
             const char *c_str = val.data();
-            for (int i=0; i<8 && i<val.length()/2; i++) {
+            // Handle previously unknown cadence data
+            if (val.length() == 16) {
+                uint32_t cadence_max_time = 0;
+                uint8_t tmpval;
+                for (int i=0; i<4; i++) {
+                    sscanf(c_str, "%2hhx", &tmpval);
+                    cadence_max_time |= (tmpval << (8*(3-i)));
+                    c_str += 2 * sizeof(char);
+                }
+                logEntry->logEntry->header.cadence_max_time = cadence_max_time;
+            }
+            for (int i=0; i<4 && i<val.length()/2; i++) {
                 sscanf(c_str, "%2hhx", &logEntry->logEntry->header.unknown4[i]);
                 c_str += 2 * sizeof(char);
             }
@@ -1316,6 +1351,11 @@ bool LogStore::XMLWriter::writeLogEntry()
     xml.writeTextElement("Max", QString("%1").arg(logEntry->header.speed_max));
     xml.writeTextElement("MaxTime", QString("%1").arg(logEntry->header.speed_max_time));
     xml.writeEndElement();
+    xml.writeStartElement("Cadence");
+    xml.writeTextElement("Avg", QString("%1").arg(logEntry->header.cadence_avg));
+    xml.writeTextElement("Max", QString("%1").arg(logEntry->header.cadence_max));
+    xml.writeTextElement("MaxTime", QString("%1").arg(logEntry->header.cadence_max_time));
+    xml.writeEndElement();
     xml.writeStartElement("Altitude");
     xml.writeTextElement("Max", QString("%1").arg(logEntry->header.altitude_max));
     xml.writeTextElement("Min", QString("%1").arg(logEntry->header.altitude_min));
@@ -1355,21 +1395,15 @@ bool LogStore::XMLWriter::writeLogEntry()
     xml.writeTextElement("Unknown1", hexstring);
     hexstring = hexstring.sprintf("%02x", logEntry->header.unknown2);
     xml.writeTextElement("Unknown2", hexstring);
-    hexstring = hexstring.sprintf("%02x%02x%02x%02x%02x%02x", logEntry->header.unknown3[0],
-                                                              logEntry->header.unknown3[1],
-                                                              logEntry->header.unknown3[2],
-                                                              logEntry->header.unknown3[3],
-                                                              logEntry->header.unknown3[4],
-                                                              logEntry->header.unknown3[5]);
+    hexstring = hexstring.sprintf("%02x%02x%02x%02x", logEntry->header.unknown3[0],
+                                                      logEntry->header.unknown3[1],
+                                                      logEntry->header.unknown3[2],
+                                                      logEntry->header.unknown3[3]);
     xml.writeTextElement("Unknown3", hexstring);
-    hexstring = hexstring.sprintf("%02x%02x%02x%02x%02x%02x%02x%02x", logEntry->header.unknown4[0],
-                                                                      logEntry->header.unknown4[1],
-                                                                      logEntry->header.unknown4[2],
-                                                                      logEntry->header.unknown4[3],
-                                                                      logEntry->header.unknown4[4],
-                                                                      logEntry->header.unknown4[5],
-                                                                      logEntry->header.unknown4[6],
-                                                                      logEntry->header.unknown4[7]);
+    hexstring = hexstring.sprintf("%02x%02x%02x%02x", logEntry->header.unknown4[0],
+                                                      logEntry->header.unknown4[1],
+                                                      logEntry->header.unknown4[2],
+                                                      logEntry->header.unknown4[3]);
     xml.writeTextElement("Unknown4", hexstring);
     hexstring = hexstring.sprintf("%02x%02x%02x%02x", logEntry->header.unknown5[0],
                                                       logEntry->header.unknown5[1],
diff --git a/src/openambit/main.cpp b/src/openambit/main.cpp
index 696f026..3b73ed7 100644
--- a/src/openambit/main.cpp
+++ b/src/openambit/main.cpp
@@ -37,9 +37,6 @@ int main(int argc, char *argv[])
     QCoreApplication::setApplicationVersion(APP_VERSION);
     QCoreApplication::setOrganizationName("Openambit");
     QCoreApplication::setApplicationName("Openambit");
-#ifdef Q_WS_X11
-    QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QString(getenv("HOME")) + "/.openambit/openambit.conf");
-#endif
 
     MainWindow w;
 
diff --git a/src/openambit/mainwindow.cpp b/src/openambit/mainwindow.cpp
index 13aa1b4..714e471 100644
--- a/src/openambit/mainwindow.cpp
+++ b/src/openambit/mainwindow.cpp
@@ -134,7 +134,7 @@ void MainWindow::singleApplicationMsgRecv(QString msg)
 {
     if (msg == "focus") {
         // Another instance of application has asked use to gain focus, let's do so!
-        if (isHidden()) {
+        if (sysTraySupported() && isHidden()) {
             showHideWindow();
         }
         else {
@@ -147,7 +147,7 @@ void MainWindow::singleApplicationMsgRecv(QString msg)
 void MainWindow::changeEvent(QEvent *event)
 {
     if (event->type() == QEvent::WindowStateChange) {
-        if (isMinimized()) {
+        if (sysTraySupported() && isMinimized()) {
             QTimer::singleShot(0, this, SLOT(hide()));
         }
     }
@@ -168,7 +168,7 @@ void MainWindow::hideEvent(QHideEvent *event)
 
 void MainWindow::closeEvent(QCloseEvent *event)
 {
-    if (forceClose) {
+    if (!sysTraySupported() || forceClose) {
         trayIcon->setVisible(false);
         event->accept();
     }
@@ -186,7 +186,7 @@ void MainWindow::closeRequested()
 
 void MainWindow::showHideWindow()
 {
-    if (isHidden()) {
+    if (!sysTraySupported() || isHidden()) {
         showNormal();
     }
     else {
@@ -213,7 +213,7 @@ void MainWindow::showAbout()
 {
     QMessageBox::about(this, tr("About %1").arg(QCoreApplication::applicationName()),
                        tr("<h2>%1</h2><b>Version %2</b><br />Using Qt %3").arg(QCoreApplication::applicationName()).arg(QCoreApplication::applicationVersion()).arg(QString(qVersion())) +
-                       "<br /><br /><a href=\"http://sourceforge.net/projects/openambit\">http://sourceforge.net/projects/openambit</a>");
+                       "<br /><br /><a href=\"http://openambit.org/\">http://openambit.org</a>");
 }
 
 void MainWindow::settingsSaved()
@@ -382,6 +382,7 @@ void MainWindow::logItemSelected(QListWidgetItem *current,QListWidgetItem *previ
 
     if (current != NULL) {
         logEntry = logStore.read(current->data(Qt::UserRole).toString());
+        ui->logDetail->setHtml(logEntry->toHtml());
 
         delete logEntry;
     }
@@ -418,7 +419,7 @@ void MainWindow::updateLogList()
         QListWidgetItem *item = new QListWidgetItem(entry.time.toString());
         item->setText(entry.time.toString());
         item->setData(Qt::UserRole, QVariant(entry.filename));
-        ui->logsList->addItem(item);
+        ui->logsList->insertItem(0, item);
     }
 }
 
@@ -485,6 +486,11 @@ void MainWindow::movesCountSetup()
     settings.endGroup();
 }
 
+bool MainWindow::sysTraySupported()
+{
+    return QSystemTrayIcon::isSystemTrayAvailable();
+}
+
 MainWindow::LogMessageRow::LogMessageRow(QWidget *parent) :
     QHBoxLayout(parent)
 {
diff --git a/src/openambit/mainwindow.h b/src/openambit/mainwindow.h
index 496ca51..40c871b 100644
--- a/src/openambit/mainwindow.h
+++ b/src/openambit/mainwindow.h
@@ -87,6 +87,8 @@ private:
 
     void movesCountSetup();
 
+    bool sysTraySupported();
+
     Ui::MainWindow *ui;
     bool forceClose;
 
diff --git a/src/openambit/mainwindow.ui b/src/openambit/mainwindow.ui
index 4308c32..83f0215 100644
--- a/src/openambit/mainwindow.ui
+++ b/src/openambit/mainwindow.ui
@@ -30,17 +30,11 @@
      </widget>
     </item>
     <item>
-     <spacer name="horizontalSpacer">
-      <property name="orientation">
-       <enum>Qt::Horizontal</enum>
+     <widget class="QTextBrowser" name="logDetail">
+      <property name="openExternalLinks">
+       <bool>true</bool>
       </property>
-      <property name="sizeHint" stdset="0">
-       <size>
-        <width>40</width>
-        <height>20</height>
-       </size>
-      </property>
-     </spacer>
+     </widget>
     </item>
     <item>
      <widget class="QWidget" name="deviceSyncWidget" native="true">
@@ -337,7 +331,7 @@
      <x>0</x>
      <y>0</y>
      <width>872</width>
-     <height>21</height>
+     <height>25</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuOpenambit">
diff --git a/src/openambit/movescount/movescountjson.cpp b/src/openambit/movescount/movescountjson.cpp
index c6450c4..bbb30b7 100644
--- a/src/openambit/movescount/movescountjson.cpp
+++ b/src/openambit/movescount/movescountjson.cpp
@@ -233,7 +233,7 @@ int MovesCountJSON::generateLogData(LogEntry *logEntry, QByteArray &output)
     content.insert("ActivityID", logEntry->logEntry->header.activity_type);
     content.insert("AscentAltitude", (double)logEntry->logEntry->header.ascent);
     content.insert("AscentTime", (double)logEntry->logEntry->header.ascent_time/1000.0);
-    content.insert("AvgCadence", QVariant::Invalid);
+    content.insert("AvgCadence", logEntry->logEntry->header.cadence_avg);
     content.insert("AvgHR", logEntry->logEntry->header.heartrate_avg);
     content.insert("AvgSpeed", (double)logEntry->logEntry->header.speed_avg/3600.0);
     content.insert("DescentAltitude", (double)logEntry->logEntry->header.descent);
@@ -261,11 +261,15 @@ int MovesCountJSON::generateLogData(LogEntry *logEntry, QByteArray &output)
     if (logEntry->logEntry->header.altitude_min >= -1000 && logEntry->logEntry->header.altitude_min <= 10000)
         content.insert("LowAltitude", (double)logEntry->logEntry->header.altitude_min);
     content.insert("Marks", marksContent);
-    content.insert("MaxCadence", QVariant::Invalid);
+    content.insert("MaxCadence", logEntry->logEntry->header.cadence_max);
     content.insert("MaxSpeed", (double)logEntry->logEntry->header.speed_max/3600.0);
-    content.insert("MaxTemp", (double)logEntry->logEntry->header.temperature_max/10.0);
+    if (logEntry->logEntry->header.temperature_max >= -1000 && logEntry->logEntry->header.temperature_max <= 1000) {
+        content.insert("MaxTemp", (double)logEntry->logEntry->header.temperature_max/10.0);
+    }
     content.insert("MinHR", logEntry->logEntry->header.heartrate_min);
-    content.insert("MinTemp", (double)logEntry->logEntry->header.temperature_min/10.0);
+    if (logEntry->logEntry->header.temperature_min >= -1000 && logEntry->logEntry->header.temperature_min <= 1000) {
+        content.insert("MinTemp", (double)logEntry->logEntry->header.temperature_min/10.0);
+    }
     content.insert("PeakHR", logEntry->logEntry->header.heartrate_max);
     content.insert("PeakTrainingEffect", (double)logEntry->logEntry->header.peak_training_effect/10.0);
     content.insert("RecoveryTime", (double)logEntry->logEntry->header.recovery_time/1000.0);
@@ -360,7 +364,9 @@ bool MovesCountJSON::writePeriodicSample(ambit_log_sample_t *sample, QVariantMap
             }
             break;
         case ambit_log_sample_periodic_type_temperature:
-            output.insert("Temperature", (double)value->u.temperature/10.0);
+            if (value->u.temperature >= -1000 && value->u.temperature <= 1000) {
+                output.insert("Temperature", (double)value->u.temperature/10.0);
+            }
             break;
         case ambit_log_sample_periodic_type_charge:
             if (value->u.charge <= 100) {
diff --git a/src/openambit/movescount/movescountxml.cpp b/src/openambit/movescount/movescountxml.cpp
index b23b6e2..523bfd1 100644
--- a/src/openambit/movescount/movescountxml.cpp
+++ b/src/openambit/movescount/movescountxml.cpp
@@ -217,9 +217,10 @@ bool MovesCountXML::XMLWriter::writeLogEntry()
     xml.writeTextElement("Max", QString::number((double)logEntry->logEntry->header.speed_max/3600.0, 'g', 16));
     xml.writeTextElement("MaxTime", QString::number((double)logEntry->logEntry->header.speed_max_time/1000.0, 'g', 16));
     xml.writeEndElement();
-    // We have no idea about cadence yet, but we better include an empty tag!
     xml.writeStartElement("Cadence");
-    xml.writeTextElement("MaxTime", QString::number(0));
+    xml.writeTextElement("Avg", QString::number((double)logEntry->logEntry->header.cadence_avg/60.0, 'g', 16));
+    xml.writeTextElement("Max", QString::number((double)logEntry->logEntry->header.cadence_max/60.0, 'g', 16));
+    xml.writeTextElement("MaxTime", QString::number((double)logEntry->logEntry->header.cadence_max_time/1000.0, 'g', 16));
     xml.writeEndElement();
     xml.writeStartElement("Altitude");
     xml.writeTextElement("Max", QString("%1").arg(logEntry->logEntry->header.altitude_max));
diff --git a/wireshark_dissector/AUTHORS b/wireshark_dissector/AUTHORS
index c6b30e1..8d78de5 100644
--- a/wireshark_dissector/AUTHORS
+++ b/wireshark_dissector/AUTHORS
@@ -1,2 +1,2 @@
 Author:
-Emil Ljungdahl <emil at kratern.se>
+Emil Ljungdahl <emil at openambit.org>
diff --git a/wireshark_dissector/ambit-dissector.c b/wireshark_dissector/ambit-dissector.c
index 712ccb2..e9e5e77 100644
--- a/wireshark_dissector/ambit-dissector.c
+++ b/wireshark_dissector/ambit-dissector.c
@@ -10,8 +10,8 @@
 typedef struct ambit_reassembly_entry {
     guint8 valid;
     guint32 command;
-    guint32 start_frame;
-    guint32 frame_count;
+    guint32 frame_index;
+    guint32 frame_total;
     guint32 size;
     unsigned char *data;
     guint32 log_entry_size;
@@ -71,16 +71,19 @@ static int hf_ambit_unknown = -1;
 static int hf_ambit_date = -1;
 static int hf_ambit_time = -1;
 static int hf_ambit_charge = -1;
+static int hf_ambit_komposti_version = -1;
 static int hf_ambit_model = -1;
 static int hf_ambit_serial = -1;
 static int hf_ambit_fw_version = -1;
 static int hf_ambit_hw_version = -1;
+static int hf_ambit_bsl_version = -1;
 static int hf_ambit_personal_compass_declination = -1;
 static int hf_ambit_personal_map_orientation = -1;
 static int hf_ambit_personal_date_format = -1;
 static int hf_ambit_personal_time_format = -1;
-static int hf_ambit_personal_coordinate_system = -1;
 static int hf_ambit_personal_unit_system = -1;
+static int hf_ambit_personal_coordinate_system = -1;
+static int hf_ambit_personal_language = -1;
 static int hf_ambit_personal_alarm_enable = -1;
 static int hf_ambit_personal_alarm_time = -1;
 static int hf_ambit_personal_dual_time = -1;
@@ -128,6 +131,8 @@ static int hf_ambit_log_header_temp_min = -1;
 static int hf_ambit_log_header_distance = -1;
 static int hf_ambit_log_header_sample_count = -1;
 static int hf_ambit_log_header_energy = -1;
+static int hf_ambit_log_header_cadence_max = -1;
+static int hf_ambit_log_header_cadence_avg = -1;
 static int hf_ambit_log_header_speed_max_time = -1;
 static int hf_ambit_log_header_alt_max_time = -1;
 static int hf_ambit_log_header_alt_min_time = -1;
@@ -135,6 +140,7 @@ static int hf_ambit_log_header_hr_max_time = -1;
 static int hf_ambit_log_header_hr_min_time = -1;
 static int hf_ambit_log_header_temp_max_time = -1;
 static int hf_ambit_log_header_temp_min_time = -1;
+static int hf_ambit_log_header_cadence_max_time = -1;
 static int hf_ambit_log_header_time_first_fix = -1;
 static int hf_ambit_log_header_battery_start = -1;
 static int hf_ambit_log_header_battery_stop = -1;
@@ -168,7 +174,7 @@ static int hf_ambit_log_sample_periodic_time = -1;
 static int hf_ambit_log_sample_periodic_altitude = -1;
 static int hf_ambit_log_sample_periodic_energy = -1;
 static int hf_ambit_log_sample_periodic_temp = -1;
-static int hf_ambit_log_sample_periodic_preassure = -1;
+static int hf_ambit_log_sample_periodic_pressure = -1;
 static int hf_ambit_log_sample_periodic_vert_speed = -1;
 
 static int hf_ambit_log_other_time_offset = -1;
@@ -210,7 +216,7 @@ static int hf_ambit_log_distance_source_type = -1;
 
 static int hf_ambit_log_altitude_source_type = -1;
 static int hf_ambit_log_altitude_source_altitude_offset = -1;
-static int hf_ambit_log_altitude_source_preassure_offset = -1;
+static int hf_ambit_log_altitude_source_pressure_offset = -1;
 
 static int hf_ambit_log_ibi = -1;
 
@@ -252,7 +258,7 @@ static const value_string log_samples_spec_type_vals[] = {
     { 0x0c, "Altitude" },
     { 0x0e, "Energy consumption" },
     { 0x0f, "Temperature" },
-    { 0x18, "Preassure" },
+    { 0x18, "Pressure" },
     { 0x19, "Vertical speed" },
     { 0, NULL }
 };
@@ -274,7 +280,7 @@ static const value_string log_samples_distance_source_type_vals[] = {
 };
 
 static const value_string log_samples_altitude_source_type_vals[] = {
-    { 0x04, "Preassure" },
+    { 0x04, "Pressure" },
     { 0, NULL }
 };
 
@@ -379,13 +385,24 @@ static gint dissect_ambit_status_reply(tvbuff_t *tvb, packet_info *pinfo, proto_
 
 static gint dissect_ambit_device_info_get(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
 {
+    guint8 kv1, kv2;
+    guint16 kv3;
+    gint offset = 0;
+    kv1 = tvb_get_guint8(tvb, offset);
+    kv2 = tvb_get_guint8(tvb, offset+1);
+    kv3 = tvb_get_letohs(tvb, offset+2);
+    proto_tree_add_string_format_value(tree, hf_ambit_komposti_version, tvb, offset, 4, "Komposti version", "%d.%d.%d", kv1, kv2, kv3);
+    offset +=4;
 }
 
 static gint dissect_ambit_device_info_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
 {
-    guint8 fw1,fw2,fw3;
+    guint8 fw1,fw2;
+    guint16 fw3;
     guint8 hw1,hw2;
     guint16 hw3;
+    guint8 bv1,bv2;
+    guint16 bv3;
     gint offset = 0;
     proto_tree_add_item(tree, hf_ambit_model, tvb, offset, 16, ENC_LITTLE_ENDIAN);
     offset += 16;
@@ -393,17 +410,21 @@ static gint dissect_ambit_device_info_reply(tvbuff_t *tvb, packet_info *pinfo, p
     offset += 16;
     fw1 = tvb_get_guint8(tvb, offset);
     fw2 = tvb_get_guint8(tvb, offset+1);
-    fw3 = tvb_get_guint8(tvb, offset+2);
-    proto_tree_add_string_format_value(tree, hf_ambit_fw_version, tvb, offset, 3, "FW version", "%d.%d.%d", fw1, fw2, fw3);
-    offset += 3;
-    offset += 1;
+    fw3 = tvb_get_letohs(tvb, offset+2);
+    proto_tree_add_string_format_value(tree, hf_ambit_fw_version, tvb, offset, 4, "FW version", "%d.%d.%d", fw1, fw2, fw3);
+    offset += 4;
     hw1 = tvb_get_guint8(tvb, offset);
     hw2 = tvb_get_guint8(tvb, offset+1);
     hw3 = tvb_get_letohs(tvb, offset+2);
     proto_tree_add_string_format_value(tree, hf_ambit_hw_version, tvb, offset, 4, "HW version", "%d.%d.%d", hw1, hw2, hw3);
     offset += 4;
-    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 8);
-    offset += 8;
+    bv1 = tvb_get_guint8(tvb, offset);
+    bv2 = tvb_get_guint8(tvb, offset+1);
+    bv3 = tvb_get_letohs(tvb, offset+2);
+    proto_tree_add_string_format_value(tree, hf_ambit_bsl_version, tvb, offset, 4, "BSL version", "%d.%d.%d", bv1, bv2, bv3);
+    offset += 4;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 4);
+    offset += 4;
 }
 
 static gint dissect_ambit_personal_settings_get(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
@@ -412,11 +433,15 @@ static gint dissect_ambit_personal_settings_get(tvbuff_t *tvb, packet_info *pinf
 
 static gint dissect_ambit_personal_settings_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
 {
-    gint offset = 1;
+    gint offset = 0;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 1);
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_lock_sports_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 2;
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_lock_time_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 4;
+    offset += 1;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 1);
+    offset += 1;
     guint8 declination_direction = tvb_get_guint8(tvb, offset);
     guint8 declination_deg = tvb_get_guint8(tvb, offset + 1);
     if (declination_direction == 0) {
@@ -425,58 +450,75 @@ static gint dissect_ambit_personal_settings_reply(tvbuff_t *tvb, packet_info *pi
     else {
         proto_tree_add_string_format_value(tree, hf_ambit_personal_compass_declination, tvb, offset, 2, "Compass declination", "%s %f", declination_direction == 1 ? "E" : "W", 0.5*declination_deg);
     }
-    offset = 8;
-    proto_tree_add_item(tree, hf_ambit_personal_unit_system, tvb, offset, 8, ENC_LITTLE_ENDIAN);
-    offset = 19;
+    offset += 2;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 2);
+    offset += 2;
+    proto_tree_add_item(tree, hf_ambit_personal_unit_system, tvb, offset, 11, ENC_LITTLE_ENDIAN);
+    offset += 11;
     proto_tree_add_item(tree, hf_ambit_personal_coordinate_system, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 21;
+    offset += 1;
+    proto_tree_add_item(tree, hf_ambit_personal_language, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_map_orientation, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 24;
+    offset += 1;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 2);
+    offset += 2;
     proto_tree_add_item(tree, hf_ambit_personal_gps_sync_time, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 25;
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_time_format, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 26;
+    offset += 1;
     guint8 alarm_hour = tvb_get_guint8(tvb, offset);
     guint8 alarm_minute = tvb_get_guint8(tvb, offset + 1);
     proto_tree_add_string_format_value(tree, hf_ambit_personal_alarm_time, tvb, offset, 2, "Alarm time", "%d:%d", alarm_hour, alarm_minute);
-    offset = 28;
+    offset += 2;
     proto_tree_add_item(tree, hf_ambit_personal_alarm_enable, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 31;
+    offset += 1;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 2);
+    offset += 2;
     guint8 dual_hour = tvb_get_guint8(tvb, offset);
     guint8 dual_minute = tvb_get_guint8(tvb, offset + 1);
     proto_tree_add_string_format_value(tree, hf_ambit_personal_dual_time, tvb, offset, 2, "Dual time", "%d:%d", dual_hour, dual_minute);
-    offset = 36;
+    offset += 2;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 3);
+    offset += 3;
     proto_tree_add_item(tree, hf_ambit_personal_date_format, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 40;
+    offset += 1;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 3);
+    offset += 3;
     proto_tree_add_item(tree, hf_ambit_personal_tones, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 44;
+    offset += 1;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 3);
+    offset += 3;
     proto_tree_add_item(tree, hf_ambit_personal_backlight_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 45;
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_backlight_brightness, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 46;
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_display_contrast, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 47;
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_invert_display, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 48;
+    offset += 1;
     guint16 weight = tvb_get_letohs(tvb, offset);
     proto_tree_add_float(tree, hf_ambit_personal_weight, tvb, offset, 2, ((float)weight)/100);
-    offset = 50;
+    offset += 2;
     proto_tree_add_item(tree, hf_ambit_personal_birthyear, tvb, offset, 2, ENC_LITTLE_ENDIAN); 
-    offset = 52;
+    offset += 2;
     proto_tree_add_item(tree, hf_ambit_personal_max_hb, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 53;
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_rest_hb, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 54;
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_fitness_level, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 55;
+    offset += 1;
     guint8 sex = tvb_get_guint8(tvb, offset);
     proto_tree_add_string_format_value(tree, hf_ambit_personal_sex, tvb, offset, 1, "Is male", "%s", sex == 1 ? "true" : "false");
-    offset = 56;
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 60;
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_alti_baro_profile, tvb, offset, 1, ENC_LITTLE_ENDIAN);
-    offset = 62;
+    offset += 1;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 1);
+    offset += 1;
     proto_tree_add_item(tree, hf_ambit_personal_alti_baro_fused_alti, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+    offset += 1;
 }
 
 static gint dissect_ambit_log_header_get(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
@@ -559,8 +601,12 @@ static gint dissect_ambit_log_header_reply(tvbuff_t *tvb, packet_info *pinfo, pr
         offset += 4;
         proto_tree_add_item(tree, hf_ambit_log_header_energy, tvb, offset, 2, ENC_LITTLE_ENDIAN);
         offset += 2;
-        dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 6);
-        offset += 6;
+        proto_tree_add_item(tree, hf_ambit_log_header_cadence_max, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+        offset += 1;
+        proto_tree_add_item(tree, hf_ambit_log_header_cadence_avg, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+        offset += 1;
+        dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 4);
+        offset += 4;
         proto_tree_add_item(tree, hf_ambit_log_header_speed_max_time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
         offset += 4;
         proto_tree_add_item(tree, hf_ambit_log_header_alt_max_time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
@@ -575,8 +621,10 @@ static gint dissect_ambit_log_header_reply(tvbuff_t *tvb, packet_info *pinfo, pr
         offset += 4;
         proto_tree_add_item(tree, hf_ambit_log_header_temp_min_time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
         offset += 4;
-        dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 8);
-        offset += 8;
+        proto_tree_add_item(tree, hf_ambit_log_header_cadence_max_time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
+        offset += 4;
+        dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 4);
+        offset += 4;
         proto_tree_add_item(tree, hf_ambit_log_header_time_first_fix, tvb, offset, 2, ENC_LITTLE_ENDIAN);
         offset += 2;
         proto_tree_add_item(tree, hf_ambit_log_header_battery_start, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -646,8 +694,11 @@ static gint dissect_ambit_log_count_get(tvbuff_t *tvb, packet_info *pinfo, proto
 
 static gint dissect_ambit_log_count_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
 {
-    dissect_ambit_add_unknown(tvb, pinfo, tree, 0, 2);
-    proto_tree_add_item(tree, hf_ambit_log_count, tvb, 2, 2, ENC_LITTLE_ENDIAN);
+    gint offset = 0;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 2);
+    offset += 2;
+    proto_tree_add_item(tree, hf_ambit_log_count, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+    offset += 2;
 }
 
 static gint dissect_ambit_log_header_unwind_get(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
@@ -656,7 +707,9 @@ static gint dissect_ambit_log_header_unwind_get(tvbuff_t *tvb, packet_info *pinf
 
 static gint dissect_ambit_log_header_unwind_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
 {
-    proto_tree_add_item(tree, hf_ambit_log_header_more, tvb, 0, 4, ENC_LITTLE_ENDIAN);
+    gint offset = 0;
+    proto_tree_add_item(tree, hf_ambit_log_header_more, tvb, offset, 4, ENC_LITTLE_ENDIAN);
+    offset += 4;
 }
 
 static gint dissect_ambit_log_header_peek_get(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
@@ -665,7 +718,9 @@ static gint dissect_ambit_log_header_peek_get(tvbuff_t *tvb, packet_info *pinfo,
 
 static gint dissect_ambit_log_header_peek_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
 {
-    proto_tree_add_item(tree, hf_ambit_log_header_more, tvb, 0, 4, ENC_LITTLE_ENDIAN);
+    gint offset = 0;
+    proto_tree_add_item(tree, hf_ambit_log_header_more, tvb, offset, 4, ENC_LITTLE_ENDIAN);
+    offset += 4;
 }
 
 static gint dissect_ambit_log_header_step_get(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
@@ -674,7 +729,9 @@ static gint dissect_ambit_log_header_step_get(tvbuff_t *tvb, packet_info *pinfo,
 
 static gint dissect_ambit_log_header_step_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
 {
-    proto_tree_add_item(tree, hf_ambit_log_header_more, tvb, 0, 4, ENC_LITTLE_ENDIAN);
+    gint offset = 0;
+    proto_tree_add_item(tree, hf_ambit_log_header_more, tvb, offset, 4, ENC_LITTLE_ENDIAN);
+    offset += 4;
 }
 
 static gint dissect_ambit_log_data_get(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
@@ -860,9 +917,15 @@ static gint dissect_ambit_log_data_content(tvbuff_t *tvb, packet_info *pinfo, pr
     if (offset + 2 >= length) return offset;
     proto_tree_add_item(tree, hf_ambit_log_header_energy, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
-    if (offset + 6 >= length) return offset;
-    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 6);
-    offset += 6;
+    if (offset + 1 >= length) return offset;
+    proto_tree_add_item(tree, hf_ambit_log_header_cadence_max, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+    offset += 1;
+    if (offset + 1 >= length) return offset;
+    proto_tree_add_item(tree, hf_ambit_log_header_cadence_avg, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+    offset += 1;
+    if (offset + 4 >= length) return offset;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 4);
+    offset += 4;
     if (offset + 4 >= length) return offset;
     proto_tree_add_item(tree, hf_ambit_log_header_speed_max_time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
     offset += 4;
@@ -884,9 +947,12 @@ static gint dissect_ambit_log_data_content(tvbuff_t *tvb, packet_info *pinfo, pr
     if (offset + 4 >= length) return offset;
     proto_tree_add_item(tree, hf_ambit_log_header_temp_min_time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
     offset += 4;
-    if (offset + 8 >= length) return offset;
-    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 8);
-    offset += 8;
+    if (offset + 4 >= length) return offset;
+    proto_tree_add_item(tree, hf_ambit_log_header_cadence_max_time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
+    offset += 4;
+    if (offset + 4 >= length) return offset;
+    dissect_ambit_add_unknown(tvb, pinfo, tree, offset, 4);
+    offset += 4;
     if (offset + 2 >= length) return offset;
     proto_tree_add_item(tree, hf_ambit_log_header_time_first_fix, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
@@ -1069,7 +1135,7 @@ static gint dissect_ambit_log_data_sample(tvbuff_t *tvb, packet_info *pinfo, pro
                 proto_tree_add_item(sample_tree, hf_ambit_log_sample_periodic_temp, tvb, offset + spec_offset, spec_len, ENC_LITTLE_ENDIAN);
                 break;
               case 0x18:
-                proto_tree_add_item(sample_tree, hf_ambit_log_sample_periodic_preassure, tvb, offset + spec_offset, spec_len, ENC_LITTLE_ENDIAN);
+                proto_tree_add_item(sample_tree, hf_ambit_log_sample_periodic_pressure, tvb, offset + spec_offset, spec_len, ENC_LITTLE_ENDIAN);
                 break;
               case 0x19:
                 proto_tree_add_item(sample_tree, hf_ambit_log_sample_periodic_vert_speed, tvb, offset + spec_offset, spec_len, ENC_LITTLE_ENDIAN);
@@ -1198,7 +1264,7 @@ static gint dissect_ambit_log_data_sample(tvbuff_t *tvb, packet_info *pinfo, pro
             offset += 1;
             proto_tree_add_item(sample_tree, hf_ambit_log_altitude_source_altitude_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
             offset += 2;
-            proto_tree_add_item(sample_tree, hf_ambit_log_altitude_source_preassure_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+            proto_tree_add_item(sample_tree, hf_ambit_log_altitude_source_pressure_offset, tvb, offset, 2, ENC_LITTLE_ENDIAN);
             offset += 2;
             if (offset < sample_len - 2) {
                 dissect_ambit_add_unknown(tvb, pinfo, sample_tree, offset, sample_len - 11);
@@ -1453,8 +1519,8 @@ dissect_ambit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
             if (msg_part == 0x5d && msg_count > 1) {
                 reassembly_entries[pinfo->fd->num].valid = 2;
                 reassembly_entries[pinfo->fd->num].command = command;
-                reassembly_entries[pinfo->fd->num].start_frame = pinfo->fd->num;
-                reassembly_entries[pinfo->fd->num].frame_count = msg_count;
+                reassembly_entries[pinfo->fd->num].frame_index = 0;
+                reassembly_entries[pinfo->fd->num].frame_total = msg_count;
                 reassembly_entries[pinfo->fd->num].size = pkt_len;
                 reassembly_entries[pinfo->fd->num].data = (unsigned char*)g_malloc(pkt_len);
                 fragments_start_frame = pinfo->fd->num;
@@ -1468,8 +1534,8 @@ dissect_ambit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
                     //fragments_start_frame = pinfo->fd->num-msg_count;
                     reassembly_entries[pinfo->fd->num].valid = 2;
                     reassembly_entries[pinfo->fd->num].command = reassembly_entries[fragments_start_frame].command;
-                    reassembly_entries[pinfo->fd->num].start_frame = fragments_start_frame;
-                    reassembly_entries[pinfo->fd->num].frame_count = reassembly_entries[fragments_start_frame].frame_count;
+                    reassembly_entries[pinfo->fd->num].frame_index = msg_count;
+                    reassembly_entries[pinfo->fd->num].frame_total = reassembly_entries[fragments_start_frame].frame_total;
                     reassembly_entries[pinfo->fd->num].size = fragments_data_len;
                     reassembly_entries[pinfo->fd->num].data = reassembly_entries[fragments_start_frame].data;
                     tvb_memcpy(tvb, &(reassembly_entries[fragments_start_frame].data[fragments_offset]), data_offset, data_len);
@@ -1558,7 +1624,11 @@ dissect_ambit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
 
             ti = proto_tree_add_item(tree, proto_ambit, tvb, 0, len, ENC_NA);
             ambit_tree = proto_item_add_subtree(ti, ett_ambit);
-            offset = 2;
+            offset = 0;
+            proto_tree_add_item(ambit_tree, hf_ambit_usbid, tvb, offset, 1, ENC_NA);
+            offset += 1;
+            proto_tree_add_item(ambit_tree, hf_ambit_usblength, tvb, offset, 1, ENC_NA);
+            offset += 1;
             proto_tree_add_item(ambit_tree, hf_ambit_msgpart, tvb, offset, 1, ENC_BIG_ENDIAN);
             offset += 1;
             proto_tree_add_item(ambit_tree, hf_ambit_msglength, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -1575,6 +1645,7 @@ dissect_ambit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
             if (msg_part == 0x5d) {
                 proto_tree_add_item(ambit_tree, hf_ambit_requestcmd, tvb, offset, 4, ENC_BIG_ENDIAN);
                 offset += 4;
+                dissect_ambit_add_unknown (tvb, pinfo, ambit_tree, offset, 2);
                 offset += 2;
                 proto_tree_add_item(ambit_tree, hf_ambit_pktseqno, tvb, offset, 2, ENC_LITTLE_ENDIAN);
                 offset += 2;
@@ -1587,13 +1658,13 @@ dissect_ambit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
                 pkt_len = data_len;
                 col_set_str(pinfo->cinfo, COL_INFO, "");
             }
-            else if (reassembly_entries[pinfo->fd->num].start_frame + reassembly_entries[pinfo->fd->num].frame_count - 1 == pinfo->fd->num) {
+            else if (reassembly_entries[pinfo->fd->num].frame_index + 1 == reassembly_entries[pinfo->fd->num].frame_total) {
                 new_tvb = tvb_new_real_data(reassembly_entries[pinfo->fd->num].data, reassembly_entries[pinfo->fd->num].size, reassembly_entries[pinfo->fd->num].size);
                 //tvb_set_child_real_data_tvbuff(tvb, new_tvb);
                 add_new_data_source(pinfo, new_tvb, "Reassembled");
                 pkt_len = reassembly_entries[pinfo->fd->num].size;
 
-                col_add_fstr(pinfo->cinfo, COL_INFO, " (#%u of #%u) Reassembled", pinfo->fd->num-reassembly_entries[pinfo->fd->num].start_frame + 1, reassembly_entries[pinfo->fd->num].frame_count);
+                col_add_fstr(pinfo->cinfo, COL_INFO, " (#%u of #%u) Reassembled", reassembly_entries[pinfo->fd->num].frame_index + 1, reassembly_entries[pinfo->fd->num].frame_total);
 
                 if (reassembly_entries[pinfo->fd->num].log_start_frame != 0xffffffff &&
                     reassembly_entries[reassembly_entries[pinfo->fd->num].log_start_frame].log_entry != NULL) {
@@ -1602,7 +1673,7 @@ dissect_ambit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
                 }
             }
             else {
-                col_add_fstr(pinfo->cinfo, COL_INFO, " (#%u of #%u)", pinfo->fd->num-reassembly_entries[pinfo->fd->num].start_frame + 1, reassembly_entries[pinfo->fd->num].frame_count);
+                col_add_fstr(pinfo->cinfo, COL_INFO, " (#%u of #%u)", reassembly_entries[pinfo->fd->num].frame_index + 1, reassembly_entries[pinfo->fd->num].frame_total);
             }
 
             subdissector = find_subdissector(reassembly_entries[pinfo->fd->num].command);
@@ -1633,6 +1704,10 @@ dissect_ambit(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
             offset += data_len;
             proto_tree_add_item(ambit_tree, hf_ambit_payloadchksum, tvb, offset, 2, ENC_LITTLE_ENDIAN);
             offset += 2;
+
+            if (offset < 64) {
+                proto_tree_add_text(ambit_tree, tvb, offset, 64 - offset, "Padding");
+            }
         }
 
         return len;
@@ -1668,13 +1743,15 @@ proto_register_ambit(void)
         { &hf_ambit_pktlen,
           { "Packet length", "ambit.pktlen", FT_UINT32, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_payloadchksum,
-          { "Paypload checksum", "ambit.payloadchksum", FT_UINT16, BASE_HEX, NULL, 0x0,NULL, HFILL } },
+          { "Payload checksum", "ambit.payloadchksum", FT_UINT16, BASE_HEX, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_date,
           { "Date", "ambit.date", FT_STRING, BASE_NONE, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_time,
           { "Time", "ambit.time", FT_STRING, BASE_NONE, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_charge,
           { "Charge", "ambit.charge", FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL } },
+        { &hf_ambit_komposti_version,
+          { "Komposti version", "ambit.komposti", FT_STRING, BASE_NONE, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_model,
           { "Model", "ambit.model", FT_STRING, BASE_NONE, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_serial,
@@ -1683,6 +1760,8 @@ proto_register_ambit(void)
           { "FW version", "ambit.fwversion", FT_STRING, BASE_NONE, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_hw_version,
           { "HW version", "ambit.hwversion", FT_STRING, BASE_NONE, NULL, 0x0,NULL, HFILL } },
+        { &hf_ambit_bsl_version,
+          { "BSL version", "ambit.bslversion", FT_STRING, BASE_NONE, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_personal_compass_declination,
           { "Compass declination", "ambit.personal.compass_declination", FT_STRING, BASE_NONE, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_personal_map_orientation,
@@ -1693,10 +1772,12 @@ proto_register_ambit(void)
           { "Date format", "ambit.personal.date_format", FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_personal_time_format,
           { "Time format", "ambit.personal.time_format", FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL } },
-        { &hf_ambit_personal_coordinate_system,
-          { "Coordinate system", "ambit.personal.coordinate_system", FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_personal_unit_system,
           { "Units", "ambit.personal.units", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+        { &hf_ambit_personal_coordinate_system,
+          { "Coordinate system", "ambit.personal.coordinate_system", FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL } },
+        { &hf_ambit_personal_language,
+          { "Language", "ambit.personal.language", FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_personal_alarm_enable,
           { "Alarm enable", "ambit.personal.alarm_enable", FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_personal_alarm_time,
@@ -1704,7 +1785,7 @@ proto_register_ambit(void)
         { &hf_ambit_personal_dual_time,
           { "Dual time", "ambit.personal.dual_time", FT_STRING, BASE_NONE, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_personal_gps_sync_time,
-          { "Sync time w. GPS", "ambit.personal.gps_sync_time", FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL } },
+          { "Sync time with GPS", "ambit.personal.gps_sync_time", FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_personal_alti_baro_fused_alti,
           { "Fused altitude", "ambit.personal.fused_alti", FT_UINT8, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_personal_alti_baro_profile,
@@ -1788,6 +1869,10 @@ proto_register_ambit(void)
           { "Sample count", "ambit.log_header.sample_count", FT_UINT32, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_log_header_energy,
           { "Energy consumption (kcal)", "ambit.log_header.energy_consumption", FT_UINT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
+        { &hf_ambit_log_header_cadence_max,
+          { "Cadence max (rpm)", "ambit.log_header.cadence_max", FT_UINT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
+        { &hf_ambit_log_header_cadence_avg,
+          { "Cadence avg (rpm)", "ambit.log_header.cadence_avg", FT_UINT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_log_header_speed_max_time,
           { "Time max speed (ms)", "ambit.log_header.speed_maxtime", FT_UINT32, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_log_header_alt_max_time,
@@ -1802,6 +1887,8 @@ proto_register_ambit(void)
           { "Time max temperature (ms)", "ambit.log_header.temp_maxtime", FT_UINT32, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_log_header_temp_min_time,
           { "Time min temperature (ms)", "ambit.log_header.temp_mintime", FT_UINT32, BASE_DEC, NULL, 0x0,NULL, HFILL } },
+        { &hf_ambit_log_header_cadence_max_time,
+          { "Time max cadence (ms)", "ambit.log_header.cadence_maxtime", FT_UINT32, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_log_header_time_first_fix,
           { "Time of first fix", "ambit.log_header.time_first_fix", FT_UINT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_log_header_battery_start,
@@ -1865,8 +1952,8 @@ proto_register_ambit(void)
           { "Energy consumption", "ambit.log_sample.periodic.energy", FT_UINT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_log_sample_periodic_temp,
           { "Temperature", "ambit.log_sample.periodic.temp", FT_UINT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
-        { &hf_ambit_log_sample_periodic_preassure,
-          { "Preassure", "ambit.log_sample.periodic.preassure", FT_UINT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
+        { &hf_ambit_log_sample_periodic_pressure,
+          { "Pressure", "ambit.log_sample.periodic.pressure", FT_UINT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
         { &hf_ambit_log_sample_periodic_vert_speed,
           { "Vertical speed", "ambit.log_sample.periodic.vert_speed", FT_UINT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
 
@@ -1943,8 +2030,8 @@ proto_register_ambit(void)
           { "Type", "ambit.log_sample.altitude_source.type", FT_UINT8, BASE_HEX, VALS(log_samples_altitude_source_type_vals), 0x0,NULL, HFILL } },
         { &hf_ambit_log_altitude_source_altitude_offset,
           { "Altitude offset", "ambit.log_sample.altitude_source.alt_offset", FT_INT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
-        { &hf_ambit_log_altitude_source_preassure_offset,
-          { "Preassure", "ambit.log_sample.altitude_source.preas_offset", FT_INT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
+        { &hf_ambit_log_altitude_source_pressure_offset,
+          { "Pressure", "ambit.log_sample.altitude_source.pres_offset", FT_INT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },
 
         { &hf_ambit_log_ibi,
           { "IBI entry", "ambit.log_sample.ibi", FT_UINT16, BASE_DEC, NULL, 0x0,NULL, HFILL } },

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-running/openambit.git



More information about the Pkg-running-devel mailing list