SCardListReaders() returns 1 reader but empty reader string?
I am trying to access an NFC reader programatically from either linux or os X, using either the ACR122 or the ACS SCL010 readers. Unfortunately the musclecard library does not appear to work for either these devices/platforms so I am trying to access these devices directly using PC/SC calls. At the moment I am running into an odd problem where SCardListReaders() returns the correct number of readers attached to the system but no reader string. The pertinent piece of my program at the moment resembles this... - (void)findPCSCDevices { NSLog(@"Find PCSC Devices"); // Get a connection to the pcsc daemon. MSCLong32 rv; SCARDCONTEXT localHContext = 0; rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, 0, 0, &localHContext); if (rv != SCARD_S_SUCCESS) { NSLog(@"SCard establish connection failed w/ error %s", pcsc_stringify_error(rv)); return; } // Get the reader list size. MSCULong32 readerLength = 0; rv = SCardListReaders(localHContext, NULL, NULL, &readerLength); if (rv != SCARD_S_SUCCESS) { NSLog(@"SCard get readers failed w/ error %s", pcsc_stringify_error(rv)); return; } else { NSLog(@"SCard get readers found %d readers", readerLength); } // Fetch a full list of attached readers. char *readerList = (char *) malloc(sizeof(char) * readerLength); assert(readerList); rv = SCardListReaders(localHContext, NULL, readerList, &readerLength); NSLog(@"%d readers - readerlist %s", readerLength, readerList); <snip> } This function prints the following when run. [Session started at 2009-06-04 14:49:18 -0700.] *2009-06-04 14:49:18.691 POS[11034:10b] Find PCSC Devices* *2009-06-04 14:49:18.693 POS[11034:10b] SCard get readers found 1 readers* *2009-06-04 14:49:18.693 POS[11034:10b] 1 readers - readerlist * Shouldn't SCardListReaders() return a valid reader string or an error? Also is it possible for me to look up the tokeninfo for the particular devices I am trying to use and use this info to explicitly connect to them instead of reading and parsing the reader info in this fashion? Thanks for the help, J
participants (1)
-
Johnny Alaska