[SmartcardServices-Dev] Trouble w/ pcscd and MSC

Johnny Alaska johnnyalaska at gmail.com
Tue Jun 2 15:41:05 PDT 2009


I am trying to develop a mac os X application (in cocoa) that uses the pcscd
to access a couple of CCID compliant devices. The long term goal is to use
these devices to recognize which user is interacting w/ the program. At the
moment I am just getting started and trying to figure out how to use the
pcscd.


To get started I wrote the following routine to list the smart card devices
that are attached to my mac...


- (void)ListSmartCardDevices {

MSCLPTokenInfo tokenList;

MSC_RV rv;

MSCULong32 listSize = 0;

 rv = MSCListTokens( MSC_LIST_KNOWN, NULL, &listSize );

if (rv != MSC_SUCCESS) {

char *err_str = pcsc_stringify_error(rv);

NSLog(@"MSCListTokens failed for reason %s", err_str);

return;

}

 if (listSize == 0) {

NSLog(@"MSCListTokens found no smart cards");

return;

}

 tokenList = (MSCLPTokenInfo)malloc(sizeof(MSCTokenInfo)*listSize);

rv = MSCListTokens( MSC_LIST_KNOWN, tokenList, &listSize );

if (rv != MSC_SUCCESS) {

char *err_str = pcsc_stringify_error(rv);

NSLog(@"MSCListTokens failed for reason %s", err_str);

return;

}

 for (int i = 0; i < listSize; i++) {

printf("Token name    : %s\n", tokenList[i].tokenName);

printf("Slot name     : %s\n", tokenList[i].slotName);

}

}


If I run my program (which includes this routine) w/ no smartcards plugged
in I get the following (predictable) output.


[Session started at 2009-06-02 15:37:14 -0700.]

*2009-06-02 15:37:15.155 POS[59501:10b] MSCListTokens found no smart cards*


If I then plug in the ACR122 device from ACS system and rerun my program I
get the following error


[Session started at 2009-06-02 15:38:18 -0700.]

*2009-06-02 15:38:19.470 POS[59511:10b] MSCListTokens failed for reason
Unknown PCSC error: 40019 [0x00009C53]*


I get a similar error if I plug in the SCL010 card reader from SCM
microsystems.


Can anyone suggest any debugging next steps?


Cheers, J


More information about the SmartcardServices-Dev mailing list