Crates.io | usb_hid_magstripe_reader |
lib.rs | usb_hid_magstripe_reader |
version | 0.1.0 |
source | src |
created_at | 2023-12-24 12:54:50.867935 |
updated_at | 2023-12-24 12:54:50.867935 |
description | USB HID Magstripe reader driver (Megahunt HID FS Keyboard / Run Mall) |
homepage | https://github.com/alexile/usb_hid_magstripe_reader |
repository | https://github.com/alexile/usb_hid_magstripe_reader |
max_upload_size | |
id | 1079700 |
size | 9,560 |
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.
To use usb_hid_magstripe_reader
in your Rust project, add the following line to your Cargo.toml
file:
[dependencies]
usb_hid_magstripe_reader = "0.1.0"
Here's a simple example demonstrating how to use usb_hid_magstripe_reader
:
use usb_hid_magstripe_reader::MagstripeReader;
fn main() {
let vendor_id = 0xffff; // Replace with your magstripe reader's vendor ID, mine came with 0xffff
let product_id = 0x0035; // Replace with your magstripe reader's product ID, mine came with 0x0035
let result = MagstripeReader::read(vendor_id, product_id); // At this point, you need to swipe a card
println!("Magstripe data: {}", data)
}
Make sure to replace the vendor_id
and product_id
values with the appropriate values for your specific magstripe reader.
lsusb
ffff:0035
part, where ffff
is a vendor_id and 0035
is a product_idThere's a chance the library cannot open a device.
dmesg
. If it writes something like Device is not authorized for usage
, it means usbguard
doesn't recognize the deviceusbguard list-devices
usbguard allow-device -p 77
sudo chmod -R 777 /dev/bus/usb/
, why notContributions 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.