summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authoraig2020-10-17 12:35:14 +0200
committeraig2020-10-17 17:16:08 +0200
commitccb4ebb94d249d910bef09adabbdc6cf12401340 (patch)
tree3328c026cfc88060aab233921b53b00d3e0d9a3e
downloadaur-ccb4ebb94d249d910bef09adabbdc6cf12401340.tar.gz
Initial commit
This package provides the Linux NFC stack for NCI based NXP NFC Controllers (PN7150, PN7120) found here: https://github.com/NXPNFCLinux/linux_libnfc-nci There are multiple variants of the package, because the used transport (lpcusbsio, i2c, alt) has to be selected at compile time. This package is configured to use the lpcusbsio USB variant. This enables for example to use the pn7150 based "NFC USB Dongle" from Mikroe (https://www.mikroe.com/nfc-usb-dongle)
-rw-r--r--.SRCINFO28
-rw-r--r--.gitignore4
-rw-r--r--01-fix-tml-linker-errors.patch33
-rw-r--r--02-fix-llcp-linker-errors.patch110
-rw-r--r--03-udev-rules.patch30
-rw-r--r--PKGBUILD42
6 files changed, 247 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..19584acec40
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,28 @@
+pkgbase = libnfc-nci-lpcusbsio
+ pkgdesc = Linux NFC stack for NCI based NXP NFC Controllers (PN7150, PN7120)
+ pkgver = 2.4.1
+ pkgrel = 1
+ url = https://github.com/NXPNFCLinux/linux_libnfc-nci/
+ arch = x86_64
+ license = APACHE
+ makedepends = automake
+ makedepends = autoconf
+ makedepends = libtool
+ depends = glibc
+ depends = gcc-libs
+ depends = systemd-libs
+ depends = openssl
+ provides = libnfc-nci
+ conflicts = libnfc-nci-i2c
+ conflicts = libnfc-nci-alt
+ source = git+https://github.com/NXPNFCLinux/linux_libnfc-nci#commit=2aff6448cf6a86897d3d1bacb0a0943a594aa9ce
+ source = 01-fix-tml-linker-errors.patch
+ source = 02-fix-llcp-linker-errors.patch
+ source = 03-udev-rules.patch
+ sha256sums = SKIP
+ sha256sums = c9992a8449de8ece0324cbf180a24f8bcab82cb7f51832d3d80958c0968a7575
+ sha256sums = c6ece172b50e1d1070a979fbafa2e9ee7f7f7b92d583fa38f8ea433123a9ef4d
+ sha256sums = 0a44a4a1c0e429b6415332ededfc36111d6832a98c0717a996c8f862ba623e77
+
+pkgname = libnfc-nci-lpcusbsio
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..51772ecd8a0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+linux_libnfc-nci/
+pkg/
+src/
+*.pkg.tar.*
diff --git a/01-fix-tml-linker-errors.patch b/01-fix-tml-linker-errors.patch
new file mode 100644
index 00000000000..8d24fc970d2
--- /dev/null
+++ b/01-fix-tml-linker-errors.patch
@@ -0,0 +1,33 @@
+diff --git a/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.h b/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.h
+index 724a2bd..dd1ed8f 100644
+--- a/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.h
++++ b/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.h
+@@ -29,4 +29,4 @@ int phTmlNfc_i2c_read(void *pDevHandle, uint8_t * pBuffer, int nNbBytesToRead);
+ int phTmlNfc_i2c_write(void *pDevHandle,uint8_t * pBuffer, int nNbBytesToWrite);
+ int phTmlNfc_i2c_reset(void *pDevHandle,long level);
+ bool_t getDownloadFlag(void);
+-phTmlNfc_i2cfragmentation_t fragmentation_enabled;
++extern phTmlNfc_i2cfragmentation_t fragmentation_enabled;
+diff --git a/src/halimpl/pn54x/tml/lpcusbsio/phTmlNfc_lpcusbsio.h b/src/halimpl/pn54x/tml/lpcusbsio/phTmlNfc_lpcusbsio.h
+index 724a2bd..dd1ed8f 100644
+--- a/src/halimpl/pn54x/tml/lpcusbsio/phTmlNfc_lpcusbsio.h
++++ b/src/halimpl/pn54x/tml/lpcusbsio/phTmlNfc_lpcusbsio.h
+@@ -29,4 +29,4 @@ int phTmlNfc_i2c_read(void *pDevHandle, uint8_t * pBuffer, int nNbBytesToRead);
+ int phTmlNfc_i2c_write(void *pDevHandle,uint8_t * pBuffer, int nNbBytesToWrite);
+ int phTmlNfc_i2c_reset(void *pDevHandle,long level);
+ bool_t getDownloadFlag(void);
+-phTmlNfc_i2cfragmentation_t fragmentation_enabled;
++extern phTmlNfc_i2cfragmentation_t fragmentation_enabled;
+diff --git a/src/service/extns/src/mifare/phNxpExtns_MifareStd.c b/src/service/extns/src/mifare/phNxpExtns_MifareStd.c
+index 6cd6aaf..f45236c 100644
+--- a/src/service/extns/src/mifare/phNxpExtns_MifareStd.c
++++ b/src/service/extns/src/mifare/phNxpExtns_MifareStd.c
+@@ -20,7 +20,7 @@
+ #include <phNxpLog.h>
+ #include <phNxpExtns_MifareStd.h>
+
+-phNxpExtns_Context_t gphNxpExtns_Context;
++extern phNxpExtns_Context_t gphNxpExtns_Context;
+ phNciNfc_TransceiveInfo_t tNciTranscvInfo;
+ phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt = NULL;
+ phFriNfc_NdefMap_t *NdefMap = NULL;
diff --git a/02-fix-llcp-linker-errors.patch b/02-fix-llcp-linker-errors.patch
new file mode 100644
index 00000000000..bcf75109494
--- /dev/null
+++ b/02-fix-llcp-linker-errors.patch
@@ -0,0 +1,110 @@
+diff --git a/src/libnfc-nci/nfc/cipher/cipher.c b/src/libnfc-nci/nfc/cipher/cipher.c
+index 899fc34..3d97306 100644
+--- a/src/libnfc-nci/nfc/cipher/cipher.c
++++ b/src/libnfc-nci/nfc/cipher/cipher.c
+@@ -31,6 +31,7 @@
+ #if(NFC_NXP_LLCP_SECURED_P2P == TRUE)
+ #include "cipher.h"
+
++tCIPHER_SUITE cipher_suite;
+ void cipher_init()
+ {
+
+@@ -53,6 +54,7 @@ void cipher_deinit()
+
+ }
+
++tECDH_KEY ecdh_key;
+ void cipher_generate_keys()
+ {
+
+diff --git a/src/libnfc-nci/nfc/include/cipher.h b/src/libnfc-nci/nfc/include/cipher.h
+index 5167de2..af7b971 100644
+--- a/src/libnfc-nci/nfc/include/cipher.h
++++ b/src/libnfc-nci/nfc/include/cipher.h
+@@ -79,7 +79,6 @@ typedef struct {
+ UINT32 packet_counter_recv;
+
+ } tCIPHER_SUITE;
+-tCIPHER_SUITE cipher_suite;
+
+ typedef struct {
+ EC_KEY* privKey_local;
+@@ -96,7 +95,6 @@ typedef struct {
+ CMAC_CTX* cctx;
+ EVP_CIPHER_CTX* ccmctx;
+ }tECDH_KEY;
+-tECDH_KEY ecdh_key;
+
+ void cipher_init(void);
+ void cipher_deinit(void);
+diff --git a/src/libnfc-nci/nfc/int/llcp_int.h b/src/libnfc-nci/nfc/int/llcp_int.h
+index 379e1f0..c0ba899 100644
+--- a/src/libnfc-nci/nfc/int/llcp_int.h
++++ b/src/libnfc-nci/nfc/int/llcp_int.h
+@@ -74,7 +74,6 @@ typedef struct {
+ BOOLEAN p2p_flag; /* p2p flag */
+ BT_HDR *dps_msg; /* dps message */
+ } tLLCP_SECURED;
+-tLLCP_SECURED llcp_secured;
+ #endif
+
+
+diff --git a/src/libnfc-nci/nfc/llcp/llcp_api.c b/src/libnfc-nci/nfc/llcp/llcp_api.c
+index 70cb03f..82fe74b 100644
+--- a/src/libnfc-nci/nfc/llcp/llcp_api.c
++++ b/src/libnfc-nci/nfc/llcp/llcp_api.c
+@@ -50,6 +50,10 @@
+ #include "llcp_int.h"
+ #include "llcp_defs.h"
+
++#if(NFC_NXP_LLCP_SECURED_P2P == TRUE)
++tLLCP_SECURED llcp_secured;
++#endif
++
+ #if (LLCP_TEST_INCLUDED == TRUE) /* this is for LLCP testing */
+
+ tLLCP_TEST_PARAMS llcp_test_params =
+diff --git a/src/libnfc-nci/nfc/llcp/llcp_dlc.c b/src/libnfc-nci/nfc/llcp/llcp_dlc.c
+index 9091679..6f1e664 100644
+--- a/src/libnfc-nci/nfc/llcp/llcp_dlc.c
++++ b/src/libnfc-nci/nfc/llcp/llcp_dlc.c
+@@ -42,6 +42,10 @@ static char *llcp_dlsm_get_state_name (tLLCP_DLC_STATE state);
+ static char *llcp_dlsm_get_event_name (tLLCP_DLC_EVENT event);
+ #endif
+
++#if(NFC_NXP_LLCP_SECURED_P2P == TRUE)
++extern tLLCP_SECURED llcp_secured;
++#endif
++
+ /*******************************************************************************
+ **
+ ** Function llcp_dlsm_execute
+diff --git a/src/libnfc-nci/nfc/llcp/llcp_link.c b/src/libnfc-nci/nfc/llcp/llcp_link.c
+index f6fba0f..50f3217 100644
+--- a/src/libnfc-nci/nfc/llcp/llcp_link.c
++++ b/src/libnfc-nci/nfc/llcp/llcp_link.c
+@@ -52,6 +52,8 @@
+ #if(NFC_NXP_LLCP_SECURED_P2P == TRUE)
+ #include "nci_config.h"
+ #include "cipher.h"
++extern tLLCP_SECURED llcp_secured;
++extern tCIPHER_SUITE cipher_suite;
+ #endif
+ const UINT16 llcp_link_rwt[15] = /* RWT = (302us)*2**WT; 302us = 256*16/fc; fc = 13.56MHz */
+ {
+diff --git a/src/libnfc-nci/nfc/llcp/llcp_sdp.c b/src/libnfc-nci/nfc/llcp/llcp_sdp.c
+index fe1faa3..49d371a 100644
+--- a/src/libnfc-nci/nfc/llcp/llcp_sdp.c
++++ b/src/libnfc-nci/nfc/llcp/llcp_sdp.c
+@@ -55,6 +55,10 @@
+ #include "nfa_dm_int.h"
+ #endif
+
++#if(NFC_NXP_LLCP_SECURED_P2P == TRUE)
++extern tLLCP_SECURED llcp_secured;
++#endif
++
+ /*******************************************************************************
+ **
+ ** Function llcp_sdp_proc_data
diff --git a/03-udev-rules.patch b/03-udev-rules.patch
new file mode 100644
index 00000000000..a14bfc3d328
--- /dev/null
+++ b/03-udev-rules.patch
@@ -0,0 +1,30 @@
+diff --git a/src/halimpl/pn54x/tml/lpcusbsio/97-lpcusbsio-hid.rules b/src/halimpl/pn54x/tml/lpcusbsio/97-lpcusbsio-hid.rules
+index bf3c8db..04f24a7 100644
+--- a/src/halimpl/pn54x/tml/lpcusbsio/97-lpcusbsio-hid.rules
++++ b/src/halimpl/pn54x/tml/lpcusbsio/97-lpcusbsio-hid.rules
+@@ -1,21 +1,5 @@
+-# This is a sample udev file for HIDAPI devices which changes the permissions
+-# to 0666 (world readable/writable) for a specified device on Linux systems.
+-
+-# If you are using the hidraw implementation, then do something like the
+-# following, substituting the VID and PID with your device. Busnum 1 is USB.
+-
+ # HIDAPI/hidraw
+-KERNEL=="hidraw*", ATTRS{busnum}=="1", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0088", MODE="0666"
+-KERNEL=="hidraw*", ATTRS{busnum}=="2", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0088", MODE="0666"
+-KERNEL=="hidraw*", ATTRS{busnum}=="3", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0088", MODE="0666"
+-KERNEL=="hidraw*", ATTRS{busnum}=="4", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0088", MODE="0666"
+-
+-# Once done, optionally rename this file for your device, and drop it into
+-# /etc/udev/rules.d and unplug and re-plug your device. This is all that is
+-# necessary to see the new permissions. Udev does not have to be restarted.
+-
+-# If you think permissions of 0666 are too loose, then see:
+-# http://reactivated.net/writing_udev_rules.html for more information on finer
+-# grained permission setting. For example, it might be sufficient to just
+-# set the group or user owner for specific devices (for example the plugdev
+-# group on some systems).
++KERNEL=="hidraw*", ATTRS{busnum}=="1", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0088", TAG+="uaccess"
++KERNEL=="hidraw*", ATTRS{busnum}=="2", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0088", TAG+="uaccess"
++KERNEL=="hidraw*", ATTRS{busnum}=="3", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0088", TAG+="uaccess"
++KERNEL=="hidraw*", ATTRS{busnum}=="4", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="0088", TAG+="uaccess"
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..84737fab04f
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,42 @@
+# Maintainer: aig <aigmx@posteo.de>
+
+pkgname=libnfc-nci-lpcusbsio
+pkgver=2.4.1
+pkgrel=1
+pkgdesc="Linux NFC stack for NCI based NXP NFC Controllers (PN7150, PN7120)"
+arch=('x86_64')
+url="https://github.com/NXPNFCLinux/linux_libnfc-nci/"
+license=('APACHE')
+depends=('glibc' 'gcc-libs' 'systemd-libs' 'openssl')
+makedepends=('automake' 'autoconf' 'libtool')
+provides=('libnfc-nci')
+conflicts=('libnfc-nci-i2c' 'libnfc-nci-alt')
+source=("git+https://github.com/NXPNFCLinux/linux_libnfc-nci#commit=2aff6448cf6a86897d3d1bacb0a0943a594aa9ce"
+ "01-fix-tml-linker-errors.patch"
+ "02-fix-llcp-linker-errors.patch"
+ "03-udev-rules.patch")
+sha256sums=('SKIP'
+ 'c9992a8449de8ece0324cbf180a24f8bcab82cb7f51832d3d80958c0968a7575'
+ 'c6ece172b50e1d1070a979fbafa2e9ee7f7f7b92d583fa38f8ea433123a9ef4d'
+ '0a44a4a1c0e429b6415332ededfc36111d6832a98c0717a996c8f862ba623e77')
+
+prepare() {
+ cd "$srcdir/linux_libnfc-nci"
+ patch -p1 -i "$srcdir/01-fix-tml-linker-errors.patch"
+ patch -p1 -i "$srcdir/02-fix-llcp-linker-errors.patch"
+ patch -p1 -i "$srcdir/03-udev-rules.patch"
+}
+
+build() {
+ cd "$srcdir/linux_libnfc-nci"
+ ./bootstrap
+ export openssldir='/usr'
+ ./configure --prefix=/usr --sysconfdir=/etc/libnfc-nci --enable-lpcusbsio --enable-llcp1_3
+ make
+}
+
+package() {
+ cd "$srcdir/linux_libnfc-nci"
+ make DESTDIR="$pkgdir/" install
+ rm -rf $pkgdir/usr/sbin
+}