RFID-LibNFC1.8.0-在ubuntu20.04进行编译安装

手动安装 主要参考https://github.com/nfc-tools/libnfc

1.安装libnfc的依赖:

    apt update && apt upgrade   
    apt install build-essential
    安装lrzsz软件 apt install lrzsz
    apt install cmake  安装构建工具CMake
    apt-get install libusb-dev dh-autoreconf

下面不一定需要的操作,列在这里,只是方便参考
    apt install libusb
    apt install libusb-dev

2.下载、解压

用rz把从windows10下载的libnfc-1.8.0.tar.bz2复制到ubuntu的~目录下()
tar -jxvf libnfc-1.8.0.tar.bz2 -C ./ 
 

3.Installation

#Additionnally, you may need to grant permissions to your user to drive your device. Under GNU/Linux systems, if you use udev, you could use the provided udev rules. e.g. under Debian, Ubuntu, etc.

sudo cp contrib/udev/93-pn53x.rules /lib/udev/rules.d/           

4.Configuration、make、make install

cd libnfc-1.8.0   #注意!!!!首先要进入到待编译、安装的libnfc的源码目录内部

you can make configuration directory and copy the sample file:
sudo mkdir /etc/nfc
sudo cp libnfc.conf.sample /etc/nfc/libnfc.conf

sudo vi /etc/nfc/libnfc.conf 
# Allow device auto-detection (default: true)
# Note: if this auto-detection is disabled, user has to set manually a device
# configuration using file or environment variable
#allow_autoscan = true

# Allow intrusive auto-detection (default: false)
# Warning: intrusive auto-detection can seriously disturb other devices
# This option is not recommended, user should prefer to add manually his device.
#allow_intrusive_scan = false

# Set log level (default: error)
# Valid log levels are (in order of verbosity): 0 (none), 1 (error), 2 (info), 3 (debug)
# Note: if you compiled with --enable-debug option, the default log level is "debug"
#log_level = 1

# Manually set default device (no default)
# To set a default device, you must set both name and connstring for your device
# Note: if autoscan is enabled, default device will be the first device available in device list.
device.name = "microBuilder.eu"

#因为我用的是TTL转USB,所以下面的是正确的设置
device.connstring = "pn532_uart:/dev/ttyUSB1"
 

To configure multiple devices, you can either modify libnfc.conf or create a file per device in a nfc/devices.d directory: (qzm这步没做
sudo mkdir -p /etc/nfc/devices.d
printf 'name = "My first device"\nconnstring = "pn532_uart:/dev/ttyACM0"\n' | sudo tee /etc/nfc/devices.d/first.conf
printf 'name = "My second device"\nconnstring = "pn532_uart:/dev/ttyACM1"\n' | sudo tee /etc/nfc/devices.d/second.conf

In order to change the default behavior of the library, the libnfc uses a configuration file located in sysconfdir (as provided to ./configure).
A sample commented file is available in sources: libnfc.conf.sample

If you have compiled using:
./configure --prefix=/usr --sysconfdir=/etc

make

make install

5.测试

Troubleshooting(只列出qzm用到的)

PN533 USB device on Linux >= 3.1:

Since Linux kernel version 3.1, a few kernel-modules must not be loaded in order to use libnfc : "nfc", "pn533" and "pn533_usb". To prevent kernel from loading automatically these modules, you can blacklist them in a modprobe conf file. This file is provided within libnfc archive:
sudo cp contrib/linux/blacklist-libnfc.conf /etc/modprobe.d/blacklist-libnfc.conf  

 

 

 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值