#6 Connecting with readers() and listReaders()

closed-fixed
5
2010-12-17
2010-10-07
No

The expected result would be to open a session to the card in reader with number readernum.

The older listReaders() works as expected:
reader = smartcard.System.listReaders()[readernum]
session = smartcard.Session(reader)

The same example with the newer readers():
reader = smartcard.System.readers()[readernum]
session = smartcard.Session(reader)
...throws the following error:
File "/usr/lib/pymodules/python2.6/smartcard/pcsc/PCSCCardConnection.py", line 111, in connect
raise CardConnectionException( 'Unable to connect with protocol: ' + dictProtocol[pcscprotocol] + '. ' + SCardGetErrorMessage(hresult) )
smartcard.Exceptions.CardConnectionException: 'Smartcard Exception: Unable to connect with protocol: T0 or T1. No smart card inserted.!'

Discussion

  • jean-daniel aussel

    • labels: --> PCSC wrapper
    • assigned_to: nobody --> jdaussel
    • status: open --> open-accepted
     
  • jean-daniel aussel

     
  • jean-daniel aussel

    test script:

    import smartcard.System
    import smartcard.Session
    from smartcard.util import toHexString

    readernum=0
    reader=smartcard.System.readers()[readernum]
    session = smartcard.Session(reader)
    print toHexString( session.getATR() )
    session.close()

    reader=smartcard.System.listReaders()[readernum]
    session = smartcard.Session(reader)
    print toHexString( session.getATR() )
    session.close()

    Test script output:

    3B 16 18 20 02 01 00 80 0D
    3B 16 18 20 02 01 00 80 0D

     
  • jean-daniel aussel

    • status: open-accepted --> closed-fixed
     

Log in to post a comment.