diff options
Diffstat (limited to 'nfc_bulk.py')
-rwxr-xr-x | nfc_bulk.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/nfc_bulk.py b/nfc_bulk.py new file mode 100755 index 0000000..ad6f896 --- /dev/null +++ b/nfc_bulk.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +import usb1, libusb1 +import time, struct + +ctx = usb1.LibUSBContext() + +dev = ctx.getByVendorIDAndProductID(0x1d50, 0x60f8) + +if not dev: + print 'Device not found.' + exit(1) + +handle = dev.open() +handle.claimInterface(1) + +def transfer_cb(t): + data = t.getBuffer()[:t.getActualLength()] + + print time.strftime('%H:%M:%S'), + print 'Card detected. UID: %s' % ':'.join('%02x' % ord(c) for c in data) + + return True + +th = usb1.USBTransferHelper() +th.setEventCallback(libusb1.LIBUSB_TRANSFER_COMPLETED, transfer_cb) + +t = handle.getTransfer() +t.setBulk(0x81, 64, th) +t.submit() + +while 1: + ctx.handleEvents() |