21 #include <f32fsys.h> |
21 #include <f32fsys.h> |
22 #include <e32property.h> |
22 #include <e32property.h> |
23 |
23 |
24 #include "hostusbmsproxy.h" |
24 #include "hostusbmsproxy.h" |
25 #include "hostusbmsfactory.h" |
25 #include "hostusbmsfactory.h" |
26 #include "debug.h" |
26 |
|
27 #include "OstTraceDefinitions.h" |
|
28 #ifdef OST_TRACE_COMPILER_IN_USE |
|
29 #include "hostusbmsfactoryTraces.h" |
|
30 #endif |
|
31 |
|
32 |
27 |
33 |
28 CUsbHostMsProxyDriveFactory::CUsbHostMsProxyDriveFactory() |
34 CUsbHostMsProxyDriveFactory::CUsbHostMsProxyDriveFactory() |
29 { |
35 { |
30 __MSFNSLOG |
36 } |
31 } |
|
32 |
37 |
33 CUsbHostMsProxyDriveFactory::~CUsbHostMsProxyDriveFactory() |
38 CUsbHostMsProxyDriveFactory::~CUsbHostMsProxyDriveFactory() |
34 { |
39 { |
35 __MSFNSLOG |
40 } |
36 } |
|
37 |
41 |
38 TInt CUsbHostMsProxyDriveFactory::Install() |
42 TInt CUsbHostMsProxyDriveFactory::Install() |
39 { |
43 { |
40 __MSFNSLOG |
44 _LIT(KLoggerName,"usbhostms"); |
41 _LIT(KLoggerName,"usbhostms"); |
45 return SetName(&KLoggerName); |
42 return SetName(&KLoggerName); |
46 } |
43 } |
|
44 |
47 |
45 TInt CUsbHostMsProxyDriveFactory::CreateProxyDrive(CProxyDrive*& aMountProxyDrive,CMountCB* aMount) |
48 TInt CUsbHostMsProxyDriveFactory::CreateProxyDrive(CProxyDrive*& aMountProxyDrive,CMountCB* aMount) |
46 { |
49 { |
47 __MSFNSLOG |
|
48 aMountProxyDrive = new CUsbHostMsProxyDrive(aMount,this); |
50 aMountProxyDrive = new CUsbHostMsProxyDrive(aMount,this); |
49 return (aMountProxyDrive==NULL) ? KErrNoMemory : KErrNone; |
51 return (aMountProxyDrive==NULL) ? KErrNoMemory : KErrNone; |
50 } |
52 } |
51 |
53 |
52 |
54 |
53 extern "C" { |
55 extern "C" { |
54 |
56 |
55 |
57 |
56 /* |
58 /* |
57 Create the proxy drive factory object for the usbhost mass storage proxy |
59 Create the proxy drive factory object for the usbhost mass storage proxy |
58 */ |
60 */ |
59 EXPORT_C CExtProxyDriveFactory* CreateFileSystem() |
61 EXPORT_C CExtProxyDriveFactory* CreateFileSystem() |
60 { |
62 { |
61 __MSFNSLOG |
63 return new CUsbHostMsProxyDriveFactory(); |
62 return new CUsbHostMsProxyDriveFactory(); |
64 } |
63 } |
|
64 } |
65 } |
65 |
66 |
66 /* |
67 /* |
67 This function will be called to kick off a speculative probe for USB mass storage devices. |
68 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 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 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 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 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 drives for the logical units and continues drive access through the Usb host mass storage proxy drive. |
73 |
74 |
74 Ps: Note that the this request cant be handled by the MSC since, in the scenario where MSC is not running |
75 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 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 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 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 for the rendezvous to complete creating the deadlock situation. Hence the application session request is handled |
79 in the factory object itself! |
80 in the factory object itself! |
80 */ |
81 */ |
81 void CUsbHostMsProxyDriveFactory::AsyncEnumerate() |
82 void CUsbHostMsProxyDriveFactory::AsyncEnumerate() |
82 { |
83 { |
83 __MSFNSLOG |
84 RProperty prop; |
|
85 TInt ret; |
84 |
86 |
85 RProperty prop; |
87 /* The property category is the USB manager */ |
86 TInt ret; |
88 const TUid KUidUsbManCategory={0x101fe1db}; |
|
89 /* The Key used is #6 for the Usb request session */ |
|
90 const TInt KUsbRequestSessionProperty = 6; |
87 |
91 |
88 /* The property category is the USB manager */ |
92 /* By this time the property should be available and allow us to get the handle. |
89 const TUid KUidUsbManCategory={0x101fe1db}; |
93 If the property is not created (for some reason), we do not have anything to do */ |
90 /* The Key used is #6 for the Usb request session */ |
94 ret = prop.Attach(KUidUsbManCategory, KUsbRequestSessionProperty); |
91 const TInt KUsbRequestSessionProperty = 6; |
95 OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSFACTORY_11, |
92 |
96 "Property attach returned %d", ret); |
93 /* By this time the property should be available and allow us to get the handle. |
97 if(ret == KErrNone) |
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 { |
98 { |
99 /* The Usb Manager does not evaluate the value passed through this property. |
99 /* The Usb Manager does not evaluate the value passed through this property. |
100 We pass 1 (an arbitary value) for completion */ |
100 We pass 1 (an arbitary value) for completion */ |
101 ret = prop.Set(KUidUsbManCategory, KUsbRequestSessionProperty, 1); |
101 ret = prop.Set(KUidUsbManCategory, KUsbRequestSessionProperty, 1); |
102 __PXYPRINT1(_L("Property set returned %d"),ret); |
102 OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSFACTORY_12, |
103 prop.Close(); |
103 "Property set returned %d", ret); |
104 } |
104 prop.Close(); |
|
105 } |
105 } |
106 } |
106 |
107 |