Skip to content
Tech News
← Back to articles

Reading Input from an USB RFID Card Reader

read original get RFID USB Card Reader → more articles
Why This Matters

This article demonstrates how to read input from a USB RFID card reader on a Linux system using low-level programming techniques, specifically in Go. It highlights the importance of capturing exclusive input to enable custom applications, which can be valuable for developers integrating RFID technology into their systems. The approach offers a lightweight alternative to higher-level libraries, providing greater control and flexibility.

Key Takeaways

Reading input from an USB Rfid Card Reader

Why Bother

I had this cheap RFID reader lying around in the house. I can't right remember when and why I had bought it. I had some idea for a software, but then I never really needed to have it on the desk, therefore here you go...

When you plug it, it works like a normal keyboards, it just stays there, but then if you swipe a card or an RFID token, it will just write on your standard input, either on a terminal or whatever application you have useful at the moment.

In order to do anything useful with that piece of equipment, I had to capture the input from a single application, making sure it would not be spamming anything else.

The Name of the Beast

It turns out, what I wanted has a name, and is the EVIOCGRAB ioctl. Sure, in C that makes sense, but for higher level software components that's not a thing. I looked for examples around, and of course, Python got you covered.

But for myself I'd rather not depend on some fluffy PythonN library flying around that I need to remember to install dependencies for.

I'd rather go off and implement som kind-of-high-level Golang code.

To find my device, I had to plug it first, and look what I had available with:

... continue reading