Fix Android 4.1 bug and Add test scripts reference
authorOlivier Guiter <olivier.guiter@linux.intel.com>
Thu, 4 Oct 2012 14:32:03 +0000 (16:32 +0200)
committerOlivier Guiter <olivier.guiter@linux.intel.com>
Thu, 4 Oct 2012 14:32:03 +0000 (16:32 +0200)
Makefile.in
packaging/neard.spec
plugins/handover.c
src/agent.c

index 875051a..44e5409 100644 (file)
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
 
 
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
-    case $$MAKEFLAGS in \
-      *\\[\ \  ]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
-    esac; \
-    test $$am__dry = yes; \
-  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -199,11 +182,6 @@ SOURCES = $(src_neard_SOURCES) $(nodist_src_neard_SOURCES) \
        $(tools_snep_send_SOURCES)
 DIST_SOURCES = $(am__src_neard_SOURCES_DIST) \
        $(am__tools_snep_send_SOURCES_DIST)
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
 DATA = $(dist_dbus_DATA) $(dist_noinst_DATA) $(pkgconfig_DATA)
 HEADERS = $(include_HEADERS) $(nodist_include_HEADERS) \
        $(noinst_HEADERS)
@@ -403,7 +381,7 @@ EXTRA_DIST = src/genbuiltin $(doc_files) $(test_scripts)
 test_scripts = test/disable-adapter test/enable-adapter test/list-adapters \
                test/dump-device test/dump-tag test/dump-record \
                test/monitor-near test/start-poll test/stop-poll test/write-tag \
-               test/push-device
+               test/push-device test/bt-handover
 
 @TEST_TRUE@testdir = $(pkglibdir)/test
 @TEST_TRUE@test_SCRIPTS = $(test_scripts)
@@ -489,6 +467,7 @@ neard.pc: $(top_builddir)/config.status $(srcdir)/neard.pc.in
        cd $(top_builddir) && $(SHELL) ./config.status $@
 install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
        @$(NORMAL_INSTALL)
+       test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
        @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
        list2=; for p in $$list; do \
          if test -f $$p; then \
@@ -496,8 +475,6 @@ install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
          else :; fi; \
        done; \
        test -z "$$list2" || { \
-         echo " $(MKDIR_P) '$(DESTDIR)$(plugindir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(plugindir)" || exit 1; \
          echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
          $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
        }
@@ -521,11 +498,8 @@ clean-pluginLTLIBRARIES:
        done
 install-libexecPROGRAMS: $(libexec_PROGRAMS)
        @$(NORMAL_INSTALL)
+       test -z "$(libexecdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecdir)"
        @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \
-       fi; \
        for p in $$list; do echo "$$p $$p"; done | \
        sed 's/$(EXEEXT)$$//' | \
        while read p p1; do if test -f $$p || test -f $$p1; \
@@ -654,11 +628,8 @@ tools/snep-send$(EXEEXT): $(tools_snep_send_OBJECTS) $(tools_snep_send_DEPENDENC
        $(AM_V_CCLD)$(LINK) $(tools_snep_send_OBJECTS) $(tools_snep_send_LDADD) $(LIBS)
 install-testSCRIPTS: $(test_SCRIPTS)
        @$(NORMAL_INSTALL)
+       test -z "$(testdir)" || $(MKDIR_P) "$(DESTDIR)$(testdir)"
        @list='$(test_SCRIPTS)'; test -n "$(testdir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(testdir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(testdir)" || exit 1; \
-       fi; \
        for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
          if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
@@ -787,11 +758,8 @@ distclean-libtool:
        -rm -f libtool config.lt
 install-dist_dbusDATA: $(dist_dbus_DATA)
        @$(NORMAL_INSTALL)
+       test -z "$(dbusdir)" || $(MKDIR_P) "$(DESTDIR)$(dbusdir)"
        @list='$(dist_dbus_DATA)'; test -n "$(dbusdir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(dbusdir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(dbusdir)" || exit 1; \
-       fi; \
        for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
          echo "$$d$$p"; \
@@ -808,11 +776,8 @@ uninstall-dist_dbusDATA:
        dir='$(DESTDIR)$(dbusdir)'; $(am__uninstall_files_from_dir)
 install-pkgconfigDATA: $(pkgconfig_DATA)
        @$(NORMAL_INSTALL)
+       test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
        @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
-       fi; \
        for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
          echo "$$d$$p"; \
@@ -829,11 +794,8 @@ uninstall-pkgconfigDATA:
        dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
 install-includeHEADERS: $(include_HEADERS)
        @$(NORMAL_INSTALL)
+       test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
        @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
-       fi; \
        for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
          echo "$$d$$p"; \
@@ -850,11 +812,8 @@ uninstall-includeHEADERS:
        dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
 install-nodist_includeHEADERS: $(nodist_include_HEADERS)
        @$(NORMAL_INSTALL)
+       test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
        @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
-       fi; \
        for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
          echo "$$d$$p"; \
@@ -1020,7 +979,7 @@ distcheck: dist
        *.zip*) \
          unzip $(distdir).zip ;;\
        esac
