Skip to content

Commit

Permalink
Refactor Code to meet criteria of PR discussion:
Browse files Browse the repository at this point in the history
- add missing find_package in top-level CMakeLists.txt
- fix Version no. in dependencies.yaml
- fix clang-format violations
- add license headers to libnfc-nci config files
- add explaining comment to nfc discovery ininitialization
- use cmake property to extract config install path from libnfc_nci

Signed-off-by: Christoph Burandt <[email protected]>
  • Loading branch information
cburandt committed Nov 14, 2024
1 parent da0189f commit b889916
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 5 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ else()

find_package(fsm REQUIRED)
find_package(slac REQUIRED)
find_package(libnfc-nci REQUIRED)

find_package(pugixml REQUIRED)
find_package(CURL 7.84.0 REQUIRED)
Expand Down
3 changes: 2 additions & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ everest-utils:
# linux_libnfc-nci for RFID
libnfc-nci:
git: https://github.com/EVerest/linux_libnfc-nci.git
git_tag: 202411.1.0
git_tag: 2024.11.0
cmake_condition: "EVEREST_DEPENDENCY_ENABLED_LIBNFC_NCI"

# unit testing
gtest:
Expand Down
5 changes: 3 additions & 2 deletions modules/PN7160TokenProvider/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ target_sources(${MODULE_NAME}

# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1

get_target_property(LIBNFCNCI_CONFIG_INSTALL_PATH libnfc_nci::libnfc_nci LIBNFCNCI_CONFIG_INSTALL_PATH)
install(FILES
libnfc-nci_config/libnfc-nxp.conf
libnfc-nci_config/libnfc-nci.conf
"libnfc-nci_config/libnfc-nxp.conf"
"libnfc-nci_config/libnfc-nci.conf"
DESTINATION
"${LIBNFCNCI_CONFIG_INSTALL_PATH}")

Expand Down
21 changes: 21 additions & 0 deletions modules/PN7160TokenProvider/libnfc-nci_config/libnfc-nci.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
##############################################################################
#
# Note by PIONIX GmbH
# ===================
#
# Original file distributed NXP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################

########################### PN7160 libnfc-nci.conf ############################

###############################################################################
Expand Down
31 changes: 30 additions & 1 deletion modules/PN7160TokenProvider/libnfc-nci_config/libnfc-nxp.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
##############################################################################
#
# Note by PIONIX GmbH
# ===================
#
# Original file distributed NXP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# --------------------------------------------------------
# This file has been changed by PIONIX GmbH in 11-2024
# Changes are marked below
# --------------------------------------------------------
#
##############################################################################

########################### PN7160 libnfc-nxp.conf ############################

###############################################################################
Expand Down Expand Up @@ -33,16 +59,19 @@ NXP_TRANSPORT=0x02
# Nfc Device Node name
NXP_NFC_DEV_NODE="/dev/nxpnfc"

# Modification by PIONIX GmbH 2024 vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

###############################################################################
# ALT_I2C/SPI Interface Configuration
# [PINs defined as GPIO23/24/25 on RPi4 (choose 594, 595, 596 for RPi5)]
# [PINs defined as GPIO23/24/25 on RPi5]
PIN_INT=594
PIN_ENABLE=595
PIN_FWDNLD=596

I2C_ADDRESS=0x28
I2C_BUS="/dev/i2c-1"
SPI_BUS="/dev/spidev0.0"
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

###############################################################################
# Extension for Mifare reader enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class auth_token_providerImpl : public auth_token_providerImplBase {
auth_token_providerImpl() = delete;
auth_token_providerImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer<PN7160TokenProvider>& mod,
Conf& config) :
auth_token_providerImplBase(ev, "main"), mod(mod), config(config) {};
auth_token_providerImplBase(ev, "main"), mod(mod), config(config){};

// ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1
// insert your public definitions here
Expand Down
5 changes: 5 additions & 0 deletions modules/PN7160TokenProvider/main/libnfc_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ bool NfcHandler::start(Callback callback_) {
this->callback = std::move(callback_);

registerTagCallback(&nfc_callbacks);
// enable discovery in reader-only mody, no host-routing/host-card-emulation and force a restart
// doEnableDiscovery (int technologies_mask,
// int reader_only_mode,
// int enable_host_routing,
// int restart)
doEnableDiscovery(DEFAULT_NFA_TECH_MASK, 0x01, 0x0, 0x1);

return true;
Expand Down

0 comments on commit b889916

Please sign in to comment.