Stef Hoeben wrote, On 10/08/2010 11:23 AM:
> Hello,
> 
> (sorry, slightly off-topic: about PCSC but not restricted to pcsc-lite)
> 
> here's our problem: a 3rd party app, without our control, messes
> up our smart by regularly sending a number of APDUs that the card
> doesn't digest well. Only solution seems to be a warm or cold reset.
> 

Does the 3rd party app actually work with the card/for it's real work?
Have you submitted a bug report to the 3rd party or even the card|applet maker?

> So we do an SCardBeginTransaction() and when we send a command
> using SCardTransmit(), we see the card is messed up.
> 
> Now the question is: can we do a reset without losing our exclusive
> hold on the card? (Because otherwise the 3rd party app messes up
> the card again.)
> 
> This doesn't seem to work:

<somewhat tongue in cheek response>
... Bigger hammer theory, i.e., not the right way but has a chance to work.

Prepare for sledge hammer method, i.e., find the PID of the 3rd party app, and 
make sure you are root.
 man 7 signal

>   SCardBeginTransaction()
>   SCardTransmit()  --> here we notice the card is messed up

/* be somewhat nice */
system("kill SIGSTOP PID3rdPartApp")
/* hey.. at least it wasn't SIGKILL */

>   SCardReconnect(SCARD_RESET_CARD)  --> resets but also break the
> transaction
>   SCardBeginTransaction
>   SCardTransmit()

/* be nicer */
system("kill SIGCONT PID3rdPartApp")

> The reason is that the 3rd party app is often faster to do an
> SCardBeginTransaction() and messes up the card again.
> 
> Any bright ideas? Or something obvious that we missed?
> 

Of course the 3rd party app might not be built to survive the SIGSTOP and 
SIGCONT.
And you should document for your app users that this is being done so they can 
be aware of why
strange things happen with the third party app.


-- 
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter

_______________________________________________
Muscle mailing list
Muscle@lists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to