card close command
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@72 f711b948-2313-0410-aaa9-d29f33439f0b
This commit is contained in:
parent
ef5ff028a5
commit
8e845292bb
|
@ -154,3 +154,7 @@ class Card:
|
|||
|
||||
def get_protocol(self):
|
||||
return ((self.card.status()["Protocol"] == pycsc.SCARD_PROTOCOL_T0) and (0,) or (1,))[0]
|
||||
|
||||
def close_card(self):
|
||||
"Disconnect from a card"
|
||||
del self.card # FIXME: anything else to do?
|
||||
|
|
|
@ -9,8 +9,20 @@ def cmd_atr(card, *args):
|
|||
"""Print the ATR of the currently inserted card."""
|
||||
print "ATR: %s" % utils.hexdump(card.card.status()['ATR'], short=True)
|
||||
|
||||
def cmd_close(card, *args):
|
||||
"Close the connection to the currently inserted card"
|
||||
shell.unregister_post_hook(_print_sw)
|
||||
shell.fallback = None
|
||||
shell.unregister_pre_hook(_clear_sw)
|
||||
shell.unregister_pre_hook(_update_prompt)
|
||||
shell.unregister_commands(card)
|
||||
shell.unregister_commands(card, COMMANDS)
|
||||
card.close_card()
|
||||
shell.set_prompt("(No card) ")
|
||||
|
||||
COMMANDS = {
|
||||
"atr": cmd_atr
|
||||
"atr": cmd_atr,
|
||||
"close_card": cmd_close,
|
||||
}
|
||||
|
||||
def list_readers():
|
||||
|
|
Loading…
Reference in New Issue