[Pkg-running-devel] [openambit] 103/131: Export clock's support status in `ambit_device_info_t`

Christian Perrier bubulle at moszumanska.debian.org
Thu Jul 17 20:19:15 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 89ec2837656134948c50a1de5baf1ceab4b3ba42
Author: Olaf Meeuwissen <olaf at member.fsf.org>
Date:   Tue Mar 25 22:27:32 2014 +0900

    Export clock's support status in `ambit_device_info_t`
    
    This allows for dropping the `ambit_known_device_t` pointer from
    `ambit_object_t`.
---
 src/libambit/libambit.c     | 10 ++++++----
 src/libambit/libambit.h     |  1 +
 src/libambit/libambit_int.h |  3 ---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/libambit/libambit.c b/src/libambit/libambit.c
index eda3462..f9652c8 100644
--- a/src/libambit/libambit.c
+++ b/src/libambit/libambit.c
@@ -36,6 +36,8 @@
  */
 #define SUUNTO_USB_VENDOR_ID 0x1493
 
+typedef struct ambit_known_device_s ambit_known_device_t;
+
 struct ambit_known_device_s {
     uint16_t vid;
     uint16_t pid;
@@ -132,8 +134,8 @@ ambit_object_t *libambit_detect(void)
                         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);
@@ -182,8 +184,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;
@@ -193,7 +195,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));
         }
diff --git a/src/libambit/libambit.h b/src/libambit/libambit.h
index 570c0a3..f667f98 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 {
diff --git a/src/libambit/libambit_int.h b/src/libambit/libambit_int.h
index 4e246fb..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_known_device_s ambit_known_device_t;
-
 struct ambit_object_s {
     hid_device *handle;
     uint16_t vendor_id;
     uint16_t product_id;
     uint16_t sequence_no;
-    ambit_known_device_t *device;
     ambit_device_info_t device_info;
 
     struct {

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