141 */ |
148 */ |
142 |
149 |
143 CUsbOtgIdPinWatcher::CUsbOtgIdPinWatcher(RUsbOtgDriver& aLdd) |
150 CUsbOtgIdPinWatcher::CUsbOtgIdPinWatcher(RUsbOtgDriver& aLdd) |
144 : CUsbOtgBaseWatcher(aLdd) |
151 : CUsbOtgBaseWatcher(aLdd) |
145 { |
152 { |
146 LOG_FUNC |
153 OstTraceFunctionEntry0( CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_CONS_ENTRY ); |
|
154 OstTraceFunctionExit0( CUSBOTGIDPINWATCHER_CUSBOTGIDPINWATCHER_CONS_EXIT ); |
147 } |
155 } |
148 |
156 |
149 /** |
157 /** |
150 * Called when the ID-Pin status change is reported |
158 * Called when the ID-Pin status change is reported |
151 */ |
159 */ |
152 void CUsbOtgIdPinWatcher::RunL() |
160 void CUsbOtgIdPinWatcher::RunL() |
153 { |
161 { |
154 LOG_FUNC |
162 OstTraceFunctionEntry0( CUSBOTGIDPINWATCHER_RUNL_ENTRY ); |
155 LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::RunL [iStatus=%d]"), iStatus.Int()); |
163 OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_RUNL, "CUsbOtgIdPinWatcher::RunL;iStatus=%d", iStatus.Int() ); |
156 |
164 |
157 LEAVEIFERRORL(iStatus.Int()); |
165 TInt err = iStatus.Int(); |
|
166 if(err < 0) |
|
167 { |
|
168 OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_RUNL_DUP1, "CUsbOtgIdPinWatcher::RunL;iStatus.Int() with error=%d", err ); |
|
169 User::Leave(err); |
|
170 } |
158 |
171 |
159 Post(); |
172 Post(); |
160 |
173 |
161 LOGTEXT(_L8("<<CUsbOtgIdPinWatcher::RunL")); |
174 OstTraceFunctionExit0( CUSBOTGIDPINWATCHER_RUNL_EXIT ); |
162 } |
175 } |
163 |
176 |
164 |
177 |
165 /** |
178 /** |
166 * Automatically called when the ID-Pin watcher is cancelled. |
179 * Automatically called when the ID-Pin watcher is cancelled. |
167 */ |
180 */ |
168 void CUsbOtgIdPinWatcher::DoCancel() |
181 void CUsbOtgIdPinWatcher::DoCancel() |
169 { |
182 { |
170 LOG_FUNC |
183 OstTraceFunctionEntry0( CUSBOTGIDPINWATCHER_DOCANCEL_ENTRY ); |
171 iLdd.CancelOtgIdPinNotification(); |
184 iLdd.CancelOtgIdPinNotification(); |
|
185 OstTraceFunctionExit0( CUSBOTGIDPINWATCHER_DOCANCEL_EXIT ); |
172 } |
186 } |
173 |
187 |
174 /** |
188 /** |
175 * Sets state watcher in active state |
189 * Sets state watcher in active state |
176 */ |
190 */ |
177 void CUsbOtgIdPinWatcher::Post() |
191 void CUsbOtgIdPinWatcher::Post() |
178 { |
192 { |
179 LOG_FUNC |
193 OstTraceFunctionEntry0( CUSBOTGIDPINWATCHER_POST_ENTRY ); |
180 |
194 |
181 LOGTEXT(_L8("CUsbOtgIdPinWatcher::Post() - About to call QueueOtgIdPinNotification")); |
195 OstTrace0( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST, "CUsbOtgIdPinWatcher::Post - About to call QueueOtgIdPinNotification" ); |
|
196 |
182 iLdd.QueueOtgIdPinNotification(iOtgIdPin, iStatus); |
197 iLdd.QueueOtgIdPinNotification(iOtgIdPin, iStatus); |
183 switch (iOtgIdPin) |
198 switch (iOtgIdPin) |
184 { |
199 { |
185 case RUsbOtgDriver::EIdPinAPlug: |
200 case RUsbOtgDriver::EIdPinAPlug: |
186 if (RProperty::Set(KUidUsbManCategory,KUsbOtgIdPinPresentProperty,ETrue) != KErrNone) |
201 if (RProperty::Set(KUidUsbManCategory,KUsbOtgIdPinPresentProperty,ETrue) != KErrNone) |
187 { |
202 { |
188 LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::Post [iOtgIdPin=%d] - failed to set the property value"), iOtgIdPin); |
203 OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST_DUP1, |
|
204 "CUsbOtgIdPinWatcher::Post; [iOtgIdPin=%d] - failed to set the property value", iOtgIdPin ); |
189 } |
205 } |
190 else |
206 else |
191 { |
207 { |
192 LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::Post [iOtgIdPin=%d] - property is set to 1"), iOtgIdPin); |
208 OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST_DUP2, |
|
209 "CUsbOtgIdPinWatcher::Post; [iOtgIdPin=%d] - property is set to 1", iOtgIdPin ); |
193 } |
210 } |
194 break; |
211 break; |
195 case RUsbOtgDriver::EIdPinBPlug: |
212 case RUsbOtgDriver::EIdPinBPlug: |
196 case RUsbOtgDriver::EIdPinUnknown: |
213 case RUsbOtgDriver::EIdPinUnknown: |
197 if (RProperty::Set(KUidUsbManCategory,KUsbOtgIdPinPresentProperty,EFalse) != KErrNone) |
214 if (RProperty::Set(KUidUsbManCategory,KUsbOtgIdPinPresentProperty,EFalse) != KErrNone) |
198 { |
215 { |
199 LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::Post [iOtgIdPin=%d] - failed to set the property value"), iOtgIdPin); |
216 OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST_DUP3, |
|
217 "CUsbOtgIdPinWatcher::Post; [iOtgIdPin=%d] - failed to set the property value", iOtgIdPin ); |
200 } |
218 } |
201 else |
219 else |
202 { |
220 { |
203 LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::Post [iOtgIdPin=%d] - property is set to 0"), iOtgIdPin); |
221 OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST_DUP4, |
|
222 "CUsbOtgIdPinWatcher::Post; [iOtgIdPin=%d] - property is set to 0", iOtgIdPin ); |
204 } |
223 } |
205 break; |
224 break; |
206 default: |
225 default: |
207 LOGTEXT2(_L8(">>CUsbOtgIdPinWatcher::Post [iOtgIdPin=%d] is unrecognized, re-request QueueOtgIdPinNotification"), iOtgIdPin); |
226 OstTrace1( TRACE_NORMAL, CUSBOTGIDPINWATCHER_POST_DUP5, |
|
227 "CUsbOtgIdPinWatcher::Post; [iOtgIdPin=%d] is unrecognized, re-request QueueOtgIdPinNotification", iOtgIdPin ); |
208 break; |
228 break; |
209 } |
229 } |
210 SetActive(); |
230 SetActive(); |
|
231 OstTraceFunctionExit0( CUSBOTGIDPINWATCHER_POST_EXIT ); |
211 } |
232 } |
212 |
233 |
213 //----------------------------- VBus watcher class ---------------------------- |
234 //----------------------------- VBus watcher class ---------------------------- |
214 /** |
235 /** |
215 * The CUsbOtgVbusWatcher::NewL method |
236 * The CUsbOtgVbusWatcher::NewL method |
275 * @param aLdd A reference to the USB OTG Logical Device Driver |
299 * @param aLdd A reference to the USB OTG Logical Device Driver |
276 */ |
300 */ |
277 CUsbOtgVbusWatcher::CUsbOtgVbusWatcher(RUsbOtgDriver& aLdd) |
301 CUsbOtgVbusWatcher::CUsbOtgVbusWatcher(RUsbOtgDriver& aLdd) |
278 : CUsbOtgBaseWatcher(aLdd) |
302 : CUsbOtgBaseWatcher(aLdd) |
279 { |
303 { |
280 LOG_FUNC |
304 OstTraceFunctionEntry0( CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_CONS_ENTRY ); |
|
305 OstTraceFunctionExit0( CUSBOTGVBUSWATCHER_CUSBOTGVBUSWATCHER_CONS_EXIT ); |
281 } |
306 } |
282 |
307 |
283 /** |
308 /** |
284 * Called when the Vbus status is changed |
309 * Called when the Vbus status is changed |
285 */ |
310 */ |
286 void CUsbOtgVbusWatcher::RunL() |
311 void CUsbOtgVbusWatcher::RunL() |
287 { |
312 { |
288 LOG_FUNC |
313 OstTraceFunctionEntry0( CUSBOTGVBUSWATCHER_RUNL_ENTRY ); |
289 LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::RunL [iStatus=%d]"), iStatus.Int()); |
314 OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_RUNL, "CUsbOtgVbusWatcher::RunL;iStatus=%d", iStatus.Int() ); |
290 |
315 |
291 LEAVEIFERRORL(iStatus.Int()); |
316 TInt err = iStatus.Int(); |
|
317 if(err < 0) |
|
318 { |
|
319 OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_RUNL_DUP1, "CUsbOtgVbusWatcher::RunL;iStatus.Int() with error=%d", err ); |
|
320 User::Leave(err); |
|
321 } |
292 |
322 |
293 Post(); |
323 Post(); |
294 |
324 |
295 LOGTEXT(_L8("<<CUsbOtgVbusWatcher::RunL")); |
325 OstTraceFunctionExit0( CUSBOTGVBUSWATCHER_RUNL_EXIT ); |
296 } |
326 } |
297 |
327 |
298 |
328 |
299 /** |
329 /** |
300 * Automatically called when the VBus status watcher is cancelled. |
330 * Automatically called when the VBus status watcher is cancelled. |
301 */ |
331 */ |
302 void CUsbOtgVbusWatcher::DoCancel() |
332 void CUsbOtgVbusWatcher::DoCancel() |
303 { |
333 { |
304 LOG_FUNC |
334 OstTraceFunctionEntry0( CUSBOTGVBUSWATCHER_DOCANCEL_ENTRY ); |
305 iLdd.CancelOtgVbusNotification(); |
335 iLdd.CancelOtgVbusNotification(); |
|
336 OstTraceFunctionExit0( CUSBOTGVBUSWATCHER_DOCANCEL_EXIT ); |
306 } |
337 } |
307 |
338 |
308 /** |
339 /** |
309 * Sets state watcher in active state |
340 * Sets state watcher in active state |
310 */ |
341 */ |
311 void CUsbOtgVbusWatcher::Post() |
342 void CUsbOtgVbusWatcher::Post() |
312 { |
343 { |
313 LOG_FUNC |
344 OstTraceFunctionEntry0( CUSBOTGVBUSWATCHER_POST_ENTRY ); |
314 |
345 |
315 LOGTEXT(_L8("CUsbOtgVbusWatcher::Post() - About to call QueueOtgVbusNotification")); |
346 OstTrace0( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST, "CUsbOtgVbusWatcher::Post - About to call QueueOtgVbusNotification" ); |
|
347 |
316 iLdd.QueueOtgVbusNotification(iOtgVbus, iStatus); |
348 iLdd.QueueOtgVbusNotification(iOtgVbus, iStatus); |
317 switch (iOtgVbus) |
349 switch (iOtgVbus) |
318 { |
350 { |
319 case RUsbOtgDriver::EVbusHigh: |
351 case RUsbOtgDriver::EVbusHigh: |
320 if (RProperty::Set(KUidUsbManCategory,KUsbOtgVBusPoweredProperty,ETrue) != KErrNone) |
352 if (RProperty::Set(KUidUsbManCategory,KUsbOtgVBusPoweredProperty,ETrue) != KErrNone) |
321 { |
353 { |
322 LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::Post [iOtgVbus=%d](EVbusHigh) - failed to set the property value"), iOtgVbus); |
354 OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST_DUP1, |
|
355 "CUsbOtgVbusWatcher::Post;[iOtgVbus=%d](EVbusHigh) - failed to set the property value", iOtgVbus ); |
323 } |
356 } |
324 else |
357 else |
325 { |
358 { |
326 LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::Post [iOtgVbus=%d](EVbusHigh) - property is set to ETrue"), iOtgVbus); |
359 OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST_DUP2, |
|
360 "CUsbOtgVbusWatcher::Post;[iOtgVbus=%d](EVbusHigh) - property is set to ETrue", iOtgVbus ); |
327 } |
361 } |
328 break; |
362 break; |
329 case RUsbOtgDriver::EVbusLow: |
363 case RUsbOtgDriver::EVbusLow: |
330 case RUsbOtgDriver::EVbusUnknown: |
364 case RUsbOtgDriver::EVbusUnknown: |
331 if (RProperty::Set(KUidUsbManCategory,KUsbOtgVBusPoweredProperty,EFalse) != KErrNone) |
365 if (RProperty::Set(KUidUsbManCategory,KUsbOtgVBusPoweredProperty,EFalse) != KErrNone) |
332 { |
366 { |
333 LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::Post [iOtgVbus=%d](1 - EVbusLow, 2 - EVbusUnknown) - failed to set the property value"), iOtgVbus); |
367 OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST_DUP3, |
|
368 "CUsbOtgVbusWatcher::Post;[iOtgVbus=%d](1 - EVbusLow, 2 - EVbusUnknown) - failed to set the property value", iOtgVbus ); |
334 } |
369 } |
335 else |
370 else |
336 { |
371 { |
337 LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::Post [iOtgVbus=%d](1 - EVbusLow, 2 - EVbusUnknown) - property is set to EFalse"), iOtgVbus); |
372 OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST_DUP4, |
|
373 "CUsbOtgVbusWatcher::Post;[iOtgVbus=%d](1 - EVbusLow, 2 - EVbusUnknown) - property is set to EFalse", iOtgVbus ); |
338 } |
374 } |
339 break; |
375 break; |
340 default: |
376 default: |
341 LOGTEXT2(_L8(">>CUsbOtgVbusWatcher::RunL [iOtgVbus=%d] is unrecognized, re-request QueueOtgVbusNotification"), iOtgVbus); |
377 OstTrace1( TRACE_NORMAL, CUSBOTGVBUSWATCHER_POST_DUP5, |
|
378 "CUsbOtgVbusWatcher::Post;iOtgVbus=%d] is unrecognized, re-request QueueOtgVbusNotification", iOtgVbus ); |
342 break; |
379 break; |
343 } |
380 } |
344 SetActive(); |
381 SetActive(); |
|
382 OstTraceFunctionExit0( CUSBOTGVBUSWATCHER_POST_EXIT ); |
345 } |
383 } |
346 |
384 |
347 |
385 |
348 //-------------------------- OTG State watcher class -------------------------- |
386 //-------------------------- OTG State watcher class -------------------------- |
349 /** |
387 /** |
410 */ |
451 */ |
411 |
452 |
412 CUsbOtgStateWatcher::CUsbOtgStateWatcher(RUsbOtgDriver& aLdd) |
453 CUsbOtgStateWatcher::CUsbOtgStateWatcher(RUsbOtgDriver& aLdd) |
413 : CUsbOtgBaseWatcher(aLdd) |
454 : CUsbOtgBaseWatcher(aLdd) |
414 { |
455 { |
415 LOG_FUNC |
456 OstTraceFunctionEntry0( CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_CONS_ENTRY ); |
416 iOtgState = RUsbOtgDriver::EStateReset; |
457 iOtgState = RUsbOtgDriver::EStateReset; |
|
458 OstTraceFunctionExit0( CUSBOTGSTATEWATCHER_CUSBOTGSTATEWATCHER_CONS_EXIT ); |
417 } |
459 } |
418 |
460 |
419 /** |
461 /** |
420 * Called when the OTG State change is reported |
462 * Called when the OTG State change is reported |
421 */ |
463 */ |
422 void CUsbOtgStateWatcher::RunL() |
464 void CUsbOtgStateWatcher::RunL() |
423 { |
465 { |
424 LOG_FUNC |
466 OstTraceFunctionEntry0( CUSBOTGSTATEWATCHER_RUNL_ENTRY ); |
425 LOGTEXT2(_L8(">>CUsbOtgStateWatcher::RunL [iStatus=%d]"), iStatus.Int()); |
467 OstTrace1( TRACE_NORMAL, CUSBOTGSTATEWATCHER_RUNL, "CUsbOtgStateWatcher::RunL;iStatus.Int()=%d", iStatus.Int() ); |
426 |
468 |
427 LEAVEIFERRORL(iStatus.Int()); |
469 TInt err = iStatus.Int(); |
|
470 if(err < 0) |
|
471 { |
|
472 OstTrace1( TRACE_NORMAL, CUSBOTGSTATEWATCHER_RUNL_DUP1, "CUsbOtgStateWatcher::RunL;iStatus.Int() with error=%d", err ); |
|
473 User::Leave(err); |
|
474 } |
428 |
475 |
429 Post(); |
476 Post(); |
430 |
477 |
431 LOGTEXT(_L8("<<CUsbOtgStateWatcher::RunL")); |
478 OstTraceFunctionExit0( CUSBOTGSTATEWATCHER_RUNL_EXIT ); |
432 } |
479 } |
433 |
480 |
434 |
481 |
435 /** |
482 /** |
436 * Automatically called when the OTG State watcher is cancelled. |
483 * Automatically called when the OTG State watcher is cancelled. |
437 */ |
484 */ |
438 void CUsbOtgStateWatcher::DoCancel() |
485 void CUsbOtgStateWatcher::DoCancel() |
439 { |
486 { |
440 LOG_FUNC |
487 OstTraceFunctionEntry0( CUSBOTGSTATEWATCHER_DOCANCEL_ENTRY ); |
441 iLdd.CancelOtgStateNotification(); |
488 iLdd.CancelOtgStateNotification(); |
|
489 OstTraceFunctionExit0( CUSBOTGSTATEWATCHER_DOCANCEL_EXIT ); |
442 } |
490 } |
443 |
491 |
444 /** |
492 /** |
445 * Sets state watcher in active state |
493 * Sets state watcher in active state |
446 */ |
494 */ |
447 void CUsbOtgStateWatcher::Post() |
495 void CUsbOtgStateWatcher::Post() |
448 { |
496 { |
449 LOG_FUNC |
497 OstTraceFunctionEntry0( CUSBOTGSTATEWATCHER_POST_ENTRY ); |
450 |
498 |
451 LOGTEXT(_L8("CUsbOtgStateWatcher::Post() - About to call QueueOtgStateNotification")); |
499 OstTrace0( TRACE_NORMAL, CUSBOTGSTATEWATCHER_POST, "CUsbOtgStateWatcher::Post - About to call QueueOtgStateNotification" ); |
452 iLdd.QueueOtgStateNotification(iOtgState, iStatus); |
500 iLdd.QueueOtgStateNotification(iOtgState, iStatus); |
453 LOGTEXT3(_L8(">>CUsbOtgStateWatcher::RunL [iStatus=%d], iOtgState = %d"), iStatus.Int(), iOtgState); |
501 OstTraceExt2( TRACE_NORMAL, CUSBOTGSTATEWATCHER_POST_DUP1, |
|
502 "CUsbOtgStateWatcher::Post;[iStatus=%d], iOtgState = %d", iStatus.Int(), iOtgState ); |
454 if (RProperty::Set(KUidUsbManCategory,KUsbOtgStateProperty,(TInt)iOtgState) != KErrNone) |
503 if (RProperty::Set(KUidUsbManCategory,KUsbOtgStateProperty,(TInt)iOtgState) != KErrNone) |
455 { |
504 { |
456 LOGTEXT3(_L8(">>CUsbOtgStateWatcher::RunL [iStatus=%d], iOtgState = %d - failed to set the property"), iStatus.Int(), iOtgState); |
505 OstTraceExt2( TRACE_NORMAL, CUSBOTGSTATEWATCHER_POST_DUP2, |
|
506 "CUsbOtgStateWatcher::Post;[iStatus=%d], iOtgState = %d - failed to set the property", iStatus.Int(), iOtgState ); |
457 } |
507 } |
458 |
508 |
459 SetActive(); |
509 SetActive(); |
|
510 OstTraceFunctionExit0( CUSBOTGSTATEWATCHER_POST_EXIT ); |
460 } |
511 } |
461 |
512 |
462 //-------------------------- OTG Events watcher class ------------------------- |
513 //-------------------------- OTG Events watcher class ------------------------- |
463 /** |
514 /** |
464 * The CUsbOtgEventWatcher::NewL method |
515 * The CUsbOtgEventWatcher::NewL method |
517 */ |
571 */ |
518 CUsbOtgEventWatcher::CUsbOtgEventWatcher(CUsbOtg& aOwner, RUsbOtgDriver& aLdd, |
572 CUsbOtgEventWatcher::CUsbOtgEventWatcher(CUsbOtg& aOwner, RUsbOtgDriver& aLdd, |
519 RUsbOtgDriver::TOtgEvent& aOtgEvent) |
573 RUsbOtgDriver::TOtgEvent& aOtgEvent) |
520 : CUsbOtgBaseWatcher(aLdd), iOwner(aOwner), iOtgEvent(aOtgEvent) |
574 : CUsbOtgBaseWatcher(aLdd), iOwner(aOwner), iOtgEvent(aOtgEvent) |
521 { |
575 { |
522 LOG_FUNC |
576 OstTraceFunctionEntry0( CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_CONS_ENTRY ); |
|
577 OstTraceFunctionExit0( CUSBOTGEVENTWATCHER_CUSBOTGEVENTWATCHER_CONS_EXIT ); |
523 } |
578 } |
524 |
579 |
525 /** |
580 /** |
526 * Called when the OTG Event is reported |
581 * Called when the OTG Event is reported |
527 */ |
582 */ |
528 void CUsbOtgEventWatcher::RunL() |
583 void CUsbOtgEventWatcher::RunL() |
529 { |
584 { |
530 LOG_FUNC |
585 OstTraceFunctionEntry0( CUSBOTGEVENTWATCHER_RUNL_ENTRY ); |
531 LOGTEXT2(_L8(">>CUsbOtgEventWatcher::RunL [iStatus=%d]"), iStatus.Int()); |
586 OstTrace1( TRACE_NORMAL, CUSBOTGEVENTWATCHER_RUNL, "CUsbOtgEventWatcher::RunL;iStatus=%d", iStatus.Int() ); |
532 |
587 TInt err = iStatus.Int(); |
533 LEAVEIFERRORL(iStatus.Int()); |
588 if(err < 0) |
534 LOGTEXT2(_L8("CUsbOtgEventWatcher::RunL() - Otg Event reported: %d"), (TInt)iOtgEvent); |
589 { |
|
590 OstTrace1( TRACE_NORMAL, CUSBOTGEVENTWATCHER_RUNL_DUP3, "CUsbOtgEventWatcher::RunL;iStatus.Int() with error=%d", err ); |
|
591 User::Leave(err); |
|
592 } |
|
593 |
|
594 OstTrace1( TRACE_NORMAL, CUSBOTGEVENTWATCHER_RUNL_DUP1, |
|
595 "CUsbOtgEventWatcher::RunL; - Otg Event reported: %d", (TInt)iOtgEvent ); |
535 if ( ( iOtgEvent == RUsbOtgDriver::EEventHnpDisabled ) |
596 if ( ( iOtgEvent == RUsbOtgDriver::EEventHnpDisabled ) |
536 ||( iOtgEvent == RUsbOtgDriver::EEventHnpEnabled ) |
597 ||( iOtgEvent == RUsbOtgDriver::EEventHnpEnabled ) |
537 ||( iOtgEvent == RUsbOtgDriver::EEventSrpInitiated ) |
598 ||( iOtgEvent == RUsbOtgDriver::EEventSrpInitiated ) |
538 ||( iOtgEvent == RUsbOtgDriver::EEventSrpReceived ) |
599 ||( iOtgEvent == RUsbOtgDriver::EEventSrpReceived ) |
539 ||( iOtgEvent == RUsbOtgDriver::EEventVbusRaised ) |
600 ||( iOtgEvent == RUsbOtgDriver::EEventVbusRaised ) |
540 ||( iOtgEvent == RUsbOtgDriver::EEventVbusDropped ) |
601 ||( iOtgEvent == RUsbOtgDriver::EEventVbusDropped ) |
541 ) |
602 ) |
542 { |
603 { |
543 iOwner.NotifyOtgEvent(); |
604 iOwner.NotifyOtgEvent(); |
544 LOGTEXT2(_L8("CUsbOtgEventWatcher::RunL() - The owner is notified about Otg Event = %d"), (TInt)iOtgEvent); |
605 OstTrace1( TRACE_NORMAL, CUSBOTGEVENTWATCHER_RUNL_DUP2, |
|
606 "CUsbOtgEventWatcher::RunL - The owner is notified about Otg Event = %d", (TInt)iOtgEvent ); |
545 } |
607 } |
546 Post(); |
608 Post(); |
547 LOGTEXT(_L8("<<CUsbOtgEventWatcher::RunL")); |
609 OstTraceFunctionExit0( CUSBOTGEVENTWATCHER_RUNL_EXIT ); |
548 } |
610 } |
549 |
611 |
550 #ifndef __FLOG_ACTIVE |
612 #ifndef _DEBUG |
551 void CUsbOtgEventWatcher::LogEventText(RUsbOtgDriver::TOtgEvent /*aState*/) |
613 void CUsbOtgEventWatcher::LogEventText(RUsbOtgDriver::TOtgEvent /*aState*/) |
552 { |
614 { |
553 } |
615 } |
554 #else |
616 #else |
555 void CUsbOtgEventWatcher::LogEventText(RUsbOtgDriver::TOtgEvent aEvent) |
617 void CUsbOtgEventWatcher::LogEventText(RUsbOtgDriver::TOtgEvent aEvent) |
556 { |
618 { |
557 switch (aEvent) |
619 switch (aEvent) |
558 { |
620 { |
559 case RUsbOtgDriver::EEventAPlugInserted: |
621 case RUsbOtgDriver::EEventAPlugInserted: |
560 LOGTEXT(_L8(" ***** A-Plug Inserted *****")); |
622 OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT, |
|
623 "CUsbOtgEventWatcher::LogEventText ***** A-Plug Inserted *****" ); |
561 break; |
624 break; |
562 case RUsbOtgDriver::EEventAPlugRemoved: |
625 case RUsbOtgDriver::EEventAPlugRemoved: |
563 LOGTEXT(_L8(" ***** A-Plug Removed *****")); |
626 OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP1, |
|
627 "CUsbOtgEventWatcher::LogEventText ***** A-Plug Removed *****" ); |
564 break; |
628 break; |
565 case RUsbOtgDriver::EEventVbusRaised: |
629 case RUsbOtgDriver::EEventVbusRaised: |
566 LOGTEXT(_L8(" ***** VBus Raised *****")); |
630 OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP2, |
|
631 "CUsbOtgEventWatcher::LogEventText ***** VBus Raised *****" ); |
567 break; |
632 break; |
568 case RUsbOtgDriver::EEventVbusDropped: |
633 case RUsbOtgDriver::EEventVbusDropped: |
569 LOGTEXT(_L8(" ***** VBus Dropped *****")); |
634 OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP3, |
|
635 "CUsbOtgEventWatcher::LogEventText ***** VBus Dropped *****" ); |
570 break; |
636 break; |
571 case RUsbOtgDriver::EEventSrpInitiated: |
637 case RUsbOtgDriver::EEventSrpInitiated: |
572 LOGTEXT(_L8(" ***** SRP Initiated *****")); |
638 OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP4, |
|
639 "CUsbOtgEventWatcher::LogEventText ***** SRP Initiated *****" ); |
573 break; |
640 break; |
574 case RUsbOtgDriver::EEventSrpReceived: |
641 case RUsbOtgDriver::EEventSrpReceived: |
575 LOGTEXT(_L8(" ***** SRP Received *****")); |
642 OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP5, |
|
643 "CUsbOtgEventWatcher::LogEventText ***** SRP Received *****" ); |
576 break; |
644 break; |
577 case RUsbOtgDriver::EEventHnpEnabled: |
645 case RUsbOtgDriver::EEventHnpEnabled: |
578 LOGTEXT(_L8(" ***** HNP Enabled *****")); |
646 OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP6, |
|
647 "CUsbOtgEventWatcher::LogEventText ***** HNP Enabled *****" ); |
579 break; |
648 break; |
580 case RUsbOtgDriver::EEventHnpDisabled: |
649 case RUsbOtgDriver::EEventHnpDisabled: |
581 LOGTEXT(_L8(" ***** HNP Disabled *****")); |
650 OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP7, |
|
651 "CUsbOtgEventWatcher::LogEventText ***** HNP Disabled *****" ); |
582 break; |
652 break; |
583 case RUsbOtgDriver::EEventRoleChangedToHost: |
653 case RUsbOtgDriver::EEventRoleChangedToHost: |
584 LOGTEXT(_L8(" ***** Role Changed to Host *****")); |
654 OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP8, |
|
655 "CUsbOtgEventWatcher::LogEventText ***** Role Changed to Host *****" ); |
585 break; |
656 break; |
586 case RUsbOtgDriver::EEventRoleChangedToDevice: |
657 case RUsbOtgDriver::EEventRoleChangedToDevice: |
587 LOGTEXT(_L8(" ***** Role Changed to Device *****")); |
658 OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP9, |
|
659 "CUsbOtgEventWatcher::LogEventText ***** Role Changed to Device *****" ); |
588 break; |
660 break; |
589 case RUsbOtgDriver::EEventRoleChangedToIdle: |
661 case RUsbOtgDriver::EEventRoleChangedToIdle: |
590 LOGTEXT(_L8(" ***** Role Changed to Idle *****")); |
662 OstTrace0( TRACE_NORMAL, CUSBOTGEVENTWATCHER_LOGEVENTTEXT_DUP10, |
|
663 "CUsbOtgEventWatcher::LogEventText ***** Role Changed to Idle *****" ); |
591 break; |
664 break; |
592 default: |
665 default: |
593 break; |
666 break; |
594 } |
667 } |
595 } |
668 } |
664 * @param aLdd A reference to the USB Logical Device Driver |
739 * @param aLdd A reference to the USB Logical Device Driver |
665 */ |
740 */ |
666 CUsbOtgWatcher::CUsbOtgWatcher(MUsbOtgObserver& aOwner, RUsbOtgDriver& aLdd, TUint& aOtgMessage) |
741 CUsbOtgWatcher::CUsbOtgWatcher(MUsbOtgObserver& aOwner, RUsbOtgDriver& aLdd, TUint& aOtgMessage) |
667 : CActive(CActive::EPriorityStandard), iOwner(aOwner), iLdd(aLdd), iOtgMessage(aOtgMessage) |
742 : CActive(CActive::EPriorityStandard), iOwner(aOwner), iLdd(aLdd), iOtgMessage(aOtgMessage) |
668 { |
743 { |
669 LOG_FUNC |
744 OstTraceFunctionEntry0( CUSBOTGWATCHER_CUSBOTGWATCHER_CONS_ENTRY ); |
670 CActiveScheduler::Add(this); |
745 CActiveScheduler::Add(this); |
|
746 OstTraceFunctionExit0( CUSBOTGWATCHER_CUSBOTGWATCHER_CONS_EXIT ); |
671 } |
747 } |
672 |
748 |
673 /** |
749 /** |
674 * Called when the OTG component changes its state. |
750 * Called when the OTG component changes its state. |
675 */ |
751 */ |
676 void CUsbOtgWatcher::RunL() |
752 void CUsbOtgWatcher::RunL() |
677 { |
753 { |
678 LOG_FUNC |
754 OstTraceFunctionEntry0( CUSBOTGWATCHER_RUNL_ENTRY ); |
679 if (iStatus.Int() != KErrNone) |
755 if (iStatus.Int() != KErrNone) |
680 { |
756 { |
681 LOGTEXT2(_L8("CUsbOtgWatcher::RunL() - Error = %d"), iStatus.Int()); |
757 OstTrace1( TRACE_NORMAL, CUSBOTGWATCHER_RUNL, "CUsbOtgWatcher::RunL;Error=%d", iStatus.Int() ); |
|
758 OstTraceFunctionExit0( CUSBOTGWATCHER_RUNL_EXIT ); |
682 return; |
759 return; |
683 } |
760 } |
684 |
761 |
685 LOGTEXT2(_L8("CUsbOtgWatcher::RunL() - Otg Message reported: %d"), iOtgMessage); |
762 OstTrace1( TRACE_NORMAL, CUSBOTGWATCHER_RUNL_DUP1, "CUsbOtgWatcher::RunL;Otg Message reported: %d", iOtgMessage ); |
686 iOwner.NotifyMessage(); |
763 iOwner.NotifyMessage(); |
687 |
764 |
688 Post(); |
765 Post(); |
|
766 OstTraceFunctionExit0( CUSBOTGWATCHER_RUNL_EXIT_DUP1 ); |
689 } |
767 } |
690 |
768 |
691 |
769 |
692 /** |
770 /** |
693 * Automatically called when the state watcher is cancelled. |
771 * Automatically called when the state watcher is cancelled. |
694 */ |
772 */ |
695 void CUsbOtgWatcher::DoCancel() |
773 void CUsbOtgWatcher::DoCancel() |
696 { |
774 { |
697 LOG_FUNC |
775 OstTraceFunctionEntry0( CUSBOTGWATCHER_DOCANCEL_ENTRY ); |
698 iLdd.CancelOtgMessageRequest(); |
776 iLdd.CancelOtgMessageRequest(); |
|
777 OstTraceFunctionExit0( CUSBOTGWATCHER_DOCANCEL_EXIT ); |
699 } |
778 } |
700 |
779 |
701 |
780 |
702 /** |
781 /** |
703 * Instructs the state watcher to start watching. |
782 * Instructs the state watcher to start watching. |
704 */ |
783 */ |
705 void CUsbOtgWatcher::Start() |
784 void CUsbOtgWatcher::Start() |
706 { |
785 { |
707 LOG_FUNC |
786 OstTraceFunctionEntry0( CUSBOTGWATCHER_START_ENTRY ); |
708 Post(); |
787 Post(); |
|
788 OstTraceFunctionExit0( CUSBOTGWATCHER_START_EXIT ); |
709 } |
789 } |
710 |
790 |
711 /** |
791 /** |
712 * Sets state watcher in active state |
792 * Sets state watcher in active state |
713 */ |
793 */ |
714 void CUsbOtgWatcher::Post() |
794 void CUsbOtgWatcher::Post() |
715 { |
795 { |
716 LOG_FUNC |
796 OstTraceFunctionEntry0( CUSBOTGWATCHER_POST_ENTRY ); |
717 |
797 |
718 LOGTEXT(_L8("CUsbOtgWatcher::Post() - About to call QueueOtgMessageRequest")); |
798 OstTrace0( TRACE_NORMAL, CUSBOTGWATCHER_POST, "CUsbOtgWatcher::Post - About to call QueueOtgMessageRequest" ); |
719 iLdd.QueueOtgMessageRequest((RUsbOtgDriver::TOtgMessage&)iOtgMessage, iStatus); |
799 iLdd.QueueOtgMessageRequest((RUsbOtgDriver::TOtgMessage&)iOtgMessage, iStatus); |
720 SetActive(); |
800 SetActive(); |
|
801 OstTraceFunctionExit0( CUSBOTGWATCHER_POST_EXIT ); |
721 } |
802 } |
722 |
803 |
723 |
804 |
724 |
805 |
725 |
806 |
760 User::LeaveIfError(err); |
841 User::LeaveIfError(err); |
761 } |
842 } |
762 User::LeaveIfError(iProp.Attach(KUidUsbManCategory, KUsbRequestSessionProperty)); |
843 User::LeaveIfError(iProp.Attach(KUidUsbManCategory, KUsbRequestSessionProperty)); |
763 iProp.Subscribe(iStatus); |
844 iProp.Subscribe(iStatus); |
764 SetActive(); |
845 SetActive(); |
|
846 OstTraceFunctionExit0( CREQUESTSESSIONWATCHER_CONSTRUCTL_EXIT ); |
765 } |
847 } |
766 |
848 |
767 CRequestSessionWatcher::CRequestSessionWatcher(MUsbOtgObserver& aOwner) |
849 CRequestSessionWatcher::CRequestSessionWatcher(MUsbOtgObserver& aOwner) |
768 : CActive(CActive::EPriorityStandard), iOwner(aOwner) |
850 : CActive(CActive::EPriorityStandard), iOwner(aOwner) |
769 { |
851 { |
770 LOG_FUNC |
852 OstTraceFunctionEntry0( CREQUESTSESSIONWATCHER_CREQUESTSESSIONWATCHER_CONS_ENTRY ); |
771 CActiveScheduler::Add(this); |
853 CActiveScheduler::Add(this); |
|
854 OstTraceFunctionExit0( CREQUESTSESSIONWATCHER_CREQUESTSESSIONWATCHER_CONS_EXIT ); |
772 } |
855 } |
773 |
856 |
774 /** |
857 /** |
775 * Called when the OTG Event is reported |
858 * Called when the OTG Event is reported |
776 */ |
859 */ |
777 void CRequestSessionWatcher::RunL() |
860 void CRequestSessionWatcher::RunL() |
778 { |
861 { |
779 LOG_FUNC |
862 OstTraceFunctionEntry0( CREQUESTSESSIONWATCHER_RUNL_ENTRY ); |
780 LOGTEXT2(_L8(">>CRequestSessionWatcher::RunL [iStatus=%d]"), iStatus.Int()); |
863 OstTrace1( TRACE_NORMAL, CREQUESTSESSIONWATCHER_RUNL, "CRequestSessionWatcher::RunL;iStatus=%d", iStatus.Int() ); |
781 RDebug::Printf(">>CRequestSessionWatcher::RunL [iStatus=%d]", iStatus.Int()); |
864 RDebug::Printf(">>CRequestSessionWatcher::RunL [iStatus=%d]", iStatus.Int()); |
782 |
865 |
783 iProp.Subscribe(iStatus); |
866 iProp.Subscribe(iStatus); |
784 SetActive(); |
867 SetActive(); |
785 |
868 |
867 */ |
954 */ |
868 |
955 |
869 CUsbOtgConnectionIdleWatcher::CUsbOtgConnectionIdleWatcher(RUsbOtgDriver& aLdd) |
956 CUsbOtgConnectionIdleWatcher::CUsbOtgConnectionIdleWatcher(RUsbOtgDriver& aLdd) |
870 : CUsbOtgBaseWatcher(aLdd) |
957 : CUsbOtgBaseWatcher(aLdd) |
871 { |
958 { |
872 LOG_FUNC |
959 OstTraceFunctionEntry0( CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_CONS_ENTRY ); |
|
960 OstTraceFunctionExit0( CUSBOTGCONNECTIONIDLEWATCHER_CUSBOTGCONNECTIONIDLEWATCHER_CONS_EXIT ); |
873 } |
961 } |
874 |
962 |
875 /** |
963 /** |
876 * Called when the Connection Idle status change is reported |
964 * Called when the Connection Idle status change is reported |
877 */ |
965 */ |
878 void CUsbOtgConnectionIdleWatcher::RunL() |
966 void CUsbOtgConnectionIdleWatcher::RunL() |
879 { |
967 { |
880 LOG_FUNC |
968 OstTraceFunctionEntry0( CUSBOTGCONNECTIONIDLEWATCHER_RUNL_ENTRY ); |
881 LOGTEXT2(_L8(">>CUsbOtgConnectionIdleWatcher::RunL [iStatus=%d]"), iStatus.Int()); |
969 OstTrace1( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_RUNL, |
882 |
970 "CUsbOtgConnectionIdleWatcher::RunL;iStatus=%d", iStatus.Int() ); |
883 LEAVEIFERRORL(iStatus.Int()); |
|
884 |
971 |
|
972 TInt err = iStatus.Int(); |
|
973 if(err < 0) |
|
974 { |
|
975 OstTrace1( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_RUNL_DUP1, "CUsbOtgConnectionIdleWatcher::RunL;iStatus.Int() with error=%d", err ); |
|
976 User::Leave(err); |
|
977 } |
|
978 |
885 Post(); |
979 Post(); |
886 |
980 |
887 LOGTEXT(_L8("<<CUsbOtgConnectionIdleWatcher::RunL")); |
981 OstTraceFunctionExit0( CUSBOTGCONNECTIONIDLEWATCHER_RUNL_EXIT ); |
888 } |
982 } |
889 |
983 |
890 |
984 |
891 /** |
985 /** |
892 * Automatically called when the Connection Idle watcher is cancelled. |
986 * Automatically called when the Connection Idle watcher is cancelled. |
893 */ |
987 */ |
894 void CUsbOtgConnectionIdleWatcher::DoCancel() |
988 void CUsbOtgConnectionIdleWatcher::DoCancel() |
895 { |
989 { |
896 LOG_FUNC |
990 OstTraceFunctionEntry0( CUSBOTGCONNECTIONIDLEWATCHER_DOCANCEL_ENTRY ); |
897 iLdd.CancelOtgConnectionNotification(); |
991 iLdd.CancelOtgConnectionNotification(); |
|
992 OstTraceFunctionExit0( CUSBOTGCONNECTIONIDLEWATCHER_DOCANCEL_EXIT ); |
898 } |
993 } |
899 |
994 |
900 /** |
995 /** |
901 * Sets state watcher in active state |
996 * Sets state watcher in active state |
902 */ |
997 */ |
903 void CUsbOtgConnectionIdleWatcher::Post() |
998 void CUsbOtgConnectionIdleWatcher::Post() |
904 { |
999 { |
905 LOG_FUNC |
1000 OstTraceFunctionEntry0( CUSBOTGCONNECTIONIDLEWATCHER_POST_ENTRY ); |
906 |
1001 |
907 LOGTEXT(_L8("CUsbOtgConnectionIdleWatcher::Post() - About to call QueueOtgIdPinNotification")); |
1002 OstTrace0( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_POST, |
|
1003 "CUsbOtgConnectionIdleWatcher::Post - About to call QueueOtgIdPinNotification" ); |
908 iLdd.QueueOtgConnectionNotification(iConnectionIdle, iStatus); |
1004 iLdd.QueueOtgConnectionNotification(iConnectionIdle, iStatus); |
909 switch (iConnectionIdle) |
1005 switch (iConnectionIdle) |
910 { |
1006 { |
911 case RUsbOtgDriver::EConnectionIdle: |
1007 case RUsbOtgDriver::EConnectionIdle: |
912 case RUsbOtgDriver::EConnectionUnknown: |
1008 case RUsbOtgDriver::EConnectionUnknown: |
913 RProperty::Set(KUidUsbManCategory,KUsbOtgConnectionIdleProperty,ETrue); |
1009 RProperty::Set(KUidUsbManCategory,KUsbOtgConnectionIdleProperty,ETrue); |
914 LOGTEXT2(_L8(">>CUsbOtgConnectionIdleWatcher::Post [iConnectionIdle=%d] - property is set to 1"), iConnectionIdle); |
1010 OstTrace1( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_POST_DUP1, |
|
1011 "CUsbOtgConnectionIdleWatcher::Post;[iConnectionIdle=%d] - property is set to 1", iConnectionIdle ); |
915 break; |
1012 break; |
916 case RUsbOtgDriver::EConnectionBusy: |
1013 case RUsbOtgDriver::EConnectionBusy: |
917 RProperty::Set(KUidUsbManCategory,KUsbOtgConnectionIdleProperty,EFalse); |
1014 RProperty::Set(KUidUsbManCategory,KUsbOtgConnectionIdleProperty,EFalse); |
918 LOGTEXT2(_L8(">>CUsbOtgConnectionIdleWatcher::Post [iConnectionIdle=%d] - property is set to 0"), iConnectionIdle); |
1015 OstTrace1( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_POST_DUP2, |
|
1016 "CUsbOtgConnectionIdleWatcher::Post;[iConnectionIdle=%d] - property is set to 0", iConnectionIdle ); |
919 break; |
1017 break; |
920 default: |
1018 default: |
921 LOGTEXT2(_L8(">>CUsbOtgConnectionIdleWatcher::Post [iConnectionIdle=%d] is unrecognized, re-request QueueOtgIdPinNotification"), iConnectionIdle); |
1019 OstTrace1( TRACE_NORMAL, CUSBOTGCONNECTIONIDLEWATCHER_POST_DUP3, |
|
1020 "CUsbOtgConnectionIdleWatcher::Post;[iConnectionIdle=%d] is unrecognized, re-request QueueOtgIdPinNotification", iConnectionIdle ); |
922 break; |
1021 break; |
923 } |
1022 } |
924 SetActive(); |
1023 SetActive(); |
925 } |
1024 OstTraceFunctionExit0( CUSBOTGCONNECTIONIDLEWATCHER_POST_EXIT ); |
926 |
1025 } |
927 |
1026 |
|
1027 |