nfcpy / nfcpy

A Python module to read/write NFC tags or communicate with another NFC device.
European Union Public License 1.1
584 stars 146 forks source link

Error: nfc.llcp.Error: [EPIPE] Broken Pipe #106

Closed niqht1 closed 5 years ago

niqht1 commented 6 years ago

I am fairly lost on what is wrong here. I have tried everything that I can think of. Installed from pip, installed from setup directly off git right here, installed to a Pi A (AMA0), a 2 B (AMA0), a 3(S0), and a Zero W (S0). All with this same error. I am using 2 Elechouse v3's (https://www.amazon.com/Gowoops-PN532-Module-Communication-Android/dp/B0746GB1RQ/ref=sr_1_4?ie=UTF8&qid=1523135429). They detect fine and work with the nfc-dep-target and initiator examples from libnfc. We are trying to do this for a senior project to send a string of data and would much rather use the python based code.

This is all with beam as I can't get anything else to work either, but I can send a text string to NFC Tools on my phone from beam. It is the 532 -> 532 that isn't working. Or if perhaps you can give a recommendation on the best route to take. We are having a mobile unit acknowledge and verify a stationary unit via NFC and then transfer the string that is maybe 1k in size, at most.

Sorry, I don't have them on the network or near a cable right now so I just did pics...

20180407_153021 1 20180407_153056 1

nehpetsde commented 6 years ago

Most likely this is a bug. Add import errno in src/nfc/llcp/__init__.py and let me know if that makes it work.

niqht1 commented 6 years ago

Going to attempt to explain this as best I can and remember...

The import got rid of the errno on both sides, although there is nothing better in its place?

The sender still gets consistent Broken Pipe and whichever side is run and waiting first gives the ProtocolError.

I'm mostly positive the checksum and RF overflow are the results of the slow Pi A. Switching back to the 3 hasn't had them yet (all pics involve the Pi A). The couple of times I got data to print on recv were random at best. And never twice in a row. I never got a recv save to work beyond creating the empty file.

20180408_135914

20180408_135944

20180408_132949

20180408_144153

niqht1 commented 6 years ago

