2012/8/7 Raghavendhra Chowdary MV <[email protected]>:
> I tried implementing TAG_IFD_POLLING_THREAD_WITH_TIMEOUT as specified in
> http://pcsclite.alioth.debian.org/api/group__IFDHandler.html#ga799aa26945bbd3f61aaa57107f63ae0b
>
> following is the code snippet of ifdhandler of my
>
> RESPONSECODE foo_for_TIMEOUT(int Lun, int timeout)
> {
> return IFD_ICC_NOT_PRESENT; /* or return IFD_ICC_NOT_PRESENT; */
> }
The function should just return when a card event happens.
The return value shall be IFD_SUCCESS on success.
> RESPONSECODE IFDHGetCapabilities ( DWORD Lun, DWORD Tag, PDWORD Length,
> PUCHAR Value )
> {
> switch (Tag)
> {
> /* There are many TAGS I am skipping all of them*/
> case TAG_IFD_POLLING_THREAD_WITH_TIMEOUT:
> *Length = 1;
> *Value = foo_for_TIMEOUT(Lun, 5); /* 5 is taken in which
> measure by pcscd whether 5 seconds?? or 5 milliseconds or 5 microseconds??*/
> break;
> }
> return IFD_SUCCESS;
> }
>
> Please help me out if I am doing any silly mistake please excuse.
You have to store in the Value array a pointer on a function.
So the size of 1 is wrong. It must be the size of a pointer.
The code *Value = foo_for_TIMEOUT(Lun, 5) is also wrong. You need to
store the function _address_ not the function result. Remember that it
is a callback.
Your code should be something like:
*Length = sizeof(void *);
*(void **)Value = foo_for_TIMEOUT;
The timeout parameter unit is milliseconds. pcscd uses default value of
#define PCSCLITE_STATUS_EVENT_TIMEOUT 10*60*1000 /* 10 minutes */
Bye
--
Dr. Ludovic Rousseau
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle