Question

I have a RFID project, and wants the system to detect the card on the card reader as it is in read range and capture the UID and continue the process. As of now I have placed a button called ScanCard, in it I have placed the card read functionality, which would return the UID of the Card. I am using just two type of ATR. Want to get rid of the Scan Card button and want to automate the scanning function. I am using Python 2.7 and HID Omnikey Card Reader on Windows 7

atr = "3B 8F 80 01 80 4F 0C A0 00 00 03 06 0A 00 18 00 00 00 00 7A"

cardtype = ATRCardType( toBytes( "%s" %(atr) ))

cardrequest = CardRequest( timeout=1, cardType=cardtype )

cardservice = cardrequest.waitforcard()

cardservice.connection.connect()

SELECT = [0xFF, 0xCA, 0x00, 0x00, 0x00]

apdu = SELECT

print 'sending ' + toHexString(apdu)

response, sw1, sw2 = cardservice.connection.transmit( apdu )

print 'response: ', response, ' status words: ', "%x %x" % (sw1, sw2)

tagid = toHexString(response).replace(' ','')

print "tagid ",tagid

id = tagid

print" UID is",id

The above code is what I am following now. I need to keep the wait for card unlimited, what could be a optimum way to do it?

Was it helpful?

Solution

Maybe try the official pyscard documentation, such as the part on monitoring, which I have linked to.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top