[Pcsclite-cvs-commit] Drivers/ccid/src ifdhandler.c,1.17,1.18
rousseau@haydn.debian.org
rousseau@haydn.debian.org
Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory haydn:/tmp/cvs-serv1215/src
Modified Files:
ifdhandler.c
Log Message:
Reset action if power off and power on, not just power on
Index: ifdhandler.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ifdhandler.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- ifdhandler.c 12 Feb 2004 16:11:45 -0000 1.17
+++ ifdhandler.c 18 Mar 2004 10:35:53 -0000 1.18
@@ -370,51 +370,45 @@
if (CheckLun(Lun))
return IFD_COMMUNICATION_ERROR;
- switch (Action)
+ if ((IFD_POWER_DOWN == Action) || (IFD_RESET == Action))
{
- case IFD_POWER_UP:
- case IFD_RESET:
- nlength = sizeof(pcbuffer);
- if (CmdPowerOn(Lun, &nlength, pcbuffer) != IFD_SUCCESS)
- {
- DEBUG_CRITICAL("PowerUp failed");
- return_value = IFD_ERROR_POWER_ACTION;
- goto end;
- }
-
- /* Power up successful, set state variable to memorise it */
- CcidSlots[LunToReaderIndex(Lun)].bPowerFlags |=
- MASK_POWERFLAGS_PUP;
- CcidSlots[LunToReaderIndex(Lun)].bPowerFlags &=
- ~MASK_POWERFLAGS_PDWN;
+ /* Clear ATR buffer */
+ CcidSlots[LunToReaderIndex(Lun)].nATRLength = 0;
+ *CcidSlots[LunToReaderIndex(Lun)].pcATRBuffer = '\0';
- /* Reset is returned, even if TCK is wrong */
- CcidSlots[LunToReaderIndex(Lun)].nATRLength = *AtrLength =
- (nlength < MAX_ATR_SIZE) ? nlength : MAX_ATR_SIZE;
- memcpy(Atr, pcbuffer, *AtrLength);
- memcpy(CcidSlots[LunToReaderIndex(Lun)].pcATRBuffer,
- pcbuffer, *AtrLength);
+ /* Memorise the request */
+ CcidSlots[LunToReaderIndex(Lun)].bPowerFlags |=
+ MASK_POWERFLAGS_PDWN;
+ /* send the command */
+ return_value = CmdPowerOff(Lun);
- return_value = CardUp(Lun);
- break;
+ return_value = CardDown(Lun);
+ }
- case IFD_POWER_DOWN:
- /* Clear ATR buffer */
- CcidSlots[LunToReaderIndex(Lun)].nATRLength = 0;
- *CcidSlots[LunToReaderIndex(Lun)].pcATRBuffer = '\0';
+ if ((IFD_POWER_UP == Action) || (IFD_RESET == Action))
+ {
+ nlength = sizeof(pcbuffer);
+ if (CmdPowerOn(Lun, &nlength, pcbuffer) != IFD_SUCCESS)
+ {
+ DEBUG_CRITICAL("PowerUp failed");
+ return_value = IFD_ERROR_POWER_ACTION;
+ goto end;
+ }
- /* Memorise the request */
- CcidSlots[LunToReaderIndex(Lun)].bPowerFlags |=
- MASK_POWERFLAGS_PDWN;
- /* send the command */
- return_value = CmdPowerOff(Lun);
+ /* Power up successful, set state variable to memorise it */
+ CcidSlots[LunToReaderIndex(Lun)].bPowerFlags |=
+ MASK_POWERFLAGS_PUP;
+ CcidSlots[LunToReaderIndex(Lun)].bPowerFlags &=
+ ~MASK_POWERFLAGS_PDWN;
- return_value = CardDown(Lun);
- break;
+ /* Reset is returned, even if TCK is wrong */
+ CcidSlots[LunToReaderIndex(Lun)].nATRLength = *AtrLength =
+ (nlength < MAX_ATR_SIZE) ? nlength : MAX_ATR_SIZE;
+ memcpy(Atr, pcbuffer, *AtrLength);
+ memcpy(CcidSlots[LunToReaderIndex(Lun)].pcATRBuffer,
+ pcbuffer, *AtrLength);
- default:
- DEBUG_CRITICAL("Action not supported");
- return_value = IFD_NOT_SUPPORTED;
+ return_value = CardUp(Lun);
}
end: