Module: xenomai-3
Branch: master
Commit: a4ec3dfe961e91e26abf61b78036481eda213e60
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a4ec3dfe961e91e26abf61b78036481eda213e60

Author: Jorge Ramirez-Ortiz <j...@xenomai.org>
Date:   Sat Oct 25 12:37:33 2014 -0400

utils/analogy: calibration - cleanup

---

 lib/analogy/calibration.c         |   35 ++++++++---------------------------
 utils/analogy/Makefile.am         |   12 +-----------
 utils/analogy/analogy_calibrate.c |    3 ---
 utils/analogy/analogy_calibrate.h |    3 ---
 utils/analogy/calibration_ni_m.c  |    6 ------
 5 files changed, 9 insertions(+), 50 deletions(-)

diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c
index 9fd944c..331dcac 100644
--- a/lib/analogy/calibration.c
+++ b/lib/analogy/calibration.c
@@ -19,12 +19,13 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
-
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 #include <math.h>
 #include <rtdm/analogy.h>
 #include <stdio.h>
 #include <errno.h>
-#include <wordexp.h>
 #include "iniparser/iniparser.h"
 #include "boilerplate/list.h"
 #include "calibration.h"
@@ -196,36 +197,16 @@ write_calibration_file(FILE *dst, struct list *l,
 int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data)
 {
        const char *subdevice[2] = { AI_SUBD_STR, AO_SUBD_STR };
-       struct a4l_calibration_subdev_data *p = NULL;
        int i, j, k, index = -1, nb_elements = -1;
+       struct a4l_calibration_subdev_data *p = NULL;
        struct _dictionary_ *d;
-       const char *filename;
-       wordexp_t exp;
-       int ret = 0;
-
-       ret = wordexp(name, &exp, WRDE_NOCMD|WRDE_UNDEF);
-       if (ret) {
-               /* can't apply calibration */
-               ret = ret == WRDE_NOSPACE ? -ENOMEM : -EINVAL;
-               return ret;
-       }
 
-       if (exp.we_wordc != 1) {
-               /* "weird expansion of %s as rc file \n", params.name */
+       if (access(name, R_OK))
                return -1;
-       }
 
-       filename = exp.we_wordv[0];
-       if (access(filename, R_OK)) {
-               /* "cant access %s for reading \n", params.name */
+       d = iniparser_load(name);
+       if (d == NULL)
                return -1;
-       }
-
-       d = iniparser_load(filename);
-       if (d == NULL) {
-               /* "loading error for %s (%d)\n", params.name, errno */
-               return -1;
-       }
 
        read_str(&data->driver_name, d, PLATFORM_STR, DRIVER_STR);
        read_str(&data->board_name, d, PLATFORM_STR, BOARD_STR);
@@ -271,7 +252,7 @@ int a4l_read_calibration_file(char *name, struct 
a4l_calibration_data *data)
                        p++;
                }
        }
-       wordfree(&exp);
+
 
        return 0;
 }
diff --git a/utils/analogy/Makefile.am b/utils/analogy/Makefile.am
index eed1265..57ff7a8 100644
--- a/utils/analogy/Makefile.am
+++ b/utils/analogy/Makefile.am
@@ -31,17 +31,7 @@ analogy_config_LDADD = \
        -lrt -lpthread
 
 analogy_calibrate_SOURCES = analogy_calibrate.c calibration_ni_m.c
-analogy_calibrate.c: git-stamp.h calibration_ni_m.h
-git-stamp.h: git-stamp
-       @set -x; if test -r $(top_srcdir)/.git; then                            
                \
-         stamp=`git --git-dir=$(top_srcdir)/.git rev-list --abbrev-commit -1 
HEAD`;            \
-         if test \! -s $@ || grep -wvq $$stamp $@; then                        
                \
-               date=`git --git-dir=$(top_srcdir)/.git log -1 $$stamp 
--pretty=format:%ci`;     \
-               echo "#define GIT_STAMP \"#$$stamp ($$date)\"" > $@;            
                \
-         fi;                                                                   
                \
-       elif test \! -r $@ -o -s $@; then                                       
                \
-           rm -f $@ && touch $@;                                               
                \
-       fi; true
+analogy_calibrate.c: calibration_ni_m.h
 analogy_calibrate_LDADD = \
        ../../lib/analogy/libanalogy.la \
        ../../lib/cobalt/libcobalt.la   \
diff --git a/utils/analogy/analogy_calibrate.c 
b/utils/analogy/analogy_calibrate.c
index 1b87e39..ca33ab7 100644
--- a/utils/analogy/analogy_calibrate.c
+++ b/utils/analogy/analogy_calibrate.c
@@ -32,7 +32,6 @@
 #include "calibration_ni_m.h"
 
 struct timespec calibration_start_time;
-static const char *revision = "1.0.0";
 a4l_desc_t descriptor;
 
 static const struct option options[] = {
@@ -86,8 +85,6 @@ int main(int argc, char *argv[])
        int v, i, fd, err = 0;
        FILE *p = NULL;
 
-       __debug("version: git commit %s, revision %s \n", GIT_STAMP, revision);
-
        for (;;) {
                i = -1;
                v = getopt_long_only(argc, argv, "", options, &i);
diff --git a/utils/analogy/analogy_calibrate.h 
b/utils/analogy/analogy_calibrate.h
index 09812ae..b2a1c6e 100644
--- a/utils/analogy/analogy_calibrate.h
+++ b/utils/analogy/analogy_calibrate.h
@@ -30,9 +30,6 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
-
-
-#include "git-stamp.h"
 #include "error.h"
 
 extern struct timespec calibration_start_time;
diff --git a/utils/analogy/calibration_ni_m.c b/utils/analogy/calibration_ni_m.c
index 55f5a3b..47c148a 100644
--- a/utils/analogy/calibration_ni_m.c
+++ b/utils/analogy/calibration_ni_m.c
@@ -20,14 +20,8 @@
  * along with Xenomai; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
-
-#include <gsl/gsl_statistics_double.h>
-#include <gsl/gsl_multifit.h>
-#include <gsl/gsl_matrix.h>
-#include <gsl/gsl_vector.h>
 #include <rtdm/uapi/analogy.h>
 #include <rtdm/analogy.h>
-#include <wordexp.h>
 #include <math.h>
 
 #include "calibration_ni_m.h"


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to