Update contrib.
1 // Copyright (c) 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 // USB Mass Storage Application - also used as an improvised boot loader mechanism
26 #include <d32usbdi_hubdriver.h>
28 #include "rusbhostmsdevice.h"
29 #include "rextfilesystem.h"
30 #include "cusbmsmountmanager.h"
35 _LIT(KTxtApp,"USBHOSTMSAPP");
37 LOCAL_D RTest test(_L("MSAPP HOST TEST"));
40 GLDEF_C void RunAppL()
43 test.Start(_L("Mass Storage Host Tests"));
45 CUsbHost* host = CUsbHost::NewL();
49 test.Printf(_L("Build up bus events. Press any key to start consuming"));
55 test.Next(_L("Wait for device attach"));
56 RUsbHubDriver::TBusEvent::TEvent event = host->WaitForBusEvent();
58 if (event == RUsbHubDriver::TBusEvent::EDeviceAttached)
60 /* Jungo stack has attached the device */
61 TUint32 token = host->OpenDeviceL();
64 __PRINT1(_L("%d device(s) attached"), deviceCount);
66 else if (event == RUsbHubDriver::TBusEvent::EDeviceRemoved)
68 host->DismountDeviceL();
71 __PRINT1(_L("%d device(s) attached"), deviceCount);
73 if (--deviceCount == 0)
86 test.Printf(_L("Press a key to dismount\n"));
90 host->DismountAllFileSystemsL();
91 host->CloseAllDevicesL();
96 // 1 sec delay for sessions to stop
105 GLDEF_C TInt E32Main()
108 CTrapCleanup* cleanup = CTrapCleanup::New();
109 test(cleanup != NULL);
110 TRAPD(error, RunAppL());
111 __ASSERT_ALWAYS(!error, User::Panic(KTxtApp, error));