macOS安装libnfc

安装依赖

brew install libtool
brew install automake
brew install autoconf
brew install libusb
brew install pkg-config

git源码

cd ~
mkdir pn532
cd pn532
git clone https://github.com/nfc-tools/libnfc

安装

cd libnfc
autoreconf -vis
./configure --with-drivers=pn532_uart --enable-serial-autoprobe --prefix=/usr/local/
sudo make clean all
sudo make
sudo make install

添加配置文件

cd /usr/local/etc
mkdir nfc
cd nfc
sudo cp ~/pn532/libnfc/libnfc.conf.sample /usr/local/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"
device.connstring = "pn532_uart:/dev/tty.usbserial"

其中最后一行的/dev后的内容是根据实际的系统中查找usb的名称修改后的,与ubuntu中的名称不一样。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容