我一直在研究hid omnikey 5325 cl并尝试获取ATR值。我在Ubuntu上使用pcscd和pyscard库。系统使用T0协议自动获取ATR,但我需要RAW返回。在使用helloprox或omnikey的官方软件的Windows上,我可以得到我需要的东西,但是在ubuntu上,即使我已经改变了协议但是ATR没有改变。
这是我使用的代码:
class PrintObserver(CardObserver):
"""A simple card observer that is notified
when cards are inserted/removed from the system and
prints the list of cards
"""
def update(self, observable, actions):
(addedcards, removedcards) = actions
for card in addedcards:
card.connection=card.createConnection()
card.connection.connect(protocol=CardConnection.RAW_protocol)
binary_atr=bin(int(toHexString(card.connection.getATR()).replace(" ",""), 16))
binary_atr=binary_atr[len(binary_atr)-24:len(binary_atr)-1]
print int(binary_atr,2)
for card in removedcards:
print "-Removed: ", toHexString(card.atr)
if __name__ == '__main__':
cardmonitor = CardMonitor()
cardobserver = PrintObserver()
cardmonitor.addObserver(cardobserver)
#Get Ports
config=ConfigParser.ConfigParser()
config.read('../config.ini')
Read_Port=int(config.get('CardReaderSocketPorts','Read',0))
Write_Port=int(config.get('CardReaderSocketPorts','Write',0))
# Initialise socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_address = ('localhost', Read_Port)
return_address = ('localhost', Write_Port)
sock.bind(server_address)
while 1:
message, address = sock.recvfrom(4096)
if message:
parsed_json=json.loads(message)
#Single Line
if parsed_json['set'].upper()=="Stop":
sock.sendto('{"success":"True"}',return_address)
break
# don't forget to remove observer, or the
# monitor will poll forever...
cardmonitor.deleteObserver(cardobserver)
答案 0 :(得分:0)
某些注意事项可能会有所帮助,即使它们没有添加完整的答案:
所以我的建议是,联系Omnikey支持,如何从Linux继续。根据我的经验,他们是合作的。
答案 1 :(得分:0)
联系Omnikey支持后,问题就解决了。 和developer guide一样,我正在寻找配置文件" /etc/cmrfid.ini"更改prox格式。文件名已更改为" /etc/Omnikey.ini"