1802 iSessionP = NULL; |
1802 iSessionP = NULL; |
1803 |
1803 |
1804 if( sessP->iCardP != NULL && sessP->iCardP->iUsingSessionP == sessP ) |
1804 if( sessP->iCardP != NULL && sessP->iCardP->iUsingSessionP == sessP ) |
1805 sessP->iCardP->iUsingSessionP = NULL; |
1805 sessP->iCardP->iUsingSessionP = NULL; |
1806 |
1806 |
1807 // iAutoUnlockSession may attach to more than once card, so need to iterate |
1807 // Some sessions may attach to more than once card, so need to iterate |
1808 // through all cards and clear their session pointers if they match sessP |
1808 // through all cards and clear their session pointers if they match sessP |
1809 if (sessP == &iAutoUnlockSession) |
1809 if (sessP == &iAutoUnlockSession || |
|
1810 sessP->iSessionID == ECIMLockUnlock || |
|
1811 sessP->iSessionID == ECIMInitStackAfterUnlock) |
1810 { |
1812 { |
1811 for (TUint i = 0; i < iMaxCardsInStack; i++) |
1813 for (TUint i = 0; i < iMaxCardsInStack; i++) |
1812 { |
1814 { |
1813 TMMCard& cd = *(iCardArray->CardP(i)); |
1815 TMMCard& cd = *(iCardArray->CardP(i)); |
1814 if (cd.iUsingSessionP == sessP) |
1816 if (cd.iUsingSessionP == sessP) |
6061 { |
6068 { |
6062 OstTraceFunctionExitExt( DMMCSTACK_CIMERASESM_EXIT1, this, (TInt) KMMCErrNotSupported ); |
6069 OstTraceFunctionExitExt( DMMCSTACK_CIMERASESM_EXIT1, this, (TInt) KMMCErrNotSupported ); |
6063 return KMMCErrNotSupported; |
6070 return KMMCErrNotSupported; |
6064 } |
6071 } |
6065 |
6072 |
|
6073 DoAddressCard(s.iCardP->iIndex-1); |
|
6074 |
6066 s.iState |= KMMCSessStateInProgress; |
6075 s.iState |= KMMCSessStateInProgress; |
6067 m.SetTraps( KMMCErrInitContext ); |
6076 m.SetTraps( KMMCErrInitContext ); |
6068 |
6077 |
6069 SMF_STATE(EStRestart) |
6078 SMF_STATE(EStRestart) |
6070 |
6079 |
6468 // We've found a locked card with a password in the password store, |
6480 // We've found a locked card with a password in the password store, |
6469 // so attempt to unlock using the CIMLockUnlockSMST state machine. |
6481 // so attempt to unlock using the CIMLockUnlockSMST state machine. |
6470 // |
6482 // |
6471 // Upon completion, test the next card before performing further initialisation. |
6483 // Upon completion, test the next card before performing further initialisation. |
6472 // |
6484 // |
6473 |
|
6474 TMMCard &cd = *(iCardArray->CardP(iAutoUnlockIndex++)); |
|
6475 OstTrace1( TRACE_INTERNALS, DMMCSTACK_CIMAUTOUNLOCKSM4, "Attempting to unlock card %d", cd.Number() ); |
|
6476 |
6485 |
6477 s.SetCard(&cd); |
6486 DoAddressCard(iAutoUnlockIndex); // Address the card |
6478 |
6487 TMMCard* cd = iCardArray->CardP(iAutoUnlockIndex); |
|
6488 s.SetCard(cd); |
|
6489 |
|
6490 SMF_STATE(EStSendStatus) |
|
6491 |
|
6492 s.FillCommandDesc(ECmdSendStatus, 0); |
|
6493 |
|
6494 SMF_INVOKES(ExecCommandSMST,EStGetStatus) |
|
6495 |
|
6496 SMF_STATE(EStGetStatus) |
|
6497 |
|
6498 const TMMCStatus st = s.LastStatus(); |
|
6499 if((st & KMMCStatCardIsLocked) == 0) |
|
6500 { |
|
6501 SMF_GOTOS(EStNextIndex); |
|
6502 } |
|
6503 |
|
6504 SMF_STATE(EStUnlock) |
|
6505 |
|
6506 const TMapping *mp = NULL; |
|
6507 mp = iSocket->iPasswordStore->FindMappingInStore(iCardArray->CardP(iAutoUnlockIndex)->CID()); |
|
6508 |
|
6509 OstTrace1( TRACE_INTERNALS, DMMCSTACK_CIMAUTOUNLOCKSM4, "Attempting to unlock card %d", iCardArray->CardP(iAutoUnlockIndex)->Number() ); |
|
6510 |
6479 const TInt kPWD_LEN = mp->iPWD.Length(); |
6511 const TInt kPWD_LEN = mp->iPWD.Length(); |
6480 iPSLBuf[0] = 0; // LOCK_UNLOCK = 0; unlock |
6512 iPSLBuf[0] = 0; // LOCK_UNLOCK = 0; unlock |
6481 iPSLBuf[1] = static_cast<TUint8>(kPWD_LEN); |
6513 iPSLBuf[1] = static_cast<TUint8>(kPWD_LEN); |
6482 TPtr8 pwd(&iPSLBuf[2], kPWD_LEN); |
6514 TPtr8 pwd(&iPSLBuf[2], kPWD_LEN); |
6483 pwd.Copy(mp->iPWD); |
6515 pwd.Copy(mp->iPWD); |
6748 DMMCSocket::Panic(DMMCSocket::EMMCBadBusWidth); |
6780 DMMCSocket::Panic(DMMCSocket::EMMCBadBusWidth); |
6749 |
6781 |
6750 } |
6782 } |
6751 OstTraceFunctionExitExt( DMMCSTACK_BUSWIDTHENCODING_EXIT, this, ( TUint )&( busWidth ) ); |
6783 OstTraceFunctionExitExt( DMMCSTACK_BUSWIDTHENCODING_EXIT, this, ( TUint )&( busWidth ) ); |
6752 return busWidth; |
6784 return busWidth; |
|
6785 } |
|
6786 |
|
6787 void DMMCStack::DoAddressCard(TInt aCardNumber) |
|
6788 { |
|
6789 MAddressCard* addressCardInterface = NULL; |
|
6790 GetInterface(KInterfaceAddressCard, (MInterface*&) addressCardInterface); |
|
6791 if (addressCardInterface) |
|
6792 addressCardInterface->AddressCard(aCardNumber); |
|
6793 else |
|
6794 { |
|
6795 // if the interface isn't supported on a multiplexed bus, then panic if the card number > 0 - |
|
6796 // one cause of this panic is if the PSL 's implementation of GetInterface() does not call the |
|
6797 // base class's implementation of GetInterface() |
|
6798 __ASSERT_ALWAYS((!iMultiplexedBus) || (aCardNumber <= 0), DMMCSocket::Panic(DMMCSocket::EMMCAddressCardNotSupported)); |
|
6799 } |
6753 } |
6800 } |
6754 |
6801 |
6755 /** |
6802 /** |
6756 * class DMMCSocket |
6803 * class DMMCSocket |
6757 */ |
6804 */ |