[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 8cad9dc2006cf44032654
Library to control radio transceivers and receivers
                
                Brought to you by:
                
                    n0nb
                    
                
            
            
        
        
        
    | 
      
      
      From: Michael B. <mdb...@us...> - 2021-01-20 17:17:17
      
     | 
| This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Hamlib -- Ham radio control libraries".
The branch, master has been updated
       via  8cad9dc2006cf440326542666ece1bddfc6a1828 (commit)
      from  a4d9dac5cef15a7e4941472e142c2bd15b622f81 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8cad9dc2006cf440326542666ece1bddfc6a1828
Author: Michael Black W9MDB <mdb...@ya...>
Date:   Wed Jan 20 11:16:48 2021 -0600
    Adding testrigopen.c
diff --git a/tests/testrigopen.c b/tests/testrigopen.c
new file mode 100644
index 00000000..65845ee2
--- /dev/null
+++ b/tests/testrigopen.c
@@ -0,0 +1,62 @@
+/*
+ * Hamlib sample program
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/time.h>
+
+#include <hamlib/rig.h>
+
+#include "misc.h"
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#define SERIAL_PORT "/dev/ttyUSB0"
+
+int callback(const struct rig_caps *caps, rig_ptr_t rigp)
+{
+    RIG *rig = (RIG*) rigp;
+
+    rig = rig_init(caps->rig_model);
+
+    if (!rig)
+    {
+        fprintf(stderr, "Unknown rig num: %d\n", caps->rig_model);
+        fprintf(stderr, "Please check riglist.h\n");
+        exit(1); /* whoops! something went wrong (mem alloc?) */
+    }
+
+    char *port = "/dev/pts/3";
+    strcpy(rig->state.rigport.pathname, port);
+
+    printf("%20s:", caps->model_name);
+    fflush(stdout); 
+    struct timeval start,end;
+    gettimeofday(&start,NULL);
+    rig_open(rig);
+    gettimeofday(&end,NULL);
+    double dstart = start.tv_sec + start.tv_usec/1e6;
+    double dend = end.tv_sec + end.tv_usec/(double)1e6;
+    printf(" %.1f\n",  dend - dstart);
+
+    rig_close(rig); /* close port */
+    rig_cleanup(rig); /* if you care about memory */
+    return 1;
+}
+
+int main(int argc, char *argv[])
+{
+    RIG rig;
+    printf("testing rig timeouts when rig powered off\n");
+
+    /* Turn off backend debugging output */
+    rig_set_debug_level(RIG_DEBUG_NONE);
+    rig_load_all_backends();
+    rig_list_foreach(callback, &rig);
+    return 0;
+}
-----------------------------------------------------------------------
Summary of changes:
 tests/testrigopen.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 tests/testrigopen.c
hooks/post-receive
-- 
Hamlib -- Ham radio control libraries
 |