【问题标题】:Read an unique ID from RFID card in Python在 Python 中从 RFID 卡中读取唯一 ID
【发布时间】:2014-03-12 10:17:28
【问题描述】:

我有一个 OmniKey 5321 智能卡读卡器和一台装有 Debian 的 PC。以下 Python 代码读取卡片:

from smartcard.CardMonitoring import CardMonitor, CardObserver
from smartcard.util import *
import sys

class printobserver( CardObserver ):
    def update( self, observable, (addedcards, removedcards) ):
        for card in addedcards:
            print "+Inserted: ", toHexString( card.atr )
        for card in removedcards:
            print "-Removed:  ", toHexString( card.atr )

try:
    print "Insert or remove a smartcard in the system."
    print ""
    cardmonitor = CardMonitor()
    cardobserver = printobserver()
    cardmonitor.addObserver( cardobserver )
    raw_input('Press Enter to exit\n')
except:
    print "Unexpected error: ", sys.exc_info()[0]

Python 代码运行良好,但返回给我许多卡片的相同 atr 标记。给定的 atr 是:

3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A

如何从卡片中读取独特的内容?我知道我必须发送一些命令,并且回复将包含 UID,但是我怎样才能找到这些命令?我将如何发送它们?

谢谢!

【问题讨论】:

    标签: python smartcard rfid smartcard-reader contactless-smartcard


    【解决方案1】:

    连接到卡(或实际上是读卡器)后,您可以发送 PC/SC 标准化命令从读卡器获取卡 UID:

    FF CA 00 00 00
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-20
      • 2019-02-19
      相关资源
      最近更新 更多