I am new to raspberry and python in general. I followed different guides to set up RFIDIOT (even the documentation and the installation guide on the repository on Github). So far, when I run pcsc_scan it works fine and it gets the information of any card and the reader I am using (ACR122U). My problem right now it's with the "test the RFIDIOT" installation part. When I run any of the .py test files from it fails on the import rfidiot line. I have two Stacktraces at the moment, one if the reader has a card on it and the other if the reader has no cards.

Reader with a NFC card Error:

    Traceback (most recent call last):
  File "cardselect.py", line 25, in <module>
    import rfidiot
  File "/usr/local/lib/python2.7/dist-packages/rfidiot/__init__.py", line 194, in <module>
    card= RFIDIOt.rfidiot(readernum,readertype,line,speed,timeout,rfidiotglobals.Debug,noinit,nfcreader)
  File "/usr/local/lib/python2.7/dist-packages/rfidiot/RFIDIOt.py", line 160, in __init__
    self.acs_set_retry(to)
  File "/usr/local/lib/python2.7/dist-packages/rfidiot/RFIDIOt.py", line 1320, in acs_set_retry
    return self.acs_send_apdu(self.PCSC_APDU['ACS_SET_RETRY'])
  File "/usr/local/lib/python2.7/dist-packages/rfidiot/RFIDIOt.py", line 1186, in acs_send_apdu
    result, sw1, sw2= self.acs_transmit_apdu(apduout)
  File "/usr/local/lib/python2.7/dist-packages/rfidiot/RFIDIOt.py", line 1211, in acs_transmit_apdu
    result, sw1, sw2= self.pcsc_connection.transmit(apdu,protocol= self.pcsc_protocol)
  File "/usr/local/lib/python2.7/dist-packages/smartcard/CardConnectionDecorator.py", line 82, in transmit
    return self.component.transmit(bytes, protocol)
  File "/usr/local/lib/python2.7/dist-packages/smartcard/CardConnection.py", line 146, in transmit
    data, sw1, sw2 = self.doTransmit(bytes, protocol)
  File "/usr/local/lib/python2.7/dist-packages/smartcard/pcsc/PCSCCardConnection.py", line 205, in doTransmit
    SCardGetErrorMessage(hresult))
smartcard.Exceptions.CardConnectionException: Failed to transmit with protocol T0. Card protocol mismatch.

Reader without any NFC card error:

Traceback (most recent call last):
  File "cardselect.py", line 25, in <module>
    import rfidiot
  File "/usr/local/lib/python2.7/dist-packages/rfidiot/__init__.py", line 194, in <module>
    card= RFIDIOt.rfidiot(readernum,readertype,line,speed,timeout,rfidiotglobals.Debug,noinit,nfcreader)
  File "/usr/local/lib/python2.7/dist-packages/rfidiot/RFIDIOt.py", line 160, in __init__
    self.acs_set_retry(to)
  File "/usr/local/lib/python2.7/dist-packages/rfidiot/RFIDIOt.py", line 1320, in acs_set_retry
    return self.acs_send_apdu(self.PCSC_APDU['ACS_SET_RETRY'])
  File "/usr/local/lib/python2.7/dist-packages/rfidiot/RFIDIOt.py", line 1186, in acs_send_apdu
    result, sw1, sw2= self.acs_transmit_apdu(apduout)
  File "/usr/local/lib/python2.7/dist-packages/rfidiot/RFIDIOt.py", line 1211, in acs_transmit_apdu
    result, sw1, sw2= self.pcsc_connection.transmit(apdu,protocol= self.pcsc_protocol)
  File "/usr/local/lib/python2.7/dist-packages/smartcard/CardConnectionDecorator.py", line 82, in transmit
    return self.component.transmit(bytes, protocol)
  File "/usr/local/lib/python2.7/dist-packages/smartcard/CardConnection.py", line 146, in transmit
    data, sw1, sw2 = self.doTransmit(bytes, protocol)
  File "/usr/local/lib/python2.7/dist-packages/smartcard/pcsc/PCSCCardConnection.py", line 198, in doTransmit
    raise CardConnectionException('Card not connected')
smartcard.Exceptions.CardConnectionException: Card not connected

the .py test files I have are the same ones on the github repo. I am running raspbian 9.4 (stretch) on a raspberry pi 3 model B+.

I am dumb. After a friend of mine gave me this article and I installed libnfc, the test files finally work. It wasn't easy to find out this was the problem, RFIDIOT documentation is kinda outdated and a lot of other guides out there don't specify much about it.

  • And what is the solution now? Installing libnfc? – Ingo Aug 16 at 18:51

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.