-       chmod -R a-w $(distdir); chmod u+w $(distdir)
+       chmod -R a-w $(distdir); chmod a+w $(distdir)
        mkdir $(distdir)/_build
        mkdir $(distdir)/_inst
        chmod a-w $(distdir)
index e3fa279..53eec4e 100644 (file)
@@ -3,7 +3,7 @@
 Name:       neard
 Summary:    Near Field Communication Manager
 Version:    0.6
-Release:    6
+Release:    7
 Group:      System/Networking
 License:    GPLv2
 Source0:    http://www.kernel.org/pub/linux/network/nfc/neard-%{version}.tar.bz2
index c8ba895..5d6c087 100644 (file)
@@ -48,7 +48,7 @@
                                        */
 
 #define RECORD_TYPE_WKT_ALTERNATIVE_CARRIER 0x0a
-#define FRAME_TYPE_OFFSET      4
+#define FRAME_TYPE_OFFSET      3
 
 enum loop_stage_flag {
        STATE_MAIN_NDEF         = 0x00,
@@ -142,6 +142,10 @@ static int handover_ndef_parse(int client_fd, struct hr_ndef *ndef)
                 */
                msg = near_ndef_prepare_handover_record("Hs", records->data,
                                                        NEAR_CARRIER_BLUETOOTH);
+               if (msg == NULL) {
+                       err = -EINVAL;
+                       goto fail;
+               }
 
                near_info("Send Hs frame");
                err = send(client_fd, msg->data, msg->length, MSG_DONTWAIT);
index bf124e0..a5309c5 100644 (file)
@@ -215,7 +215,10 @@ static gchar *handover_agent_sender = NULL;
 
 static void handover_agent_free(void)
 {
-       handover_agent_watch = 0;
+       if (handover_agent_watch > 0) {
+               g_dbus_remove_watch(connection, handover_agent_watch);
+               handover_agent_watch = 0;
+       }
 
        g_free(handover_agent_sender);
        handover_agent_sender = NULL;
@@ -228,6 +231,25 @@ static void handover_agent_disconnect(DBusConnection *conn, void *data)
 {
        DBG("data %p", data);
 
+       handover_agent_watch = 0;
+
+       handover_agent_free();
+}
+
+static void handover_agent_release(void)
+{
+       DBusMessage *message;
+
+       if (handover_agent_watch == 0)
+               return;
+
+       message = dbus_message_new_method_call(handover_agent_sender,
+                                               handover_agent_path,
+                                               "org.neard.HandoverAgent",
+                                               "Release");
+       if (message != NULL)
+               g_dbus_send_message(connection, message);
+
        handover_agent_free();
 }
 
@@ -238,11 +260,13 @@ int __near_agent_handover_register(const char *sender, const char *path)
        if (handover_agent_path != NULL)
                return -EEXIST;
 
-       handover_agent_sender = g_strdup(sender);
-       handover_agent_path = g_strdup(path);
-
        handover_agent_watch = g_dbus_add_disconnect_watch(connection, sender,
                                        handover_agent_disconnect, NULL, NULL);
+       if (handover_agent_watch == 0)
+               return -ENOMEM;
+
+       handover_agent_sender = g_strdup(sender);
+       handover_agent_path = g_strdup(path);
 
        return 0;
 }
@@ -254,9 +278,6 @@ int __near_agent_handover_unregister(const char *sender, const char *path)
        if (handover_agent_path == NULL)
                return -ESRCH;
 
-       if (handover_agent_watch > 0)
-               g_dbus_remove_watch(connection, handover_agent_watch);
-
        handover_agent_free();
 
        return 0;
@@ -283,7 +304,7 @@ void __near_agent_cleanup(void)
        g_hash_table_destroy(ndef_app_hash);
        ndef_app_hash = NULL;
 
-       handover_agent_free();
+       handover_agent_release();
 
        dbus_connection_unref(connection);
 }