This section describes the steps to enable MTP over USB using the Symbian USB Manager.
The USB Manager provides functions to enable MTP over USB.
RUsb usb;
TInt err = usb.Connect();
if( err != KErrNone)
{
// Error in connecting with the USB Manager
}
// Find the personality that supports MTP USB SIC
TInt personalityId(KErrNotFound);
RArray<TInt> personalityIds;
err = usb.GetPersonalityIds(personalityIds);
if ( err != KErrNone)
{
// Error handling
}
TInt count = personalityIds.Count();
for (TInt i(0); i < count; i++)
{
TBool supported(EFalse);
err = usb.ClassSupported(personalityIds[i], KUsbMTPUsbSicClassControllerUID, supported);
if (err != KErrNone)
{
// Error handling
}
if (supported)
{
personalityId = personalityIds[i];
break;
}
}
personalityIds.Close();
if (personalityId != KErrNotFound)
{
TRequestStatus status ;
usb.TryStart(personalityId, status);
User::WaitForRequest(status);
if(status.Int() != KErrNone)
{
// Error in trying to start the MTP service
}
}
...
usb.Close();
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.