1

I have a Raspberry PI with two NFC readers attached. Problem is that the readers get different device numbers each time the system reboots or a reader is detached and attached again.

I therefore created udev rules that create a fixed device name depending on the physical port a device is attached to. E.g. plug in NFC reader in the upper left port leads always to /dev/nfc_a and plugged into the upper right port leads always to /dev/nfc_b.

How can I now configure libnfc to use these devices and report the device names such as /dev/nfc_a as a part of the reading? I am using Node-RED with node-red-contrib-nfc (https://github.com/hardillb/node-red-contrib-nfc) on top of libnfc. My ultimate goal is to safely distinguish the two readers within my Node-RED flow to act differently upon the readings.

I already found the "connstring" configuration but I don't know how to correctly set it for using /dev/nfc_a.

1 Answers1

0

It's been a LONG time since I wrote this node, but looking back at the nodejs library it's based on (nfc) the output message should contain a field called deviceID which should indicate which NFC reader triggered the input.

When I run on my machine I get:

deviceID: 'pn53x_usb:001:005'

Where 001 is the USB bus id and 005 is the device ID, which matches up with the output from lsusb. These should stay static as long as the readers are always plugged into the same USB sockets.

hardillb
  • 54,545
  • 11
  • 67
  • 105
  • Thank you for your answer. But exactly this is the problem: the device id is the one which changes when the reader is unplugged and plugged again. That's why I created the udev rule which uses the physical bus + port e.g. as ATTR{devpath}=="1.2" for the upper left port. BusID is static, but deviceID changes: before unplug deviceID: 'pn53x_usb:001:005' after unplug/replug deviceID: 'pn53x_usb:001:046' (although I haven't plugged in 41 other devices in the meantime...) – Rene Auberger Feb 06 '18 at 20:27
  • You plugged it back into the same USB socket? – hardillb Feb 06 '18 at 20:28
  • Yes, same USB socket, different deviceID each time I plug it in. – Rene Auberger Feb 07 '18 at 08:42