equal
deleted
inserted
replaced
24 |
24 |
25 #include "rfsydebug.h" |
25 #include "rfsydebug.h" |
26 #include "rusbhostsession.h" |
26 #include "rusbhostsession.h" |
27 #include "rusbotgsession.h" |
27 #include "rusbotgsession.h" |
28 #include "cmsdrive.h" |
28 #include "cmsdrive.h" |
29 #include "tmslog.h" |
|
30 |
29 |
31 /* |
30 /* |
32 OTG Platform configuration |
31 OTG Platform configuration |
33 Define for H4 and undefine for Navi Engine |
32 Define for H4 and undefine for Navi Engine |
34 */ |
33 */ |
35 #define _OTG_CONFIG |
34 #define _OTG_CONFIG |
36 |
35 |
37 extern RTest test; |
36 extern RTest test; |
38 extern RFs fsSession; |
37 extern RFs fsSession; |
39 |
38 |
40 CMsDrive* msDrive; |
39 CMsDrive* msDrive; |
42 extern void CallTestsL(); |
41 extern void CallTestsL(); |
43 |
42 |
44 |
43 |
45 GLDEF_C void MainL() |
44 GLDEF_C void MainL() |
46 { |
45 { |
47 __MSFNSLOG |
|
48 |
|
49 TInt err; |
46 TInt err; |
50 CleanupClosePushL(fsSession); |
47 CleanupClosePushL(fsSession); |
51 User::LeaveIfError(fsSession.Connect()); |
48 User::LeaveIfError(fsSession.Connect()); |
52 |
49 |
53 msDrive = CMsDrive::NewL(); |
50 msDrive = CMsDrive::NewL(); |
68 { |
65 { |
69 TBool change; |
66 TBool change; |
70 TRequestStatus status; |
67 TRequestStatus status; |
71 test.Printf(_L("Waiting for hub inserted event...\n")); |
68 test.Printf(_L("Waiting for hub inserted event...\n")); |
72 usbOtgSession.NotifyChange(change, status); |
69 usbOtgSession.NotifyChange(change, status); |
73 |
70 |
74 User::WaitForRequest(status); |
71 User::WaitForRequest(status); |
75 User::LeaveIfError(status.Int()); |
72 User::LeaveIfError(status.Int()); |
76 |
73 |
77 TBool deviceInserted = usbOtgSession.DeviceInserted(); |
74 TBool deviceInserted = usbOtgSession.DeviceInserted(); |
78 test.Printf(_L("hub inserted = %d\n"), deviceInserted); |
75 test.Printf(_L("hub inserted = %d\n"), deviceInserted); |
133 { |
130 { |
134 test.Printf(_L("Hub not inserted!\n")); |
131 test.Printf(_L("Hub not inserted!\n")); |
135 test(EFalse); |
132 test(EFalse); |
136 } |
133 } |
137 |
134 |
138 |
135 |
139 test.Printf(_L("Destroying sessions...\n")); |
136 test.Printf(_L("Destroying sessions...\n")); |
140 test.Printf(_L("Destroying USB Host session...\n")); |
137 test.Printf(_L("Destroying USB Host session...\n")); |
141 CleanupStack::PopAndDestroy(&usbHostSession); |
138 CleanupStack::PopAndDestroy(&usbHostSession); |
142 // Wait for thread to die |
139 // Wait for thread to die |
143 User::After(1000 * 1000 * 4); |
140 User::After(1000 * 1000 * 4); |
152 CleanupStack::PopAndDestroy(); // fsSession |
149 CleanupStack::PopAndDestroy(); // fsSession |
153 } |
150 } |
154 |
151 |
155 |
152 |
156 GLDEF_C TInt E32Main() |
153 GLDEF_C TInt E32Main() |
157 { |
154 { |
158 CTrapCleanup* cleanup = CTrapCleanup::New(); |
155 CTrapCleanup* cleanup = CTrapCleanup::New(); |
159 __UHEAP_MARK; |
156 __UHEAP_MARK; |
160 test.Title(); |
157 test.Title(); |
161 test.Start(_L("Starting tests...")); |
158 test.Start(_L("Starting tests...")); |
162 |
159 |
163 TTime timerC; |
160 TTime timerC; |
164 timerC.HomeTime(); |
161 timerC.HomeTime(); |
165 |
162 |
166 TRAPD(err, MainL()); |
163 TRAPD(err, MainL()); |
167 test(err == KErrNone); |
164 test(err == KErrNone); |
168 |
165 |
169 TTime endTimeC; |
166 TTime endTimeC; |
170 endTimeC.HomeTime(); |
167 endTimeC.HomeTime(); |
171 TTimeIntervalSeconds timeTakenC; |
168 TTimeIntervalSeconds timeTakenC; |
172 err = endTimeC.SecondsFrom(timerC,timeTakenC); |
169 err = endTimeC.SecondsFrom(timerC,timeTakenC); |
173 test(err == KErrNone); |
170 test(err == KErrNone); |
174 test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int()); |
171 test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int()); |
175 |
172 |
176 test.End(); |
173 test.End(); |
177 test.Close(); |
174 test.Close(); |
178 __UHEAP_MARKEND; |
175 __UHEAP_MARKEND; |
179 delete cleanup; |
176 delete cleanup; |
180 return KErrNone; |
177 return KErrNone; |
181 } |
178 } |
182 |
179 |