Le 20/07/2011 19:30, Viktor Tarasov a écrit :
Le 20/07/2011 19:04, Ludovic Rousseau a écrit :
2011/7/19 Viktor Tarasov<viktor.tara...@gmail.com>:
Le 18/07/2011 14:52, Ludovic Rousseau a écrit :
2011/7/10 Viktor Tarasov<viktor.tara...@gmail.com>:
Hi,
Hello,

there is patch proposal to treat properly the 'detach token(reader)'
event
and to remove the slots associated to the removed token.

Tested in Linux and windows.
'SCardGetStatusChange' have different behavior in Linux and Windows.
Needs to be studied and validated for Mac.


https://github.com/viktorTarasov/OpenSC/commit/62bda63bd66c4849c0ca4303a9682fb6f6bacd7d
  /* When token is hot-unplugged:
   * - in Linux (pcsc-lite)
   * -- SCardGetStatusChange returns OK;
   * -- current reader state is 'UNKNOWN';
   * -- 'Refresh-attributes' returns 'SC_ERROR_READER_DETACHED'.
   *
   * - in Windows (WinSCard):
   * -- SCardGetStatusChange failes with SCARD_E_NO_READERS_AVAILABLE;
   * -- 'Refresh-attributes' returns 'SC_ERROR_NO_READERS_FOUND'.
   *
   * - FIXME: Mac?
   */

I just checked on Mac OS X 10.6.8 (Snow Leopard) and I have nearly the
same result as on GNU/Linux.
On GNU/Linux : new state is 14 =>    ['Changed', 'Unknown', 'Unavailable']
On Mac OS X : new state is 6 =>    ['Changed', 'Unknown]

On Windows, do you also get the error SCARD_E_NO_READERS_AVAILABLE
when you use TWO readers in the SCardGetStatusChange() call?
I do not completely follow.

SCardGetStatusChange is called by refresh_attributes(sc_reader_t *reader).
In this context there is only one reader.
The question was about SCardGetStatusChange() on Windows in general
not just its use by OpenSC.

I will do the test myself.


I honestly tried to do it, installed Pyton on windows, tried to run your script.
It gave syntax error on 'print' command. I don't know Pyton and postponed 'C' 
test program until the weeked.
That's why such answer.


In attachment there are parts of the debug logs coming from the 'hot-plug' 
pkcs#11 tests.
The logs are extracted around the test of C_WaitForSlotEvent(), slightly 
modified to allow blocking mode .

For windows there are traces of two tests: detachment of unique and non-unique 
readers.

What I could see is:
- after an event happens the first SCardGetStatusChange returns OK in all cases;
- on windows there is no difference in logs whether the reader was unique or 
not;
- the difference between linux and windows appears on the second (?? rather 
non-first) SCardGetStatusChange(), called by refresh-attributes.

I do not looked further.
Tell me is you need more detailed logs.

Regards,
Viktor.

Attachment: detach-token-logs.tgz
Description: application/compressed-tar

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to