Still nothing after way too much time messing with it. My only thoughts left are forcing a stupid low baud like 9600 or forcing passive (defaults active right?). Neither of which I can find where/how to do. I say passive because the nfc-dep- does transfer its "Hello World" and "Hello Mars" (assuming it isn't cheating) and it says it is passive. Although afterwards it also gives an RF error (transmission I believe).

nehpetsde commented 6 years ago

What you could further try is to force Initiator mode on one side and you can also force passive mode by command options. Use '-h' to get the option names.

chazapp commented 6 years ago

Hi, i'm trying to accomplish the same thing, sending a string with beam.py between 2 RPi 3B+ and their PN532 Adafruit antenna on ftdi usb. In my case, i'm trying to automate wifi connection between these. I'm using resin.io to deploy this code to the two Pi's :

try:
    octave_mode = os.getenv("MODE")
    print "Octave starts in mode : " + octave_mode
    if octave_mode == "ROUTER":
        conf = RouterMode()
        print "Emitting + " + conf.GetJsonFormat()   # "{"ssid":"Kathleen", "pw":"0123EAFE"}
        beamInitiatior = ["python", "./nfcpy/examples/beam.py", "--mode", "i",  "--reltime", "-d", "nfc.llcp", "-d", "nfc.dep", "-d", "nfc.clf",
                          "--device", "tty:USB0:pn532", "send", "text", conf.GetJsonFormat()]
        subprocess.call(beamInitiatior)
    elif octave_mode == "CLIENT":
        beamTarget = ["python", "./nfcpy/examples/beam.py", "--mode", "t",  "--reltime", "-d", "nfc.llcp", "-d", "nfc.dep", "-d", "nfc.clf",
                        "--device", "tty:USB0:pn532", "recv", "save", "ndefMessage"]
        sub = subprocess.Popen(beamTarget)
        print "Sleeping..."
        time.sleep(10)
        print "Terminate NFC ..."
        sub.terminate()
        print "Checking file...."
        file = open("ndefMessage", "r").read(2048)
        print "Received file is : " + file
    else:
        print "Environmment variable not set." #Defaulting to client? Routeur ?
    pass
except:
    traceback.print_exc()

Here's what happens to the initiator:

root@e79e716:/usr/src/app# python Octave/service.py
Octave starts in mode : ROUTER
Router config complete. Name : Aaron Password : PPJXO9URC7JU
Emitting + {"SSID":"Aaron",
"pw":"PPJXO9URC7JU"}
Configuration file: /etc/hostapd/hostapd.conf
Failed to create interface mon.wlan0: -95 (Operation not supported)
wlan0: Could not connect to kernel driver
Using interface wlan0 with hwaddr fe:2f:c1:60:80:4b and ssid "Aaron"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
557 ms [main] enable debug output for 'nfc.llcp'
558 ms [main] enable debug output for 'nfc.dep'
559 ms [main] enable debug output for 'nfc.clf'
559 ms [nfc.clf] searching for reader on path tty:USB0:pn532
562 ms [nfc.clf.transport] ^ttyUSB0$
565 ms [nfc.clf.transport] check: /dev/ttyUSB0
568 ms [nfc.clf.transport] avail: /dev/ttyUSB0
569 ms [nfc.clf.device] trying pn532 on /dev/ttyUSB0
581 ms [nfc.clf.pn532] wait 100 ms for data on /dev/ttyUSB0
605 ms [nfc.clf.pn532] trying to set 921600 baud
654 ms [nfc.clf.pn532] changed uart speed to 921600 baud
736 ms [nfc.clf.pn532] chipset is a PN532v1.6
800 ms [nfc.clf.pn532] write analog settings for Type A 106 kbps
816 ms [nfc.clf.pn532] write analog settings for Type F 212/424 kbps
832 ms [nfc.clf.pn532] write analog settings for Type B 106 kbps
848 ms [nfc.clf.pn532] write analog settings for 14443-4 212/424/848 kbps
880 ms [nfc.clf] using PN532v1.6 at /dev/ttyUSB0
880 ms [nfc.clf] connect('llcp',)
881 ms [nfc.llcp.llc] llc cfg {'recv-miu': 2175, 'llcp-sec': True, 'send-agf': True, 'send-lto': 500, 'send-lsc': 3}
883 ms [nfc.snep.server] snep server bound to port 4 (MIU=1984, RW=15), will accept up to 1048576 byte NDEF messages
884 ms [nfc.clf] connect options after startup: llcp
885 ms [nfc.dep] initiator options: {'rwt': 8, 'brs': 2, 'acm': True, 'gbi': 'Ffm\x01\x01\x13\x02\x02\x07\xff\x03\x02\x00\x13\x04\x012\x07\x01\x07'}
886 ms [nfc.dep] searching active communication mode target at 106A
896 ms [nfc.clf] sense 106A atr_req=D400A5E887BB4E08F0BFC1170000003246666D010113020207FF03020013040132070107
1169 ms [nfc.clf] sense 106A atr_req=D400A5E887BB4E08F0BFC1170000003246666D010113020207FF03020013040132070107
1456 ms [nfc.dep] searching passive communication mode target at 106A
1472 ms [nfc.clf] sense 106A
1520 ms [nfc.clf] found None
1572 ms [nfc.clf] sense 106A
1616 ms [nfc.clf] found None
1632 ms [nfc.dep] searching passive communication mode target at 212F
1648 ms [nfc.clf] sense 212F sensf_req=00FFFF0000
1748 ms [nfc.clf] sense 212F sensf_req=00FFFF0000
1824 ms [nfc.dep] initiator options: {'rwt': 8, 'brs': 2, 'acm': True, 'gbi': 'Ffm\x01\x01\x13\x02\x02\x07\xff\x03\x02\x00\x13\x04\x012\x07\x01\x07'}
1825 ms [nfc.dep] searching active communication mode target at 106A
1839 ms [nfc.clf] sense 106A atr_req=D4006EDC8BC81EF9A81802870000003246666D010113020207FF03020013040132070107
2112 ms [nfc.clf] sense 106A atr_req=D4006EDC8BC81EF9A81802870000003246666D010113020207FF03020013040132070107
2398 ms [nfc.dep] searching passive communication mode target at 106A
2415 ms [nfc.clf] sense 106A
2462 ms [nfc.clf] found None
2515 ms [nfc.clf] sense 106A
2564 ms [nfc.clf] found None
2592 ms [nfc.dep] searching passive communication mode target at 212F
2611 ms [nfc.clf] sense 212F sensf_req=00FFFF0000
2711 ms [nfc.clf] sense 212F sensf_req=00FFFF0000
2782 ms [nfc.dep] initiator options: {'rwt': 8, 'brs': 2, 'acm': True, 'gbi': 'Ffm\x01\x01\x13\x02\x02\x07\xff\x03\x02\x00\x13\x04\x012\x07\x01\x07'}
2783 ms [nfc.dep] searching active communication mode target at 106A
2798 ms [nfc.clf] sense 106A atr_req=D400C273ED089BBF558EC33B0000003246666D010113020207FF03020013040132070107
3070 ms [nfc.clf] sense 106A atr_req=D400C273ED089BBF558EC33B0000003246666D010113020207FF03020013040132070107
3342 ms [nfc.dep] searching passive communication mode target at 106A
3357 ms [nfc.clf] sense 106A
3406 ms [nfc.clf] found None
3457 ms [nfc.clf] sense 106A
3502 ms [nfc.clf] found None
3517 ms [nfc.dep] searching passive communication mode target at 212F
3534 ms [nfc.clf] sense 212F sensf_req=00FFFF0000
3634 ms [nfc.clf] sense 212F sensf_req=00FFFF0000
3711 ms [nfc.dep] initiator options: {'rwt': 8, 'brs': 2, 'acm': True, 'gbi': 'Ffm\x01\x01\x13\x02\x02\x07\xff\x03\x02\x00\x13\x04\x012\x07\x01\x07'}
3712 ms [nfc.dep] searching active communication mode target at 106A
3725 ms [nfc.clf] sense 106A atr_req=D4008D4F7F43DE12B6E27C300000003246666D010113020207FF03020013040132070107
3997 ms [nfc.clf] sense 106A atr_req=D4008D4F7F43DE12B6E27C300000003246666D010113020207FF03020013040132070107
4093 ms [nfc.clf.pn532] running DEP in 106 kbps active mode
4094 ms [nfc.clf] found 106A atr_req=D4008D4F7F43DE12B6E27C300000003246666D010113020207FF03020013040132070107 atr_res=D50101FED8A5CD33D49B5354000000083246666D010113020207FF03020013040132070107
4095 ms [nfc.dep] >> PSL-REQ DID=00 BRS=12 FSL=03
4096 ms [nfc.clf] >>> f006d404001203 timeout=0.1
4204 ms [nfc.clf] <<< f004d50500 0.107s
4205 ms [nfc.dep] << PSL-RES DID=00
4206 ms [nfc.dep] running as NFC-DEP Initiator 424F active mode MIU=251 RWT=0.077329
4208 ms [nfc.llcp.llc] SENT  0 ->  0 PAX  VER=1.3 WKS=0000000000010011 MIUX=2047 LTO=50 OPT=00000111
4209 ms [nfc.llcp.llc] RCVD  0 ->  0 PAX  VER=1.3 WKS=0000000000010011 MIUX=2047 LTO=50 OPT=00000111
4210 ms [nfc.llcp.llc] llc cfg {'llcp-sec': True, 'send-miu': 2175, 'send-agf': True, 'llcp-dpc': 1, 'send-lto': 500, 'recv-lto': 500, 'send-lsc': 3, 'recv-miu': 2175, 'send-wks': 19, 'rcvd-ver': (1, 3)}
4211 ms [nfc.llcp.llc] LLCP Link established as NFC-DEP Initiator
Local LLCP Settings
  LLCP Version: 1.3
  Link Timeout: 500 ms
  Max Inf Unit: 2175 octet
  Link Service: connection-less and connection-oriented
  Data Protect: secure data transfer mode is supported
  Service List: 0000000000010011 (SNEP, SDP, LLC)
Remote LLCP Settings
  LLCP Version: 1.3
  Link Timeout: 500 ms
  Max Inf Unit: 2175 octet
  Link Service: connection-less and connection-oriented
  Data Protect: secure data transfer mode is supported
  Service List: 0000000000010011 (SNEP, SDP, LLC)
4213 ms [nfc.clf] connected LLC: Local(MIU=2175, LTO=500ms) Remote(MIU=2175, LTO=500ms)
4220 ms [nfc.llcp.llc] starting initiator run loop with a receive timeout of 0.510 sec
4246 ms [nfc.llcp.llc] SEND  0 ->  0 DPS  ECPK=8b8786ebdc5a39deebe43fa2f28bed9f0fb2a6f0801e8467526c92eabf6276015b9bbec83fe42baa65395aa2a66c2b6e6388ad2d351de82bd2897ddfab2f229a RN=f6ec8cd6d5a5f990
4248 ms [nfc.dep] >> DEP-REQ INF PNI=0 DID=None NAD=None DATA=02800a408b8786ebdc5a39deebe43fa2f28bed9f0fb2a6f0801e8467526c92eabf6276015b9bbec83fe42baa65395aa2a66c2b6e6388ad2d351de82bd2897ddfab2f229a0b08f6ec8cd6d5a5f990
4250 ms [nfc.clf] >>> 52d4060002800a408b8786ebdc5a39deebe43fa2f28bed9f0fb2a6f0801e8467526c92eabf6276015b9bbec83fe42baa65395aa2a66c2b6e6388ad2d351de82bd2897ddfab2f229a0b08f6ec8cd6d5a5f990 timeout=0.0773286135693
4508 ms [nfc.clf.pn532] Error 0x01: Time out, the Target has not answered
4509 ms [nfc.dep] >> DEP-REQ ATN PNI=0 DID=None NAD=None DATA=
4510 ms [nfc.clf] >>> 04d40680 timeout=0.0773286135693
4683 ms [nfc.clf.pn532] Error 0x01: Time out, the Target has not answered
4684 ms [nfc.dep] >> DEP-REQ ATN PNI=0 DID=None NAD=None DATA=
4685 ms [nfc.clf] >>> 04d40680 timeout=0.0742888450623
4859 ms [nfc.clf.pn532] Error 0x01: Time out, the Target has not answered
4860 ms [nfc.llcp.llc] ProtocolError('unrecoverable NFC-DEP error in attention request',)
4861 ms [nfc.llcp.llc] expected a DPS PDU response
4862 ms [nfc.llcp.llc] llcp link termination caused by key agreement error
4863 ms [nfc.dep] deactivate NFC-DEP Initiator 424F active mode MIU=251 RWT=0.077329
4864 ms [nfc.dep] >> DSL-REQ DID=None
4865 ms [nfc.clf] >>> 03d408 timeout=0.1
5034 ms [nfc.clf.pn532] Error 0x01: Time out, the Target has not answered
5036 ms [nfc.dep] packets sent/rcvd 5/1 DEP ATN 2/0 DEP INF 1/0 DSL 1/0 PSL 1/1
5037 ms [nfc.llcp.llc] closing service access point 32
5038 ms [nfc.llcp.llc] shutdown socket DLC 32 <-> None CONNECT RW(R)=None V(S)=0 V(SA)=0 RW(L)=1 V(R)=0 V(RA)=0
5039 ms [nfc.llcp.tco] DLC (None,None) CONNECT close()
5040 ms [nfc.llcp.llc] closing service access point 4
5041 ms [nfc.llcp.llc] shutdown socket DLC  4 <-> None LISTEN RW(R)=None V(S)=0 V(SA)=0 RW(L)=15 V(R)=0 V(RA)=0
5042 ms [nfc.llcp.tco] DLC (None,None) LISTEN close()
5044 ms [nfc.llcp.llc] closing service access point 1
5045 ms [nfc.llcp.tco] DLC (None,None) SHUTDOWN close()
5046 ms [nfc.llcp.llc] closing service access point 0
5048 ms [nfc.llcp.llc] llc run loop terminated on initiator
Exception in thread urn:nfc:sn:snep:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/site-packages/nfc/snep/server.py", line 63, in listen
    (log.debug if e.errno == nfc.llcp.errno.EPIPE else log.error)(e)
AttributeError: 'module' object has no attribute 'errno'

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./nfcpy/examples/beam.py", line 110, in run_send_text_action
    send_message(args, llc, nfc.ndef.Message(record))
  File "./nfcpy/examples/beam.py", line 78, in send_message
    if not nfc.snep.SnepClient(llc).put(message):
  File "/usr/local/lib/python2.7/site-packages/nfc/snep/client.py", line 233, in put
    self.connect('urn:nfc:sn:snep')
  File "/usr/local/lib/python2.7/site-packages/nfc/snep/client.py", line 93, in connect
    self.socket.connect(service_name)
  File "/usr/local/lib/python2.7/site-packages/nfc/llcp/socket.py", line 91, in connect
    return self.llc.connect(self._tco, address)
  File "/usr/local/lib/python2.7/site-packages/nfc/llcp/llc.py", line 779, in connect
    socket.connect(dest)
  File "/usr/local/lib/python2.7/site-packages/nfc/llcp/tco.py", line 466, in connect
    raise err.Error(errno.EPIPE)
Error: nfc.llcp.Error: [EPIPE] Broken pipe

^CException KeyboardInterrupt in <module 'threading' from '/usr/local/lib/python2.7/threading.pyc'> ignored

And here's what happens to the client :

root@643e542:/usr/src/app# python Octave/service.py
Octave starts in mode : CLIENT
Sleeping...
521 ms [main] enable debug output for 'nfc.llcp'
522 ms [main] enable debug output for 'nfc.dep'
523 ms [main] enable debug output for 'nfc.clf'
524 ms [nfc.clf] searching for reader on path tty:USB0:pn532
527 ms [nfc.clf.transport] ^ttyUSB0$
530 ms [nfc.clf.transport] check: /dev/ttyUSB0
534 ms [nfc.clf.transport] avail: /dev/ttyUSB0
534 ms [nfc.clf.device] trying pn532 on /dev/ttyUSB0
547 ms [nfc.clf.pn532] wait 100 ms for data on /dev/ttyUSB0
567 ms [nfc.clf.pn532] trying to set 921600 baud
623 ms [nfc.clf.pn532] changed uart speed to 921600 baud
706 ms [nfc.clf.pn532] chipset is a PN532v1.6
770 ms [nfc.clf.pn532] write analog settings for Type A 106 kbps
786 ms [nfc.clf.pn532] write analog settings for Type F 212/424 kbps
802 ms [nfc.clf.pn532] write analog settings for Type B 106 kbps
819 ms [nfc.clf.pn532] write analog settings for 14443-4 212/424/848 kbps
850 ms [nfc.clf] using PN532v1.6 at /dev/ttyUSB0
851 ms [nfc.clf] connect('llcp',)
852 ms [nfc.llcp.llc] llc cfg {'recv-miu': 2175, 'llcp-sec': True, 'send-agf': True, 'send-lto': 500, 'send-lsc': 3}
855 ms [nfc.snep.server] snep server bound to port 4 (MIU=1984, RW=15), will accept up to 1048576 byte NDEF messages
856 ms [nfc.clf] connect options after startup: llcp
866 ms [nfc.clf] listen 1.000 seconds for DEP
867 ms [nfc.clf.pn532] nfca_params 010122088b40
867 ms [nfc.clf.pn532] nfcf_params 01fed8a5cd33d49b0000000000000000ffff
946 ms [nfc.clf.pn532] activated in 106A active communication mode
947 ms [nfc.clf.pn532] 106A send ATR_RES d50101fed8a5cd33d49b5354000000083246666d010113020207ff03020013040132070107
1058 ms [nfc.clf.pn532] 106A rcvd PSL_REQ d404001203
1059 ms [nfc.clf.pn532] 106A send PSL_RES d50500
1075 ms [nfc.clf.pn532] set CIU_RxMode to 10100001
1091 ms [nfc.clf.pn532] send PSL_RES d50500
1123 ms [nfc.clf.pn532] set CIU_TxMode to 10100001
1246 ms [nfc.dep] activated as 424F atr_req=D4008D4F7F43DE12B6E27C300000000246666D010113020207FF03020013040132070107 atr_res=D50101FED8A5CD33D49B5354000000083246666D010113020207FF03020013040132070107 dep_req=D4060002800A408B8786EBDC5A39DEEBE43FA2F28BED9F0FB2A6F0801E8467526C92EABF6276015B9BBEC83FE42BAA65395AA2A66C2B6E6388AD2D351DE82BD2897DDFAB2F229A0B08F6EC8CD6D5A5F990 psl_req=D404001203 psl_res=D50500
1248 ms [nfc.dep] running as NFC-DEP Target 424F active mode MIU=61 RWT=0.077329
1250 ms [nfc.llcp.llc] SENT  0 ->  0 PAX  VER=1.3 WKS=0000000000010011 MIUX=2047 LTO=50 OPT=00000111
1252 ms [nfc.llcp.llc] RCVD  0 ->  0 PAX  VER=1.3 WKS=0000000000010011 MIUX=2047 LTO=50 OPT=00000111
1253 ms [nfc.llcp.llc] llc cfg {'llcp-sec': True, 'send-miu': 2175, 'send-agf': True, 'llcp-dpc': 1, 'send-lto': 500, 'recv-lto': 500, 'send-lsc': 3, 'recv-miu': 2175, 'send-wks': 19, 'rcvd-ver': (1, 3)}
1254 ms [nfc.llcp.llc] LLCP Link established as NFC-DEP Target
Local LLCP Settings
  LLCP Version: 1.3
  Link Timeout: 500 ms
  Max Inf Unit: 2175 octet
  Link Service: connection-less and connection-oriented
  Data Protect: secure data transfer mode is supported
  Service List: 0000000000010011 (SNEP, SDP, LLC)
Remote LLCP Settings
  LLCP Version: 1.3
  Link Timeout: 500 ms
  Max Inf Unit: 2175 octet
  Link Service: connection-less and connection-oriented
  Data Protect: secure data transfer mode is supported
  Service List: 0000000000010011 (SNEP, SDP, LLC)
1256 ms [nfc.clf] connected LLC: Local(MIU=2175, LTO=500ms) Remote(MIU=2175, LTO=500ms)
1257 ms [nfc.llcp.llc] starting target run loop with a receive timeout of 0.510 sec
1283 ms [nfc.dep] << DEP-REQ INF PNI=0 DID=None NAD=None DATA=02800a408b8786ebdc5a39deebe43fa2f28bed9f0fb2a6f0801e8467526c92eabf6276015b9bbec83fe42baa65395aa2a66c2b6e6388ad2d351de82bd2897ddfab2f229a0b08f6ec8cd6d5a5f990
1285 ms [nfc.llcp.llc] RECV  0 ->  0 DPS  ECPK=8b8786ebdc5a39deebe43fa2f28bed9f0fb2a6f0801e8467526c92eabf6276015b9bbec83fe42baa65395aa2a66c2b6e6388ad2d351de82bd2897ddfab2f229a RN=f6ec8cd6d5a5f990
1288 ms [nfc.llcp.llc] SEND  0 ->  0 DPS  ECPK=3bb318435d205bc4ba146d820202bd4e197927fdb09d0839f9f84cbf35730e3a0d796aaa6a05f4e942b1d421a6b478f666f85ddd94c761ae6708ccb2ef5872e4 RN=ef68e8df8c079c82
1290 ms [nfc.dep] >> DEP-RES I++ PNI=0 DID=None NAD=None DATA=02800a403bb318435d205bc4ba146d820202bd4e197927fdb09d0839f9f84cbf35730e3a0d796aaa6a05f4e942b1d421a6b478f666f85ddd94c761ae67
1291 ms [nfc.clf] >>> 41d5071002800a403bb318435d205bc4ba146d820202bd4e197927fdb09d0839f9f84cbf35730e3a0d796aaa6a05f4e942b1d421a6b478f666f85ddd94c761ae67 timeout=0.508573055267
1469 ms [nfc.clf] <<< 04d40680 0.177s
1471 ms [nfc.dep] << DEP-REQ ATN PNI=0 DID=None NAD=None DATA=
1473 ms [nfc.dep] >> DEP-RES ATN PNI=0 DID=None NAD=None DATA=
1474 ms [nfc.clf] >>> 04d50780 timeout=0.325474023819
1645 ms [nfc.clf] <<< 04d40680 0.170s
1647 ms [nfc.dep] << DEP-REQ ATN PNI=0 DID=None NAD=None DATA=
1649 ms [nfc.dep] >> DEP-RES ATN PNI=0 DID=None NAD=None DATA=
1651 ms [nfc.clf] >>> 04d50780 timeout=0.149037837982
1820 ms [nfc.clf] <<< 03d408 0.168s
1822 ms [nfc.dep] << DSL-REQ DID=None
1823 ms [nfc.dep] >> DSL-RES DID=None
1825 ms [nfc.clf] >>> 03d509 timeout=0
1853 ms [nfc.clf] <<< None 0.027s
1871 ms [nfc.llcp.sec] remote ecpk-x '8b8786ebdc5a39deebe43fa2f28bed9f0fb2a6f0801e8467526c92eabf627601'
1873 ms [nfc.llcp.sec] remote ecpk-y '5b9bbec83fe42baa65395aa2a66c2b6e6388ad2d351de82bd2897ddfab2f229a'
1874 ms [nfc.llcp.sec] shared secret '1e8daa3ce85a2b6156cb8b2366da625be6bd43d17a2aaa7c699d1b91d2afc4d8'
1875 ms [nfc.llcp.sec] shared nonce  'f6ec8cd6d5a5f990ef68e8df8c079c82'
1877 ms [nfc.llcp.sec] session key   '78fa2f1b20449af6b62be935fd1f7478'
1878 ms [nfc.llcp.llc] llcp link termination caused by link disruption
1879 ms [nfc.dep] deactivate NFC-DEP Target 424F active mode MIU=61 RWT=0.077329
1880 ms [nfc.clf] >>> None timeout=0.999974966049
1980 ms [nfc.clf] <<<  0.099s
1982 ms [nfc.dep] packets sent/rcvd 5/5 ATR 1/1 DEP ATN 2/2 DEP I++ 1/0 DEP INF 0/1 DSL 1/1
1983 ms [nfc.llcp.llc] closing service access point 4
1985 ms [nfc.llcp.llc] shutdown socket DLC  4 <-> None LISTEN RW(R)=None V(S)=0 V(SA)=0 RW(L)=15 V(R)=0 V(RA)=0
1987 ms [nfc.llcp.tco] DLC (None,None) LISTEN close()
1988 ms [nfc.llcp.llc] closing service access point 1
1989 ms [nfc.llcp.tco] DLC (None,None) SHUTDOWN close()
1990 ms [nfc.llcp.llc] closing service access point 0
1991 ms [nfc.llcp.llc] llc run loop terminated on target
Exception in thread urn:nfc:sn:snep:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/site-packages/nfc/snep/server.py", line 63, in listen
    (log.debug if e.errno == nfc.llcp.errno.EPIPE else log.error)(e)
AttributeError: 'module' object has no attribute 'errno'

Terminate NFC ...
Checking file....
Received file is :
$

Adding "import errno" to src/llcp/__init.py did not fix the errno error, output file stays empty. Let me know if you need more information.

nehpetsde commented 6 years ago

This pretty much looks like an RF communication problem. Unfortunately this depends on many factors including antenna tuning (chip to antenna) and coupling (between the two antennas). Most NFC devices are tuned for reader performance, i.e for reading tags. This is called "passive communication mode". Your devices have connected in active communication mode which can be less reliable between identical reader devices. You should try to force passive mode (use --help to find the flag) and could also experiment with explicitly assigning the role of Initiator and Target device.