I'm looking at the same problem with (currently) a single but different RFID USB (HIDevice) reader. It presents a 10-digit number and a (CR +?) LF (from the tag read) as if it was typed in at a keyboard. I made some headway with adding a new rule 10-local.rules
to the /lib/udev/rules.d/
system to add a known name as a symlink in the /dev
directory:
ACTION!="add|change", GOTO="end"
# Adding a standard symbolic link for RFID scanner, ideally will use to isolate from keyboard
SUBSYSTEM=="usb", ATTRS{idVendor}=="vvvv", ATTRS{idProduct}=="pppp", ATTRS{serial}=="############", SYMLINK+="rfid#", TAG+="rfid", OPTIONS+=last_rule
LABEL="end"
In your case you will need to edit vvvv
and pppp
to be the vendor and product id of the readers and then copy this three more times and replace ############
with the individual serial numbers of your devices (I assume they all all the same device!) and the #
in rfid#
with I suggest a number from 1 to 4 or (perhaps a "_location" for each device). Now, when each RFID USB device is plugged in it is detected and the rfid#
symlink will appear and become available as, say /dev/rfid1
to /dev/rfid4
respectively.
The complication is that the input will still get treated as if it was typed at a keyboard - which will be treated as username entry on the local console as if there is a user trying to log in locally on the Pi. Further work is needed - possibly to get the device(s) to be ignored as keyboards and have a daemon to open those devices and monitor the input...
A (stupidly insecure) use of an RFID device (as a keyboard) as an access device:
As I happen to know the numbers produced by the tags I have and I only have one reader, I was able to create users with the same usernames as those numbers (sudo adduser
can be a bit iffy about this, I think I had to use the --force-badname
option). By disabling a password for that "user" and replacing the login shell by a shell script I could get that script to be run every time the relevant tag was presented to the reader - excerpt from in /etc/passwd
:
...
1234567890:x:110:65534::/home/1234567890:/usr/local/bin/door_unlock
...
1234567890 is NOT the number of one of my tags...!
Whilst this works it is not secure - anyone getting even remote access to the Pi could try a login (via any enabled telnet/rlogin/ssh system) with the given number and they would succeed (no password remember!) and cause that door_unlock
script to run.