[Pcsclite-muscle] advise about get UID from ACR122U on raspbery pi
Ehab ahmed
ihabaf at gmail.com
Fri Nov 10 09:22:12 PST 2023
Hello,
iam trying to get card UID from ACR122U on Raspberry Pi 3B , raspian
OS buster (10) installed,
i have modified the pcs_scan tool code (stress function) from
pcsc-tools package programmed by Ludovic Rousseau
and added the following section
static LONG stress(SCARDCONTEXT hContext2, const char *readerName)
{
LONG rv, ret_rv = SCARD_S_SUCCESS;
SCARDHANDLE hCard;
DWORD dwActiveProtocol;
const SCARD_IO_REQUEST *pioSendPci;
//printf(" we are in stress function \n");
if (Options.verbose)
{
printf("Stress card in reader: %s\n\n", readerName);
}
else
printf("\n");
//printf("we are before call to scardconnect function\n");
rv = SCardConnect(hContext2, readerName, SCARD_SHARE_SHARED,
SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &hCard, &dwActiveProtocol);
if (rv != SCARD_S_SUCCESS)
{
print_pcsc_error("SCardConnect failure rv=\n", rv);
return rv;
}
//printf(" we are after sdcard connect \n");
/* Select Master File */
BYTE pbSendBuffer[] = {0, 0xA4, 0, 0, 2, 0x3F, 0};
BYTE pbRecvBuffer[256+2];
DWORD dwSendLength, dwRecvLength;
struct timeval time_start, time_end;
==================================================================
const BYTE cmdGetUID[] = { 0xFF, 0xCA, 0x00, 0x00, 0x00 };
printf(" we are before send command to get UID \n");
dwRecvLength = sizeof(pbRecvBuffer);
rv = SCardTransmit(hCard, SCARD_PCI_T1, cmdGetUID, sizeof(cmdGetUID),
NULL, pbRecvBuffer, &dwRecvLength);
if (rv == SCARD_S_SUCCESS)
{
printf("UID: ");
for (DWORD i = 0; i < dwRecvLength; ++i)
{
printf("%02X ", pbRecvBuffer[i]);
}
printf("\n");
}
else
{
printf("error reading UID, rv=%d\n",rv);
}
printf(" we are after send command to get UID \n");
=================================================================
the problem is that the UID returning is some time 63 00 only, any
advices are appreciated
More information about the pcsclite-muscle
mailing list