nfc-tools / libnfc

Platform independent Near Field Communication (NFC) library
http://nfc-tools.org
GNU Lesser General Public License v3.0
1.67k stars 439 forks source link

Unable to claim USB interface (Permission denied) #330

Closed syarizat closed 7 years ago

syarizat commented 8 years ago

i run nfc-list on terminal Mac Yosemite But the error appears:

nfc-list uses libnfc 1.7.1
error   libnfc.driver.acr122_usb    Unable to claim USB interface (Permission denied)

Please guide me to solve this problem.

maxgfr commented 4 years ago

I got it to work without modifying any OS X system file, compiling libnfc with only the acr122_pcsc driver:

$ ./configure --with-drivers=acr122_pcsc
$ make install

It works for me.

git clone https://github.com/nfc-tools/libnfc.git
cd libnfc 
autoreconf -is 
./configure --with-drivers=acr122_pcsc
make install
nospam2000 commented 4 years ago

I got it to work without modifying any OS X system file, compiling libnfc with only the acr122_pcsc driver:

This is no new information. When you read above in this thread you will find this from neomilium : _"acr122pcsc is an obsolete driver and should not be used anymore. (and will be dropped in future)".

That means your are lucky when it works with today's version, but it might not work tomorrow if you don't convince the developers not to drop the support for acr122_pcsc.

@neomilium: are there still plans to remove the acr122_pcsc driver? It really causes big problems to Mac Users if you remove them.

usr-ein commented 4 years ago

I've managed to disable ifdreader:

sudo launchctl remove com.apple.ifdreader
sudo launchctl stop com.apple.ifdreader

Now I can execute nfc-list without errors (using sudo).

This solves it for me running macOs Catalina 10.15.4 (without disabling SIP thanksfuly)

Don't forget to run brew install pcsc-lite for the CCID exchange stuff.

vkravets commented 2 years ago

@smap1902 remove and stop ifdreader is not good idea, since it's a system driver of the PC/SC compliant devices There is solution without SIP and without remove and stop

@nospam2000 found solution without SIP enable/disable

If you are using reader in some macos applications which is PC/SC compliant, this solution will not work for you.

  1. Install non system drivers, in my case it was https://www.acs.com.hk/download-driver-unified/12835/ACS-Unified-INST-MacOSX-1182-P.zip which is acsccid drivers.
  2. Found at local system such folder /usr/local/libexec/SmartCardServices/drivers/ifd-acsccid.bundle/Contents which is not protected by SIP, since it's /usr/local and it's user drivers
  3. Modify file Info.plist how is described in the @nospam2000 post
    • remove your device from the file in 3 places (vendorId, productId, description)
  4. Unplug and plug the reader - led is not working (it's expected!)
  5. Make sure lsusb show yours reader in the list 6 libnfc working with acr122_usb driver

In this case macos system ignore system drivers since installed user drivers and all configuration applied from them even if the device has been ignored in it is using.

Tested and working well with the latest version of the libnfc from master and macos BigSur 11.6

Note: to be able to work correctly with gen3 fob I would recommend to compile and install libnfc from master, some of new changes have been made but not released yet (

vkravets commented 2 years ago

Sorry but it seems it will not work after reboot.... My miss

jvhaarst commented 1 year ago

I first found this issue before I found the solution here : https://hackerman.medium.com/losing-and-gaining-access-52d31d42fd38

In short : stopping the service enables you to use a command that accesses the RFID reader, but after a while the OS starts the service again, blocking access again. The simple solution is to just stop it every time you run a command, sleep for a few seconds, and it'll be fine: sudo launchctl stop com.apple.ifdreader ; sleep 10 ;nfc-list -v

This isn't a complete solution (this would mean blocking the OS from restarting the service) , but it at least allows to work with the RFID reader.

jeff-pang commented 1 year ago

I had similar problem. Initially i made the mistake of installing libnfc and mfoc via brew install. I had to uninstall and then compile with libnfc with --with-drivers=acr122_pcsc as described above and then also compiled mfoc (as already described above)

steps to do that:

first uninstall any versions of libnfc and mfoc then begin compile for libnfc

git clone https://github.com/nfc-tools/libnfc.git
cd libnfc
autoreconf -iv
./configure --with-drivers=acr122_pcsc
make && make install

then compile mfoc

git clone https://github.com/nfc-tools/mfoc.git
cd mfoc
autoreconf -is
./configure
make && make install

replace make install with sudo make install if necessary (e.g make && sudo make install)

leeren commented 1 year ago

2023 and still get this issue on OSX - anyone have a fix?

Maxigame99 commented 12 months ago

probably you just need to increase the thread priority of the acr122 driver so that the apple driver do not have time to block it

leeren commented 11 months ago

Any pointers on how to do go about doing that @Maxigame99 ? Really feels like NFC programming is not possible on macs these days

Maxigame99 commented 11 months ago

I ended up to open VM using UTM (on macOS) with Linux Ubuntu Server Minimal and run all the scripts right there.

Odroid13 commented 11 months ago

./configure

Thanks

MacOs ventura : odroid@MBP libnfc % ./configure --with-drivers=acr122_pcsc.c zsh: no such file or directory: ./configure

do you have an idea ?