usbengines/usbwatcher/src/cusbwatcher.cpp
branchRCL_3
changeset 5 7068aba64af5
parent 4 7e15987c4500
child 6 a15c582fbf97
equal deleted inserted replaced
4:7e15987c4500 5:7068aba64af5
   249                 {
   249                 {
   250                 LOG1( "Not starting personality, previous state: %d", 
   250                 LOG1( "Not starting personality, previous state: %d", 
   251                     aStateOld);
   251                     aStateOld);
   252                 break;
   252                 break;
   253                 }
   253                 }
   254 			LOG1( "Starting USB personality in device state: %d", aStateNew );
   254             LOG1( "Starting USB personality in device state: %d", aStateNew );
   255             iPersonalityHandler->StateChangeNotify( aStateOld, aStateNew );
   255             iPersonalityHandler->StateChangeNotify( aStateOld, aStateNew );
   256             // Check AskOnConnection setting every time
   256             // Check AskOnConnection setting every time
   257             if( ( iSupportedPersonalities.Count() > 1 ) &&
   257             if( ( iSupportedPersonalities.Count() > 1 ) &&
   258                     !IsAskOnConnectionSuppression() )
   258                     !IsAskOnConnectionSuppression() )
   259                 {
   259                 {
  1030     //NOT LOGGED
  1030     //NOT LOGGED
  1031     // return EFalse in non-OTG configuration otherwise ask UsbOtgWatcher
  1031     // return EFalse in non-OTG configuration otherwise ask UsbOtgWatcher
  1032     return iOtgWatcher ? iOtgWatcher->IsDeviceA() : EFalse;
  1032     return iOtgWatcher ? iOtgWatcher->IsDeviceA() : EFalse;
  1033     }
  1033     }
  1034 
  1034 
       
  1035 // ----------------------------------------------------------------------------
       
  1036 // Write new personality to central repository.
       
  1037 // ----------------------------------------------------------------------------
       
  1038 //
       
  1039 TInt CUsbWatcher::WritePersonalityId( TInt aPersonalityId )
       
  1040     {
       
  1041     LOG_FUNC
       
  1042     
       
  1043     // Save as the default personality only if it is not hidden
       
  1044     TUint32 property(0);
       
  1045     TInt ret =  iUsbMan.GetPersonalityProperty( aPersonalityId, property );
       
  1046     if ( ret == KErrNone )
       
  1047         {
       
  1048         LOG2( "Personality %d property: 0x%x", aPersonalityId, property );
       
  1049         }
       
  1050     else
       
  1051         {
       
  1052         //Not fatal, treat as non-hidden
       
  1053         LOG1( "ERROR: GetPersonalityProperty = %d", ret );
       
  1054         property = 0;
       
  1055         }
       
  1056     if ( property & KUsbPersonalityPropertyHidden ) //Bitwise AND
       
  1057         {
       
  1058         LOG( "Hidden personality not saved to central repository" );
       
  1059         ret = KErrNone;
       
  1060         }
       
  1061     else
       
  1062         {
       
  1063         ret =  iPersonalityRepository->Set( KUsbWatcherPersonality,
       
  1064             aPersonalityId );
       
  1065         }
       
  1066     return ret;
       
  1067     }
       
  1068 
  1035 // End of file
  1069 // End of file