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