Quick poll for a tag without read whole NDEF message like libnfc provides this with 'nfc-list'

Asked by xiF

Hi,

is there a quick way to find out whether a tag is in OP range without reading whole payload or even without reading ROM? I use several (three) readers on a USB hub and the command 'nfc-list' from libnfc, that I could use in my script, unfortunately does not provide a possibility to specify the reader (e.g. 'usb:002:008').

I use Ubuntu 12.04 (and/or a Debian based microcontroller) as well as three technically identical pn533-usb-reader and Mifare DESFire (TT4) tags.

Regards
xiF

Question information

Language:
English Edit question
Status:
Solved
For:
nfcpy Edit question
Assignee:
No assignee Edit question
Solved by:
Stephen Tiedemann
Solved:
Last query:
Last reply:
Revision history for this message
Best Stephen Tiedemann (stephen-tiedemann) said :
#1

You can use the ContactlessFrontend.sense() method (http://nfcpy.readthedocs.org/en/latest/modules/nfc.html#nfc.ContactlessFrontend.sense).

>>> import nfc
>>> clf = nfc.ContactlessFrontent("usb")
>>> print clf.sense([nfc.clf.TTA()])
TTA br=106 cfg=440320 uid=04523d012c1c80 ats=None

clf.sense() does one query for each target in the list and returns either None or a nfc.clf.TTA|B|F instance with the parameters learned. To look for all possible card targets:

>>> import nfc
>>> clf = nfc.ContactlessFrontent("usb")
>>> print clf.sense([nfc.clf.TTA(), nfc.clf.TTB(), nfc.clf.TTF(br=212), nfc.clf.TTF(br=424)])
TTF br=212 idm=01010801450f4400 pmm=0120220427674eff sys=12fc

Add a loop to do it continuously.

Revision history for this message
xiF (girronimo) said :
#2

Thanks Stephen Tiedemann, that solved my question.

Revision history for this message
xiF (girronimo) said :
#3

Ah, ok, I tried it, but without the squared brackets. Thank You!