Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > when i install my smart card driver i get this error[The reader cannot communicate with the smart card, due to ATR configuration conflicts]

Reply
Thread Tools Display Modes

when i install my smart card driver i get this error[The reader cannot communicate with the smart card, due to ATR configuration conflicts]

 
 
abc
Guest
Posts: n/a

 
      08-10-2007
Hi ,

I have written a smart card reader driver{contactless smart card
reader}, When i install the driver and open a reader application , i
get a error as

The reader cannot communicate with the smart card, due to ATR
configuration conflicts.

Can some body tell me why this occurs ,

my power call back function looks as below,


NTSTATUS phNfc4Win_ScardPower(PSMARTCARD_EXTENSION SmartcardExtension)
{
NTSTATUS status = STATUS_SUCCESS;
KIRQL irql;
static BYTE AtrBuffer[PH_MAX_ATR_BUFFER_SIZE];
BYTE Atrlength =0;
PDEVICE_CONTEXT pDevContext;
BYTE i = 0;

BYTE index =0;
BYTE crcdata = 0;

pDevContext =
GetDeviceContext(WdfWdmDeviceGetWdfDeviceHandle(Sm artcardExtension-
>OsData->DeviceObject));


KdPrint(("%sVdPowerReader\n"));

if ((status = SmartcardAcquireRemoveLock(SmartcardExtension)) !=
STATUS_SUCCESS)
{
SmartcardExtension->IoRequest.Information = 0;
}
else
{
switch (SmartcardExtension->MinorIoControlCode)
{
case SCARD_POWER_DOWN :
{
KdPrint(("\t%sSCARD_POWER_DOWN\n"));
SmartcardExtension->CardCapabilities.ATR.Length = 0;
*(SmartcardExtension->IoRequest.Information) = 0;
status = STATUS_SUCCESS;
break;
}
case SCARD_COLD_RESET :
{
/* change this data based on were we store the ATR */

//status = phNfc4Win_GetAtrInformation(&pDevContext-
>RemDevInfo,AtrBuffer,&Atrlength);

index = 5 + pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength;


buffer[0] = 0x3B;
buffer[1] = (0x80 + pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength);

buffer[2] = 0x80;
buffer[3] = 0x01;
memcpy((buffer +4),pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt es,

pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength);

for (index= 1; index<(4 + pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength); index++)

{
crcdata = crcdata ^ buffer[index];
}
buffer[pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength+4]=

crcdata;

Atrlength = (5 + pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength);


SmartcardExtension->ReaderCapabilities.CurrentState =
SCARD_SPECIFIC;

SmartcardExtension->CardCapabilities.ATR.Length =
(UCHAR)Atrlength;
*(SmartcardExtension->IoRequest.Information) =
(UCHAR)Atrlength;
for(i = 1; i<= 48; i++ )
{
KdPrint(("buffer 0x%x \n",buffer[i]));
}
RtlCopyMemory(SmartcardExtension->IoRequest.ReplyBuffer, buffer,
Atrlength);
RtlCopyMemory(SmartcardExtension->CardCapabilities.ATR.Buffer,
buffer, Atrlength);
//RtlCopyMemory(SmartcardExtension->IoRequest.ReplyBuffer, buffer,
Atrlength);

/*KeAcquireSpinLock(&SmartcardExtension->OsData->SpinLock,
&irql);
SmartcardExtension->ReaderCapabilities.CurrentState =
SCARD_SPECIFIC;

KeReleaseSpinLock(&SmartcardExtension->OsData->SpinLock,
irql);*/
status = STATUS_SUCCESS;
break;
}
case SCARD_WARM_RESET :
/* change this data based on were we store the ATR */
{
KdPrint(("\t%sSCARD_COLD_RESET\n"));

KeAcquireSpinLock(&SmartcardExtension->OsData->SpinLock,&irql);
//if ( SmartcardExtension->ReaderCapabilities.CurrentState
>SCARD_SWALLOWED )

{
KeReleaseSpinLock(&SmartcardExtension->OsData-
>SpinLock,irql);

//status = phNfc4Win_GetAtrInformation(&pDevContext-
>RemDevInfo,AtrBuffer,&Atrlength);

index = 5 + pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength;

buffer[0] = 0x3B;
buffer[1] = (0x80 + pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength);

buffer[2] = 0x80;
buffer[3] = 0x01;
memcpy(&(buffer[4]),pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt es,

pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength);

for (index= 1; index<(4 + pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength); index++)

{
crcdata = crcdata ^ buffer[index];
}
buffer[pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength+4]=

crcdata;

Atrlength = (5 + pDevContext-
>RemDevInfo.RmDeviceInfo.Nfc106DeviceInfo.HistoByt esLength);

SmartcardExtension->CardCapabilities.ATR.Length =
(UCHAR)Atrlength;
*(SmartcardExtension->IoRequest.Information) =
(UCHAR)Atrlength;
for(i = 1; i<= 48; i++ )
{
KdPrint(("buffer 0x%x \n",buffer[i]));
}
SmartcardExtension->ReaderCapabilities.CurrentState =
SCARD_SPECIFIC;
RtlCopyMemory(SmartcardExtension->IoRequest.ReplyBuffer, buffer,
Atrlength);
RtlCopyMemory(SmartcardExtension->CardCapabilities.ATR.Buffer,
buffer, Atrlength);
//RtlCopyMemory(SmartcardExtension->IoRequest.ReplyBuffer,
buffer, Atrlength);

status = STATUS_SUCCESS;
}
/*else
{
KeReleaseSpinLock(&SmartcardExtension->OsData->SpinLock,irql);
}*/
status = STATUS_SUCCESS;
break;
}
default :
status = STATUS_SUCCESS;
break;
}
SmartcardReleaseRemoveLock(SmartcardExtension);
}
return (STATUS_SUCCESS);
}

thanks ,
Jagadish

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
regarding the smart card reader driver not getting any IOCTL calls. abc Windows Vista Drivers 1 08-07-2007 03:07 PM
KMDF and Smart card reader driver valouflo Windows Vista Drivers 1 10-07-2006 06:24 AM
Virtual smart-card reader driver..... Scott Simon Windows Vista Drivers 0 12-12-2005 08:49 PM
Smart Card USB Reader Driver Example Olga Sayenko Windows Vista Drivers 6 06-16-2004 02:06 PM
Smart Card Reader Driver - update Card State Olga Windows Vista Drivers 1 11-19-2003 04:26 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59