1
votes

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

1 Answers

0
votes

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.