usb_hid_magstripe_reader
usb_hid_magstripe_reader
is a Rust library that provides a simple interface for reading data from a USB magstripe reader.
It allows users to easily integrate magstripe reader functionality into their Rust applications, as normally it acts as a keyboard.
Features
- A crappy 5-minute project to make a cheap Aliexpress magstripe reader work
- Suddenly, it works
Installation
To use usb_hid_magstripe_reader
in your Rust project, add the following line to your Cargo.toml
file:
[]
= "0.1.0"
Usage
Here's a simple example demonstrating how to use usb_hid_magstripe_reader
:
use MagstripeReader;
Make sure to replace the vendor_id
and product_id
values with the appropriate values for your specific magstripe reader.
How to get vendor_id and product_id:
lsusb
- Find your device (e.g. MEGAHUNT Megahunt HID FS Keyboard / Run Mall)
- Use
ffff:0035
part, whereffff
is a vendor_id and0035
is a product_id
Troubleshooting
There's a chance the library cannot open a device.
- Check
dmesg
. If it writes something likeDevice is not authorized for usage
, it meansusbguard
doesn't recognize the device - Find device's id
usbguard list-devices
- Allow the device
usbguard allow-device -p 77
sudo chmod -R 777 /dev/bus/usb/
, why not
Contributing
Contributions to usb_hid_magstripe_reader
are welcome! If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository. Pull requests are also appreciated.