[Pkg-running-devel] [openambit] 116/131: Consistently handle the F/W version as a four byte entity

Christian Perrier bubulle at moszumanska.debian.org
Thu Jul 17 20:19:17 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 3b752ac8747da2ba9e81d3facd01ff869cb90fcf
Author: Olaf Meeuwissen <paddy-hack at member.fsf.org>
Date:   Mon Jun 2 21:28:48 2014 +0900

    Consistently handle the F/W version as a four byte entity
    
    This follows up on 7ad5392f77 and is in line with F/W version usage
    in `src/openambit/` as well.
---
 src/example/ambitconsole.c            | 4 ++--
 wireshark_dissector/ambit-dissector.c | 7 +++----
 2 files changed, 5 insertions(+), 6 deletions(-)

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/wireshark_dissector/ambit-dissector.c b/wireshark_dissector/ambit-dissector.c
index 6ea077e..f528bbc 100644
--- a/wireshark_dissector/ambit-dissector.c
+++ b/wireshark_dissector/ambit-dissector.c
@@ -393,10 +393,9 @@ 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);

-- 
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