0
|
1 |
// Copyright (c) 2008-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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
/**
|
|
17 |
@file
|
|
18 |
@internalTechnology
|
|
19 |
*/
|
|
20 |
|
|
21 |
#include <f32fsys.h>
|
|
22 |
#include <e32property.h>
|
|
23 |
|
|
24 |
#include "hostusbmsproxy.h"
|
|
25 |
#include "hostusbmsfactory.h"
|
|
26 |
#include "debug.h"
|
|
27 |
|
|
28 |
CUsbHostMsProxyDriveFactory::CUsbHostMsProxyDriveFactory()
|
|
29 |
{
|
|
30 |
__MSFNSLOG
|
|
31 |
}
|
|
32 |
|
|
33 |
CUsbHostMsProxyDriveFactory::~CUsbHostMsProxyDriveFactory()
|
|
34 |
{
|
|
35 |
__MSFNSLOG
|
|
36 |
}
|
|
37 |
|
|
38 |
TInt CUsbHostMsProxyDriveFactory::Install()
|
|
39 |
{
|
|
40 |
__MSFNSLOG
|
|
41 |
_LIT(KLoggerName,"usbhostms");
|
|
42 |
return SetName(&KLoggerName);
|
|
43 |
}
|
|
44 |
|
|
45 |
TInt CUsbHostMsProxyDriveFactory::CreateProxyDrive(CProxyDrive*& aMountProxyDrive,CMountCB* aMount)
|
|
46 |
{
|
|
47 |
__MSFNSLOG
|
|
48 |
aMountProxyDrive = new CUsbHostMsProxyDrive(aMount,this);
|
|
49 |
return (aMountProxyDrive==NULL) ? KErrNoMemory : KErrNone;
|
|
50 |
}
|
|
51 |
|
|
52 |
|
|
53 |
extern "C" {
|
|
54 |
|
|
55 |
|
|
56 |
/*
|
|
57 |
Create the proxy drive factory object for the usbhost mass storage proxy
|
|
58 |
*/
|
|
59 |
EXPORT_C CExtProxyDriveFactory* CreateFileSystem()
|
|
60 |
{
|
|
61 |
__MSFNSLOG
|
|
62 |
return new CUsbHostMsProxyDriveFactory();
|
|
63 |
}
|
|
64 |
}
|
|
65 |
|
|
66 |
/*
|
|
67 |
This function will be called to kick off a speculative probe for USB mass storage devices.
|
|
68 |
This function issues an application session request (through publish and subscribe) to the USB manager.
|
|
69 |
Upon USB Manager receiving this application session request in consent with the USB watcher application,
|
|
70 |
the Bus request is passed to the OTG component to bringup the VBus, thus enumerating the mass storage
|
|
71 |
devices Upon enumerating the FDF will communicate with the Mount Manager which will allocate mass storage
|
|
72 |
drives for the logical units and continues drive access through the Usb host mass storage proxy drive.
|
|
73 |
|
|
74 |
Ps: Note that the this request cant be handled by the MSC since, in the scenario where MSC is not running
|
|
75 |
initially, the request will try to create the process. Creation of process will involve the file server inturn
|
|
76 |
to load the MSC binary (.exe) to run. Since the RMessages are handled sequentially, the file server would not
|
|
77 |
be able to service the request until the AsyncEnuerate is completed. Where, the process creation will wait
|
|
78 |
for the rendezvous to complete creating the deadlock situation. Hence the application session request is handled
|
|
79 |
in the factory object itself!
|
|
80 |
*/
|
|
81 |
void CUsbHostMsProxyDriveFactory::AsyncEnumerate()
|
|
82 |
{
|
|
83 |
__MSFNSLOG
|
|
84 |
|
|
85 |
RProperty prop;
|
|
86 |
TInt ret;
|
|
87 |
|
|
88 |
/* The property category is the USB manager */
|
|
89 |
const TUid KUidUsbManCategory={0x101fe1db};
|
|
90 |
/* The Key used is #6 for the Usb request session */
|
|
91 |
const TInt KUsbRequestSessionProperty = 6;
|
|
92 |
|
|
93 |
/* By this time the property should be available and allow us to get the handle.
|
|
94 |
If the property is not created (for some reason), we do not have anything to do */
|
|
95 |
ret = prop.Attach(KUidUsbManCategory, KUsbRequestSessionProperty);
|
|
96 |
__PXYPRINT1(_L("Property attach returned %d"),ret);
|
|
97 |
if(ret == KErrNone)
|
|
98 |
{
|
|
99 |
/* The Usb Manager does not evaluate the value passed through this property.
|
|
100 |
We pass 1 (an arbitary value) for completion */
|
|
101 |
ret = prop.Set(KUidUsbManCategory, KUsbRequestSessionProperty, 1);
|
|
102 |
__PXYPRINT1(_L("Property set returned %d"),ret);
|
|
103 |
prop.Close();
|
|
104 |
}
|
|
105 |
}
|
|
106 |
|