{"action":"created","issue":{"url":"https://api.github.com/repos/LudovicRousseau/pyscard/issues/60","repository_url":"https://api.github.com/repos/LudovicRousseau/pyscard","labels_url":"https://api.github.com/repos/LudovicRousseau/pyscard/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/LudovicRousseau/pyscard/issues/60/comments","events_url":"https://api.github.com/repos/LudovicRousseau/pyscard/issues/60/events","html_url":"https://github.com/LudovicRousseau/pyscard/issues/60","id":328770793,"node_id":"MDU6SXNzdWUzMjg3NzA3OTM=","number":60,"title":"Cards take too long to disconnect after authentication","user":{"login":"abkarino","id":9306140,"node_id":"MDQ6VXNlcjkzMDYxNDA=","avatar_url":"https://avatars0.githubusercontent.com/u/9306140?v=4","gravatar_id":"","url":"https://api.github.com/users/abkarino","html_url":"https://github.com/abkarino","followers_url":"https://api.github.com/users/abkarino/followers","following_url":"https://api.github.com/users/abkarino/following{/other_user}","gists_url":"https://api.github.com/users/abkarino/gists{/gist_id}","starred_url":"https://api.github.com/users/abkarino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abkarino/subscriptions","organizations_url":"https://api.github.com/users/abkarino/orgs","repos_url":"https://api.github.com/users/abkarino/repos","events_url":"https://api.github.com/users/abkarino/events{/privacy}","received_events_url":"https://api.github.com/users/abkarino/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-06-02T19:29:07Z","updated_at":"2018-10-03T12:58:13Z","closed_at":null,"author_association":"NONE","body":"I have a script that authenticates Mifare Classic 1K. However, the reader takes around 2 second to be ready to sense another card. This issue happens if I attempt to authenticate the card using stored key.\r\nIf I remove the code that authenticates (or throw the error `Card not supported` always), it takes less than 0.1 sec to sense the card is removed. Any ideas of the reason?\r\nP.S. The buzzer and LED control don't affect the bug. If removed, the led is turned off for 2 seconds after the communication.\r\nI am using Python27x64 on Windows10.\r\n\r\nHere is my code:\r\n```python\r\nclass PrintObserver(CardObserver):\r\n\t\"\"\"A simple card observer that is notified\r\n\twhen cards are inserted/removed from the system and\r\n\tprints the list of cards\r\n\t\"\"\"\r\n\tMifareClassic = [0x3B, 0x8F, 0x80, 0x01, 0x80, 0x4F, 0x0C, 0xA0, 0x00, 0x00, 0x03, 0x06, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x6A]\r\n\tAuth = [0xFF, 0x86, 0x00, 0x00, 0x05, 0x01, 0x00, 0x3c, 0x60, 0x00]\r\n\tWrongBeeb = [0xFF, 0x00, 0x40, 0x5a, 0x04, 0x01, 0x01, 0x02, 0x01]\r\n\tAuthBlock15 = [0xFF, 0xB0, 0x00, 0x3c, 0x10]\r\n\tSuccessBeeb = [0xFF, 0x00, 0x40, 0x5a, 0x04, 0x01, 0x00, 0x01, 0x01]\r\n\r\n\tdef update(self, observable, actions):\r\n\t\t(addedcards, removedcards) = actions\r\n\t\tfor card in addedcards:\r\n\t\t\ttry:\r\n\t\t\t\tcard.connection = card.createConnection()\r\n\t\t\t\tcard.connection.connect()\r\n\t\t\t\tif card.atr != self.MifareClassic:\r\n\t\t\t\t\traise Exception(\"Card not supported\")\r\n\t\t\t\tdata, sw1, sw2 = card.connection.transmit(self.Auth)\r\n\t\t\t\tif (sw1, sw2) == (0x90, 0x0):\r\n\t\t\t\t\tdata, sw1, sw2 = card.connection.transmit(self.AuthBlock15)\r\n\t\t\t\t\tprint (\"block \"+ str(15) +\":\\t\"+ toHexString(data) +\" | \"+''.join(chr(i) for i in data))\r\n\t\t\t\t\tcard.connection.transmit(self.SuccessBeeb)\r\n\t\t\t\telif (sw1, sw2) == (0x63, 0x0):\r\n\t\t\t\t\traise Exception(\"Key not working\")\r\n\t\t\texcept Exception as e:\r\n\t\t\t\ttry:\r\n\t\t\t\t\tcard.connection.transmit(self.WrongBeeb)\r\n\t\t\t\texcept:\r\n\t\t\t\t\tpass\r\n\t\t\t\tprint(e.message)\r\n\t\t\t\tpass\r\n```"},"comment":{"url":"https://api.github.com/repos/LudovicRousseau/pyscard/issues/comments/426627869","html_url":"https://github.com/LudovicRousseau/pyscard/issues/60#issuecomment-426627869","issue_url":"https://api.github.com/repos/LudovicRousseau/pyscard/issues/60","id":426627869,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjYyNzg2OQ==","user":{"login":"abkarino","id":9306140,"node_id":"MDQ6VXNlcjkzMDYxNDA=","avatar_url":"https://avatars0.githubusercontent.com/u/9306140?v=4","gravatar_id":"","url":"https://api.github.com/users/abkarino","html_url":"https://github.com/abkarino","followers_url":"https://api.github.com/users/abkarino/followers","following_url":"https://api.github.com/users/abkarino/following{/other_user}","gists_url":"https://api.github.com/users/abkarino/gists{/gist_id}","starred_url":"https://api.github.com/users/abkarino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abkarino/subscriptions","organizations_url":"https://api.github.com/users/abkarino/orgs","repos_url":"https://api.github.com/users/abkarino/repos","events_url":"https://api.github.com/users/abkarino/events{/privacy}","received_events_url":"https://api.github.com/users/abkarino/received_events","type":"User","site_admin":false},"created_at":"2018-10-03T12:58:13Z","updated_at":"2018-10-03T12:58:13Z","author_association":"NONE","body":"I see `hresult = SCardDisconnect(hcard, SCARD_UNPOWER_CARD)` in get the ATR of a card\r\nbut don't know how to integrate since I use observer approach. "}}
{"actor":{"display_login":"abkarino"}}