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 |
6472 // so attempt to unlock using the CIMLockUnlockSMST state machine. |
6481 // so attempt to unlock using the CIMLockUnlockSMST state machine. |
6473 // |
6482 // |
6474 // Upon completion, test the next card before performing further initialisation. |
6483 // Upon completion, test the next card before performing further initialisation. |
6475 // |
6484 // |
6476 |
6485 |
6477 SMF_STATE(EStSendStatus) |
6486 DoAddressCard(iAutoUnlockIndex); // Address the card |
|
6487 TMMCard* cd = iCardArray->CardP(iAutoUnlockIndex); |
|
6488 s.SetCard(cd); |
|
6489 |
|
6490 SMF_STATE(EStSendStatus) |
6478 |
6491 |
6479 s.FillCommandDesc(ECmdSendStatus, 0); |
6492 s.FillCommandDesc(ECmdSendStatus, 0); |
6480 |
6493 |
6481 SMF_INVOKES(ExecCommandSMST,EStGetStatus) |
6494 SMF_INVOKES(ExecCommandSMST,EStGetStatus) |
6482 |
6495 |
6483 SMF_STATE(EStGetStatus) |
6496 SMF_STATE(EStGetStatus) |
6484 |
6497 |
6485 const TMMCStatus st = s.LastStatus(); |
6498 const TMMCStatus st = s.LastStatus(); |
6486 if((st & KMMCStatCardIsLocked) == 0) |
6499 if((st & KMMCStatCardIsLocked) == 0) |
6487 { |
6500 { |
6488 SMF_RETURN(err) |
6501 SMF_GOTOS(EStNextIndex); |
6489 } |
6502 } |
6490 |
6503 |
6491 SMF_STATE(EStUnlock) |
6504 SMF_STATE(EStUnlock) |
6492 |
6505 |
6493 const TMapping *mp = NULL; |
6506 const TMapping *mp = NULL; |
6494 mp = iSocket->iPasswordStore->FindMappingInStore(iCardArray->CardP(iAutoUnlockIndex)->CID()); |
6507 mp = iSocket->iPasswordStore->FindMappingInStore(iCardArray->CardP(iAutoUnlockIndex)->CID()); |
6495 |
6508 |
6496 TMMCard &cd = *(iCardArray->CardP(iAutoUnlockIndex++)); |
6509 OstTrace1( TRACE_INTERNALS, DMMCSTACK_CIMAUTOUNLOCKSM4, "Attempting to unlock card %d", iCardArray->CardP(iAutoUnlockIndex)->Number() ); |
6497 OstTrace1( TRACE_INTERNALS, DMMCSTACK_CIMAUTOUNLOCKSM4, "Attempting to unlock card %d", cd.Number() ); |
|
6498 |
6510 |
6499 s.SetCard(&cd); |
|
6500 |
|
6501 const TInt kPWD_LEN = mp->iPWD.Length(); |
6511 const TInt kPWD_LEN = mp->iPWD.Length(); |
6502 iPSLBuf[0] = 0; // LOCK_UNLOCK = 0; unlock |
6512 iPSLBuf[0] = 0; // LOCK_UNLOCK = 0; unlock |
6503 iPSLBuf[1] = static_cast<TUint8>(kPWD_LEN); |
6513 iPSLBuf[1] = static_cast<TUint8>(kPWD_LEN); |
6504 TPtr8 pwd(&iPSLBuf[2], kPWD_LEN); |
6514 TPtr8 pwd(&iPSLBuf[2], kPWD_LEN); |
6505 pwd.Copy(mp->iPWD); |
6515 pwd.Copy(mp->iPWD); |
6770 DMMCSocket::Panic(DMMCSocket::EMMCBadBusWidth); |
6780 DMMCSocket::Panic(DMMCSocket::EMMCBadBusWidth); |
6771 |
6781 |
6772 } |
6782 } |
6773 OstTraceFunctionExitExt( DMMCSTACK_BUSWIDTHENCODING_EXIT, this, ( TUint )&( busWidth ) ); |
6783 OstTraceFunctionExitExt( DMMCSTACK_BUSWIDTHENCODING_EXIT, this, ( TUint )&( busWidth ) ); |
6774 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 } |
6775 } |
6800 } |
6776 |
6801 |
6777 /** |
6802 /** |
6778 * class DMMCSocket |
6803 * class DMMCSocket |
6779 */ |
6804 */ |