Commits

Benoît Allard committed 4d2e5cf Draft

pycsc: Add support for SCardControl

Comments (0)

Files changed (2)

webscard/implementations/pycsc/__init__.py

         return scard.SCARD_S_SUCCESS
 
     def SCardControl(self, hCard, dwControlCode, inBuffer):
-        pass
+        return self.reader.Control(hCard, dwControlCode, inBuffer)
 
     def __str__(self):
         return textwrap.dedent("""\

webscard/implementations/pycsc/reader.py

             state |= scard.SCARD_STATE_CHANGED
         return scard.SCARD_S_SUCCESS, [(self.name, state, atr)]
 
+    def Control(self, card, controlCode, buffer):
+        if card not in self.cards:
+            return scard.SCARD_E_INVALID_HANDLE, []
+        return scard.SCARD_E_UNSUPPORTED_FEATURE, []
+        
     def __str__(self):
         return textwrap.dedent("'"+self.name + """'\
          with one token inside: