Update contrib.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // invoke the USB mass storage application
23 #include <e32const_private.h>
25 #include <e32std_private.h>
31 #include "bootloader_variantconfig.h"
32 #include <nkern/nk_trace.h>
35 #define FILE_ID 0x594D555D
38 GLDEF_C TBool StartUSBMS()
41 TInt r = fs.Connect();
45 RDebug::Print(_L("FAULT: Connecting RFs returned %d\r\n"), r);
50 RFs::CharToDrive('D', drive); // XXX variant constant drivepath
53 r = fs.Drive(info, drive);
57 RDebug::Print(_L("FAULT: Calling Drive() on RFs returned %d\r\n"), r);
61 if (info.iType == EMediaNotPresent)
66 LoadDevice = ELoadUSBMS;
70 TName command = _L("D");
71 r = proc.Create(_L("z:\\sys\\bin\\usbboot.exe"), command);
75 RDebug::Print(_L("FAULT: error starting usbboot %d\r\n"), r);
82 GLDEF_C void TryUSBMS()
84 // Check first whether this boot is intended to load and boot an image from
86 if (LoadDevice == EBootUSBMS)
88 PrintToScreen(_L("USB-MS boot scanning drives\r\n"));
89 // search drives for file - returns true if an image has been found
94 PrintToScreen(_L("Starting USB Mass Storage\r\n"));
98 // USB Mass Storage boot has started - don't continue with the
99 // bootloader, sleep here.
101 User::After(10000000);
106 // Not started (probably no card in drive) revert to normal bootloader
107 // mode and notify the variant to rewrite it's configuration.
108 PrintToScreen(_L("NO VALID MEDIA\r\n"));
109 PrintToScreen(_L("Leaving USB Mass Storage mode\r\n"));
110 LoadDevice = ELoadDrive;