• ubuntu16.04 安装 libnfc


    1. 安装依赖包

    sudo apt-get install libusb-dev dh-autoreconf libusb-0.1.4 pkg-config

    注:不安装 pkg-config 会导致 ./congigure 时报错。

    2. 获取源码

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

    3. 编译安装

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

    注:

      默认情况下, make install 命令后将包中的命令安装在 /usr/local/bin 中,包含文件安装到 /usr/local/include ,其他的类似。

      也可以在 ./configure 时指定一个绝对地址的前缀,类似这样 --prefix=/PATH_NAME 。

    4. 安装第三部后输入 nfc-list 命令会报错

    nfc-list: error while loading shared libraries: libnfc.so.5: cannot open shared object file: No such file or directory

    修复方法:

    su root
    
    echo "/usr/local/lib" >> /etc/ld.so.conf.d/loc_lib.conf
    
    /sbin/ldconfig

    libnfc 更新

    cd ~/pn532/libnfc
    
    git pull origin master:master
    
    autoreconf -vis
    
    ./configure --with-drivers=pn532_uart --enable-serial-autoprobe --prefix=/usr/local/
    
    sudo make clean all
    
    sudo make
    
    sudo make install

    解决 NO NFC decive found

    sudo mkdir /usr/local/etc/nfc
    
    sudo cp ~/pn532/libnfc/libnfc.conf.sample /usr/local/etc/nfc/libnfc.conf

    将文件 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/ttyUSB0"

        

  • 相关阅读:
    asp.net利用多线程执行长时间的任务,在客户端显示进度条
    电脑不能正常关机的原因和解决方法
    任务栏有两个相同的图标
    输入法不在桌面显示如何解决解决
    ASP操作XML文件的主要方法和实现
    Java开发工具下载
    感人至深的文章
    Java开发工具下载地址
    网页上图片用ps写上字之后边上锯齿严重
    队列中取最大值操作问题
  • 原文地址:https://www.cnblogs.com/doitjust/p/12144395.html
Copyright © 2020-2023  润新知