Reading Input from an USB RFID Card Reader
2 days ago
- #Exclusive Input
- #RFID Reader
- #Golang
- The author had a cheap RFID reader that acts like a keyboard when plugged in, but wanted to capture input exclusively for a single application without affecting others.
- To achieve exclusive access, the EVIOCGRAB ioctl is used, which grabs the device so the kernel doesn't forward events to other applications like X/Wayland.
- A Golang program is provided that opens the RFID reader device, grabs exclusive access, reads input events, maps key codes to characters, and prints the RFID value when an Enter key is detected.