2015년 10월 29일 목요일

Install libnfc on ubuntu 12.04

Ubuntu 12.04 LTS

$ sudo apt-get install dh-autoreconf libusb-0.1-4 libusb-dev

$ git clone https://github.com/nfc-tools/libnfc.git
$ cd libnfc
$ git checkout libnfc-1.7.1
$ git clean -d -f -x
$ git remote|grep -q anonscm||git remote add anonscm git://anonscm.debian.org/collab-maint/libnfc.git
$ git fetch anonscm
$ git checkout remotes/anonscm/master debian
$ git reset
$ dpkg-buildpackage -uc -us -b

$ sudo dpkg -i ../libnfc*.deb
 
 
 
 
Problem 
--------------------------------------------------------------------------------
$ sudo nfc-list
nfc-list uses libnfc libnfc-1.7.1-12-gb978c45
error   libnfc.driver.pn53x_usb Unable to set USB configuration (Device or resource busy)
No NFC device found.

 
$ dmesg | tail
[1400911.505643] usb 2-1.4: new full-speed USB device number 7 using ehci-pci
[1400911.637956] usb 2-1.4: New USB device found, idVendor=04e6, idProduct=5591
[1400911.637961] usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[1400911.637964] usb 2-1.4: Product: SCL3711-NFC&RW
[1400911.637967] usb 2-1.4: Manufacturer: SCM Micro
[1400911.641239] pn533 2-1.4:1.0: NFC: NXP PN533 firmware ver 2.7 now attached
[1401061.395200] usb 2-1.4: usbfs: interface 0 claimed by pn533 while 'nfc-list' sets config #1

--------------------------------------------------------------------------------

Solution
--------------------------------------------------------------------------------

restart or unplug the device, unload modules (sudo modprobe -r pn533 nfc), then re-plug the device.
 
$ nfc-list
nfc-list uses libnfc libnfc-1.7.1-12-gb978c45
error   libnfc.driver.pn53x_usb Unable to set USB configuration (Operation not permitted)
No NFC device found.

$ sudo nfc-list
nfc-list uses libnfc libnfc-1.7.1-12-gb978c45
NFC device: SCM Micro / SCL3711-NFC&RW opened
-------------------------------------------------------------------------------- 
 
참고
http://nfc-tools.org/index.php?title=Libnfc#Debian_.2F_Ubuntu
http://forums.nfc-tools.org/topic/668/solved-scl3711-interface-0-claimed-by-pn533-nfclist-sets-conf/