[-]
[+]
|
Changed |
_service:tar_git:libnciplugin.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin.spec
^
|
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/.gitignore
^
|
@@ -4,6 +4,7 @@
debian/libnciplugin-dev
debian/*.debhelper.log
debian/*.debhelper
+debian/*.install
debian/*.substvars
debian/tmp
documentation.list
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/LICENSE
^
|
@@ -1,5 +1,6 @@
Copyright (C) 2019-2020 Jolla Ltd.
Copyright (C) 2019-2020 Slava Monich <slava.monich@jolla.com>
+Copyright (C) 2020 Open Mobile Platform LLC.
You may use this file under the terms of the BSD license as follows:
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/Makefile
^
|
@@ -1,7 +1,6 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release coverage pkgconfig install install-dev test
-.PHONY: print_debug_lib print_release_lib print_coverage_lib
+.PHONY: clean all debug release coverage pkgconfig install install-dev
#
# Required packages
@@ -34,7 +33,7 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
-VERSION_RELEASE = 6
+VERSION_RELEASE = 11
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
@@ -75,10 +74,7 @@
RELEASE_FLAGS =
COVERAGE_FLAGS = -g
-ifndef KEEP_SYMBOLS
-KEEP_SYMBOLS = 0
-endif
-
+KEEP_SYMBOLS ?= 0
ifneq ($(KEEP_SYMBOLS),0)
RELEASE_FLAGS += -g
endif
@@ -139,21 +135,13 @@
pkgconfig: $(PKGCONFIG)
-print_debug_lib:
- @echo $(DEBUG_STATIC_LIB)
-
-print_release_lib:
- @echo $(RELEASE_STATIC_LIB)
-
-print_coverage_lib:
- @echo $(COVERAGE_STATIC_LIB)
-
clean:
rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~ rpm/*~
rm -fr $(BUILD_DIR) RPMS installroot
rm -fr debian/tmp debian/lib$(NAME) debian/lib$(NAME)-dev
rm -f documentation.list debian/files debian/*.substvars
rm -f debian/*.debhelper.log debian/*.debhelper debian/*~
+ rm -f debian/*.install
$(BUILD_DIR):
mkdir -p $@
@@ -206,8 +194,19 @@
$(RELEASE_BUILD_DIR)/$(LIB_SYMLINK2): $(RELEASE_LIB)
ln -sf $(LIB) $@
-$(PKGCONFIG): $(LIB_NAME).pc.in
- sed -e 's/\[version\]/'$(PCVERSION)/g $< > $@
+#
+# LIBDIR usually gets substituted with arch specific dir.
+# It's relative in deb build and can be whatever in rpm build.
+#
+
+LIBDIR ?= usr/lib
+ABS_LIBDIR := $(shell echo /$(LIBDIR) | sed -r 's|/+|/|g')
+
+$(PKGCONFIG): $(LIB_NAME).pc.in Makefile
+ sed -e 's|@version@|$(PCVERSION)|g' -e 's|@libdir@|$(ABS_LIBDIR)|g' $< > $@
+
+debian/%.install: debian/%.install.in
+ sed 's|@LIBDIR@|$(LIBDIR)|g' $< > $@
#
# Install
@@ -217,12 +216,12 @@
INSTALL_DIRS = $(INSTALL) -d
INSTALL_FILES = $(INSTALL) -m 644
-INSTALL_LIB_DIR = $(DESTDIR)/usr/lib
+INSTALL_LIB_DIR = $(DESTDIR)$(ABS_LIBDIR)
INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/$(NAME)
-INSTALL_PKGCONFIG_DIR = $(DESTDIR)/usr/lib/pkgconfig
+INSTALL_PKGCONFIG_DIR = $(DESTDIR)$(ABS_LIBDIR)/pkgconfig
install: $(INSTALL_LIB_DIR)
- $(INSTALL_FILES) $(RELEASE_LIB) $(INSTALL_LIB_DIR)
+ $(INSTALL) -m 755 $(RELEASE_LIB) $(INSTALL_LIB_DIR)
ln -sf $(LIB) $(INSTALL_LIB_DIR)/$(LIB_SYMLINK2)
ln -sf $(LIB_SYMLINK2) $(INSTALL_LIB_DIR)/$(LIB_SYMLINK1)
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/debian/changelog
^
|
@@ -1,3 +1,33 @@
+libnciplugin (1.0.11) unstable; urgency=low
+
+ * Fixed reactivation logic to handle random UID
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 24 Sep 2020 17:19:28 +0300
+
+libnciplugin (1.0.10) unstable; urgency=low
+
+ * Add access to poll parameters for Type 4B tags
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 27 Aug 2020 19:42:56 +0300
+
+libnciplugin (1.0.9) unstable; urgency=low
+
+ * Add missing activation parameters for Type 4A/B tags
+
+ -- Slava Monich <slava.monich@jolla.com> Fri, 21 Aug 2020 17:11:13 +0300
+
+libnciplugin (1.0.8) unstable; urgency=low
+
+ * Disable transmit timeouts for ISO-DEP targets
+
+ -- Slava Monich <slava.monich@jolla.com> Fri, 07 Aug 2020 13:57:28 +0300
+
+libnciplugin (1.0.7) unstable; urgency=low
+
+ * Respect arch specific lib dir
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 02 Jul 2020 17:15:12 +0300
+
libnciplugin (1.0.6) unstable; urgency=low
* Allow ISO-DEP response to be empty
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/debian/control
^
|
@@ -2,13 +2,13 @@
Section: libs
Priority: optional
Maintainer: Slava Monich <slava.monich@jolla.com>
-Build-Depends: debhelper (>= 7), libglib2.0-dev (>= 2.0), libglibutil-dev, libncicore-dev
+Build-Depends: debhelper (>= 8.1.3), libglib2.0-dev (>= 2.0), libglibutil-dev, libncicore-dev (>= 1.1.11)
Standards-Version: 3.8.4
Package: libnciplugin
Section: libs
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: libncicore (>= 1.1.11), ${shlibs:Depends}, ${misc:Depends}
Description: Support library for NCI-based nfcd plugins
Package: libnciplugin-dev
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/debian/copyright
^
|
@@ -1,5 +1,6 @@
Copyright (C) 2019-2020 Jolla Ltd.
Copyright (C) 2019-2020 Slava Monich <slava.monich@jolla.com>
+Copyright (C) 2020 Open Mobile Platform LLC.
You may use this file under the terms of the BSD license as follows:
|
[-]
[+]
|
Added |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/debian/libnciplugin-dev.install.in
^
|
@@ -0,0 +1,3 @@
+debian/tmp/@LIBDIR@/libnciplugin.so @LIBDIR@
+debian/tmp/@LIBDIR@/pkgconfig/libnciplugin.pc @LIBDIR@/pkgconfig
+debian/tmp/usr/include/* usr/include
|
[-]
[+]
|
Added |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/debian/libnciplugin.install.in
^
|
@@ -0,0 +1 @@
+debian/tmp/@LIBDIR@/libnciplugin.so.* @LIBDIR@
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/debian/rules
^
|
@@ -4,8 +4,13 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
+LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+override_dh_auto_build:
+ dh_auto_build -- LIBDIR=$(LIBDIR) release pkgconfig debian/libnciplugin.install debian/libnciplugin-dev.install
+
override_dh_auto_install:
- dh_auto_install -- install-dev
+ dh_auto_install -- LIBDIR=$(LIBDIR) install-dev
%:
dh $@
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/libnciplugin.pc.in
^
|
@@ -1,10 +1,10 @@
name=nciplugin
-libdir=/usr/lib
+libdir=@libdir@
includedir=/usr/include
Name: libnciplugin
Description: Support library for NCI-based nfcd plugins
-Version: [version]
+Version: @version@
Requires.private: glib-2.0 gio-2.0 libglibutil libncicore
Libs: -L${libdir} -l${name}
Cflags: -I${includedir} -I${includedir}/${name}
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/src/nci_adapter.c
^
|
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2019-2020 Jolla Ltd.
* Copyright (C) 2019-2020 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2020 Open Mobile Platform LLC.
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -47,7 +48,9 @@
#include <nfc_tag_t4.h>
#include <nci_core.h>
+#include <nci_util.h>
+#include <gutil_misc.h>
#include <gutil_macros.h>
GLOG_MODULE_DEFINE("nciplugin");
@@ -66,6 +69,7 @@
NCI_MODE mode;
GUtilData mode_param;
GUtilData activation_param;
+ NciModeParam* mode_param_parsed;
} NciAdapterIntfInfo;
struct nci_adapter_priv {
@@ -87,12 +91,13 @@
#define PRESENCE_CHECK_PERIOD_MS (250)
+#define RANDOM_UID_SIZE (4)
+#define RANDOM_UID_START_BYTE (0x08)
+
/*==========================================================================*
* Implementation
*==========================================================================*/
-#define nci_adapter_intf_info_free(x) g_free(x)
-
static
NciAdapterIntfInfo*
nci_adapter_intf_info_new(
@@ -126,6 +131,10 @@
} else {
info->activation_param.bytes = NULL;
}
+
+ info->mode_param_parsed = nci_util_copy_mode_param(ntf->mode_param,
+ ntf->mode);
+
return info;
}
return NULL;
@@ -133,6 +142,120 @@
static
gboolean
+mode_param_match_poll_a(
+ const NciModeParamPollA* pa1,
+ const NciModeParamPollA* pa2)
+{
+ /*
+ * Compare all fields except UID 'cause UID may be
+ * changed after losing field
+ */
+ return pa1->sel_res == pa2->sel_res &&
+ pa1->sel_res_len == pa2->sel_res_len &&
+ !memcmp(pa1->sens_res, pa2->sens_res, sizeof(pa2->sens_res));
+}
+
+static
+gboolean
+mode_param_match_poll_b(
+ const NciModeParamPollB* pb1,
+ const NciModeParamPollB* pb2)
+{
+ /*
+ * Compare all fields except UID 'cause UID may be
+ * changed after losing field
+ */
+ return pb1->fsc == pb2->fsc &&
+ !memcmp(pb1->app_data, pb2->app_data, sizeof(pb2->app_data)) &&
+ pb1->prot_info.size == pb2->prot_info.size &&
+ gutil_data_equal(&pb1->prot_info, &pb2->prot_info);
+}
+
+static
+gboolean
+mode_param_match_poll_a_t2(
+ const NciModeParamPollA* pa1,
+ const NciModeParamPollA* pa2)
+{
+ gboolean partial_match = mode_param_match_poll_a(pa1, pa2);
+
+ /*
+ * For tag type 2 logic is almost the same, but random UID has some
+ * limitations: according to AN10927 Random UID RID should be handled
+ * separately - single sized (4 bytes) starting with 0x08
+ */
+ if (pa1->nfcid1_len == pa2->nfcid1_len &&
+ pa2->nfcid1_len == RANDOM_UID_SIZE &&
+ pa1->nfcid1[0] == pa2->nfcid1[0] &&
+ pa2->nfcid1[0] == RANDOM_UID_START_BYTE) {
+ return partial_match;
+ } else {
+ /* Otherwise UID should fully match */
+ return partial_match &&
+ pa1->nfcid1_len == pa2->nfcid1_len &&
+ !memcmp(pa1->nfcid1, pa2->nfcid1, pa2->nfcid1_len);
+ }
+}
+
+static
+gboolean
+nci_adapter_info_mode_params_matches(
+ const NciAdapterIntfInfo* info,
+ const NciIntfActivationNtf* ntf)
+{
+ const NciModeParam* mp1 = info->mode_param_parsed;
+ const NciModeParam* mp2 = ntf->mode_param;
+
+ if (mp1 && mp2) {
+ /* Mode params criteria depends on type of tag */
+ switch (ntf->mode) {
+ case NCI_MODE_PASSIVE_POLL_A:
+ switch (ntf->rf_intf) {
+ case NCI_RF_INTERFACE_FRAME:
+ /* Type 2 Tag */
+ return mode_param_match_poll_a_t2(&mp1->poll_a, &mp2->poll_a);
+ case NCI_RF_INTERFACE_ISO_DEP:
+ /* ISO-DEP Type 4A */
+ return mode_param_match_poll_a(&mp1->poll_a, &mp2->poll_a);
+ case NCI_RF_INTERFACE_NFCEE_DIRECT:
+ case NCI_RF_INTERFACE_NFC_DEP:
+ case NCI_RF_INTERFACE_PROPRIETARY:
+ break;
+ }
+ break;
+ case NCI_MODE_PASSIVE_POLL_B:
+ switch (ntf->rf_intf) {
+ case NCI_RF_INTERFACE_ISO_DEP:
+ /* ISO-DEP Type 4B */
+ return mode_param_match_poll_b(&mp1->poll_b, &mp2->poll_b);
+ case NCI_RF_INTERFACE_FRAME:
+ case NCI_RF_INTERFACE_NFCEE_DIRECT:
+ case NCI_RF_INTERFACE_NFC_DEP:
+ case NCI_RF_INTERFACE_PROPRIETARY:
+ break;
+ }
+ break;
+ case NCI_MODE_ACTIVE_POLL_A:
+ case NCI_MODE_PASSIVE_POLL_F:
+ case NCI_MODE_ACTIVE_POLL_F:
+ case NCI_MODE_PASSIVE_POLL_15693:
+ case NCI_MODE_PASSIVE_LISTEN_A:
+ case NCI_MODE_PASSIVE_LISTEN_B:
+ case NCI_MODE_PASSIVE_LISTEN_F:
+ case NCI_MODE_ACTIVE_LISTEN_A:
+ case NCI_MODE_ACTIVE_LISTEN_F:
+ case NCI_MODE_PASSIVE_LISTEN_15693:
+ break;
+ }
+ }
+ /* Full match is expected in other cases */
+ return info->mode_param.size == ntf->mode_param_len &&
+ (!ntf->mode_param_len || !memcmp(info->mode_param.bytes,
+ ntf->mode_param_bytes, ntf->mode_param_len));
+}
+
+static
+gboolean
nci_adapter_intf_info_matches(
const NciAdapterIntfInfo* info,
const NciIntfActivationNtf* ntf)
@@ -141,9 +264,7 @@
info->rf_intf == ntf->rf_intf &&
info->protocol == ntf->protocol &&
info->mode == ntf->mode &&
- info->mode_param.size == ntf->mode_param_len &&
- (!ntf->mode_param_len || !memcmp(info->mode_param.bytes,
- ntf->mode_param_bytes, ntf->mode_param_len)) &&
+ nci_adapter_info_mode_params_matches(info, ntf) &&
info->activation_param.size == ntf->activation_param_len &&
(!ntf->activation_param_len || !memcmp(info->activation_param.bytes,
ntf->activation_param_bytes, ntf->activation_param_len));
@@ -170,7 +291,8 @@
priv->presence_check_id = 0;
}
if (priv->active_intf) {
- nci_adapter_intf_info_free(priv->active_intf);
+ g_free(priv->active_intf->mode_param_parsed);
+ g_free(priv->active_intf);
priv->active_intf = NULL;
}
GINFO("Target is gone");
@@ -290,6 +412,8 @@
dest->fsc = src->fsc;
dest->nfcid0.bytes = src->nfcid0;
dest->nfcid0.size = sizeof(src->nfcid0);
+ dest->prot_info = src->prot_info;
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.11.tar.bz2/src/nci_target.c
^
|
@@ -83,11 +83,11 @@
NciTargetTransmitFinishFunc transmit_finish_fn;
};
-GType nci_target_get_type(void);
+GType nci_target_get_type(void) G_GNUC_INTERNAL;
+#define PARENT_CLASS nci_target_parent_class
+#define THIS_TYPE (nci_target_get_type())
+#define THIS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), THIS_TYPE, NciTarget))
G_DEFINE_TYPE(NciTarget, nci_target, NFC_TYPE_TARGET)
-#define PN547_NFC_TYPE_TARGET (nci_target_get_type())
-#define NCI_TARGET(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
- PN547_NFC_TYPE_TARGET, NciTarget))
static
NciTargetPresenceCheck*
@@ -175,7 +175,7 @@
gboolean success,
void* user_data)
{
- NciTarget* self = NCI_TARGET(user_data);
+ NciTarget* self = THIS(user_data);
GASSERT(self->send_in_progress);
self->send_in_progress = 0;
@@ -202,7 +202,7 @@
guint len,
void* user_data)
{
- NciTarget* self = NCI_TARGET(user_data);
+ NciTarget* self = THIS(user_data);
if (cid == NCI_STATIC_RF_CONN_ID && self->transmit_in_progress &&
!self->pending_reply) {
@@ -309,8 +309,9 @@
NciAdapter* adapter,
const NciIntfActivationNtf* ntf)
{
- NciTarget* self = g_object_new(PN547_NFC_TYPE_TARGET, NULL);
+ NciTarget* self = g_object_new(THIS_TYPE, NULL);
NfcTarget* target = &self->target;
+ int tx_timeout = -1;
switch (ntf->mode) {
case NCI_MODE_PASSIVE_POLL_A:
@@ -370,6 +371,7 @@
self->transmit_finish_fn = nci_target_transmit_finish_frame;
break;
case NCI_RF_INTERFACE_ISO_DEP:
+ tx_timeout = 0; /* Rely on CORE_INTERFACE_ERROR_NTF */
self->transmit_finish_fn = nci_target_transmit_finish_iso_dep;
break;
default:
@@ -378,6 +380,7 @@
}
self->adapter = adapter;
+ nfc_target_set_transmit_timeout(target, tx_timeout);
g_object_add_weak_pointer(G_OBJECT(adapter), (gpointer*)&self->adapter);
self->event_id[EVENT_DATA_PACKET] =
nci_core_add_data_packet_handler(adapter->nci,
@@ -392,7 +395,7 @@
void* user_data)
{
if (G_LIKELY(target)) {
- NciTarget* self = NCI_TARGET(target);
+ NciTarget* self = THIS(target);
if (self && self->presence_check_fn) {
NciTargetPresenceCheck* check =
@@ -419,7 +422,7 @@
const void* data,
guint len)
{
- NciTarget* self = NCI_TARGET(target);
+ NciTarget* self = THIS(target);
NciAdapter* adapter = self->adapter;
GASSERT(!self->send_in_progress);
@@ -444,7 +447,7 @@
nci_target_cancel_transmit(
NfcTarget* target)
{
- NciTarget* self = NCI_TARGET(target);
+ NciTarget* self = THIS(target);
self->transmit_in_progress = FALSE;
nci_target_cancel_send(self);
@@ -455,7 +458,7 @@
nci_target_deactivate(
NfcTarget* target)
{
- nci_adapter_deactivate(NCI_TARGET(target)->adapter, target);
+ nci_adapter_deactivate(THIS(target)->adapter, target);
}
static
@@ -463,8 +466,8 @@
nci_target_gone(
NfcTarget* target)
{
- nci_target_drop_adapter(NCI_TARGET(target));
- NFC_TARGET_CLASS(nci_target_parent_class)->gone(target);
+ nci_target_drop_adapter(THIS(target));
+ NFC_TARGET_CLASS(PARENT_CLASS)->gone(target);
}
static
@@ -472,7 +475,7 @@
nci_target_reactivate(
NfcTarget* target)
{
- NciTarget* self = NCI_TARGET(target);
+ NciTarget* self = THIS(target);
return self->adapter && nci_adapter_reactivate(self->adapter, target);
}
@@ -493,8 +496,8 @@
nci_target_finalize(
GObject* object)
{
- nci_target_drop_adapter(NCI_TARGET(object));
- G_OBJECT_CLASS(nci_target_parent_class)->finalize(object);
+ nci_target_drop_adapter(THIS(object));
+ G_OBJECT_CLASS(PARENT_CLASS)->finalize(object);
}
static
|
[-]
[+]
|
Deleted |
_service:tar_git:libnciplugin-1.0.6.tar.bz2/debian/libnciplugin-dev.install
^
|
@@ -1,3 +0,0 @@
-debian/tmp/usr/lib/libnciplugin.so usr/lib
-include/*.h usr/include/nciplugin
-build/libnciplugin.pc usr/lib/pkgconfig
|
[-]
[+]
|
Deleted |
_service:tar_git:libnciplugin-1.0.6.tar.bz2/debian/libnciplugin.install
^
|
@@ -1 +0,0 @@
-debian/tmp/usr/lib/libnciplugin.so.* usr/lib
|