68 _LIT(KEpIn,"\"IN\""); |
72 _LIT(KEpIn,"\"IN\""); |
69 _LIT(KEpOut,"\"OUT\""); |
73 _LIT(KEpOut,"\"OUT\""); |
70 |
74 |
71 static const TInt8 KMaxXMLNesting = 3; // max 3 levels of xml nesting |
75 static const TInt8 KMaxXMLNesting = 3; // max 3 levels of xml nesting |
72 |
76 |
73 static const TPtrC xmlKeys[] = |
77 static const TPtrC xmlKeys[] = |
74 { |
78 { |
75 (TDesC&)KCfgLDD, (TDesC&)KCfgLDD1, (TDesC&)KCfgLDD2, (TDesC&)KCfgLDD3, (TDesC&)KCfgLDD4, (TDesC&)KCfgLDD5, (TDesC&)KCfgLDD6, |
79 (TDesC&)KCfgLDD, (TDesC&)KCfgLDD1, (TDesC&)KCfgLDD2, (TDesC&)KCfgLDD3, (TDesC&)KCfgLDD4, (TDesC&)KCfgLDD5, (TDesC&)KCfgLDD6, |
76 (TDesC&)KCfgLDD7, (TDesC&)KCfgLDD8, (TDesC&)KCfgLDD9, (TDesC&)KCfgLDD10, (TDesC&)KCfgLDD11, (TDesC&)KCfgLDD12, (TDesC&)KCfgLDD13, |
80 (TDesC&)KCfgLDD7, (TDesC&)KCfgLDD8, (TDesC&)KCfgLDD9, (TDesC&)KCfgLDD10, (TDesC&)KCfgLDD11, (TDesC&)KCfgLDD12, (TDesC&)KCfgLDD13, |
77 (TDesC&)KCfgLDD14, (TDesC&)KCfgLDD15, (TDesC&)KCfgLDD16, |
81 (TDesC&)KCfgLDD14, (TDesC&)KCfgLDD15, (TDesC&)KCfgLDD16, |
78 (TDesC&)KCfgIF, (TDesC&)KCfgIFS, (TDesC&)KCfgIF1, (TDesC&)KCfgIF2, (TDesC&)KCfgIF3, (TDesC&)KCfgIF4, (TDesC&)KCfgIF5, (TDesC&)KCfgIF6, |
82 (TDesC&)KCfgIF, (TDesC&)KCfgIFS, (TDesC&)KCfgIF1, (TDesC&)KCfgIF2, (TDesC&)KCfgIF3, (TDesC&)KCfgIF4, (TDesC&)KCfgIF5, (TDesC&)KCfgIF6, |
243 else |
250 else |
244 if (!nextChar.IsSpace()) |
251 if (!nextChar.IsSpace()) |
245 { |
252 { |
246 error = true; |
253 error = true; |
247 TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ()); |
254 TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ()); |
|
255 OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP03, "Config File Syntax Error at index %d of %S",i,stringBuf); |
248 } |
256 } |
249 break; |
257 break; |
250 |
258 |
251 case EStartKey: |
259 case EStartKey: |
252 if (nextChar == '/') |
260 if (nextChar == '/') |
253 { |
261 { |
254 state = EEndKey; |
262 state = EEndKey; |
255 endkeyString.SetLength(0); |
263 endkeyString.SetLength(0); |
256 } |
264 } |
257 else |
265 else |
258 { |
266 { |
259 if (nextChar == '>') |
267 if (nextChar == '>') |
260 { |
268 { |
261 level++; |
269 level++; |
262 if (level > KMaxXMLNesting) |
270 if (level > KMaxXMLNesting) |
263 { |
271 { |
264 error = true; |
272 error = true; |
265 TUSB_PRINT1 ("Config File Too Many levels %s",stringBuf.PtrZ()); |
273 TUSB_PRINT1 ("Config File Too Many levels %s",stringBuf.PtrZ()); |
|
274 OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP04, "Config File Too Many levels %S",stringBuf); |
266 } |
275 } |
267 else |
276 else |
268 { |
277 { |
269 levelKeys[level] = CheckXmlKey (keyString,level); |
278 levelKeys[level] = CheckXmlKey (keyString,level); |
270 if (levelKeys[level] < 0) |
279 if (levelKeys[level] < 0) |
271 { |
280 { |
272 error = true; |
281 error = true; |
273 TUSB_PRINT1 ("Invalid XML key %s",keyString.PtrZ()); |
282 TUSB_PRINT1 ("Invalid XML key %s",keyString.PtrZ()); |
|
283 OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP05, "Invalid XML key %S",keyString); |
274 } |
284 } |
275 else |
285 else |
276 { |
286 { |
277 if (CheckAttribute(iConsole,cpPtr,levelKeys[level],attributeString)) |
287 if (CheckAttribute(iConsole,cpPtr,levelKeys[level],attributeString)) |
278 { |
288 { |
279 state = EValue; |
289 state = EValue; |
280 TUSB_VERBOSE_PRINT2 ("Start key: %s level %d",keyString.PtrZ(),level); |
290 TUSB_VERBOSE_PRINT2 ("Start key: %s level %d",keyString.PtrZ(),level); |
|
291 if(gVerbose) |
|
292 { |
|
293 OstTraceExt2 (TRACE_VERBOSE, CONFIGPTRS_CONFIGPTRS_DUP06, "Start key: %S level %d",keyString,level); |
|
294 } |
281 } |
295 } |
282 else |
296 else |
283 { |
297 { |
284 error = true; |
298 error = true; |
285 TUSB_PRINT1 ("No attribute for XML key %s",keyString.PtrZ()); |
299 TUSB_PRINT1 ("No attribute for XML key %s",keyString.PtrZ()); |
|
300 OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP07, "No attribute for XML key %S",keyString); |
286 } |
301 } |
287 } |
302 } |
288 } |
303 } |
289 } |
304 } |
290 else |
305 else |
309 keyString.Append(nextChar); |
325 keyString.Append(nextChar); |
310 } |
326 } |
311 } |
327 } |
312 } |
328 } |
313 break; |
329 break; |
314 |
330 |
315 case EEndKey: |
331 case EEndKey: |
316 if (nextChar == '>') |
332 if (nextChar == '>') |
317 { |
333 { |
318 if (levelKeys[level] != CheckXmlKey (endkeyString,level)) |
334 if (levelKeys[level] != CheckXmlKey (endkeyString,level)) |
319 { |
335 { |
320 error = true; |
336 error = true; |
321 TUSB_PRINT1 ("Invalid XML end key %s",endkeyString.PtrZ()); |
337 TUSB_PRINT1 ("Invalid XML end key %s",endkeyString.PtrZ()); |
|
338 OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP09, "Invalid XML end key %S",endkeyString); |
322 } |
339 } |
323 else |
340 else |
324 { |
341 { |
325 if (CheckValue(iConsole,cpPtr,levelKeys[level],valueString)) |
342 if (CheckValue(iConsole,cpPtr,levelKeys[level],valueString)) |
326 { |
343 { |
327 state = EEmpty; |
344 state = EEmpty; |
328 TUSB_VERBOSE_PRINT2 ("End Key: %s value %s",endkeyString.PtrZ(),valueString.PtrZ()); |
345 TUSB_VERBOSE_PRINT2 ("End Key: %s value %s",endkeyString.PtrZ(),valueString.PtrZ()); |
|
346 if(gVerbose) |
|
347 { |
|
348 OstTraceExt2 (TRACE_VERBOSE, CONFIGPTRS_CONFIGPTRS_DUP10, "End Key: %S value %S",endkeyString,valueString); |
|
349 } |
329 level--; |
350 level--; |
330 valueString.SetLength(0); |
351 valueString.SetLength(0); |
331 } |
352 } |
332 else |
353 else |
333 { |
354 { |
334 error = true; |
355 error = true; |
335 TUSB_PRINT2 ("Incorrect value string %s for XML key %s",valueString.PtrZ(),endkeyString.PtrZ()); |
356 TUSB_PRINT2 ("Incorrect value string %s for XML key %s",valueString.PtrZ(),endkeyString.PtrZ()); |
|
357 OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP11, "Incorrect value string %S for XML key %S",valueString,endkeyString); |
336 } |
358 } |
337 } |
359 } |
338 } |
360 } |
339 if (nextChar.IsSpace()) |
361 if (nextChar.IsSpace()) |
340 { |
362 { |
341 error = true; |
363 error = true; |
342 TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ()); |
364 TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ()); |
|
365 OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP12, "Config File Syntax Error at index %d of %S",i,stringBuf); |
343 } |
366 } |
344 else |
367 else |
345 { |
368 { |
346 endkeyString.Append(nextChar); |
369 endkeyString.Append(nextChar); |
347 } |
370 } |
348 break; |
371 break; |
349 |
372 |
350 case EAttribute: |
373 case EAttribute: |
351 if (nextChar == '>') |
374 if (nextChar == '>') |
352 { |
375 { |
353 level++; |
376 level++; |
354 if (level > KMaxXMLNesting) |
377 if (level > KMaxXMLNesting) |
355 { |
378 { |
356 error = true; |
379 error = true; |
357 TUSB_PRINT1 ("Config File Too Many levels %s",stringBuf.PtrZ()); |
380 TUSB_PRINT1 ("Config File Too Many levels %s",stringBuf.PtrZ()); |
|
381 OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP13, "Config File Too Many levels %s",stringBuf); |
358 } |
382 } |
359 else |
383 else |
360 { |
384 { |
361 levelKeys[level] = CheckXmlKey (keyString,level); |
385 levelKeys[level] = CheckXmlKey (keyString,level); |
362 if (levelKeys[level] < 0) |
386 if (levelKeys[level] < 0) |
363 { |
387 { |
364 error = true; |
388 error = true; |
365 TUSB_PRINT1 ("Invalid XML key %s",keyString.PtrZ()); |
389 TUSB_PRINT1 ("Invalid XML key %s",keyString.PtrZ()); |
|
390 OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP14, "Invalid XML key %s",keyString); |
366 } |
391 } |
367 else |
392 else |
368 { |
393 { |
369 if (CheckAttribute(iConsole,cpPtr,levelKeys[level],attributeString)) |
394 if (CheckAttribute(iConsole,cpPtr,levelKeys[level],attributeString)) |
370 { |
395 { |
371 state = EValue; |
396 state = EValue; |
372 TUSB_VERBOSE_PRINT3 ("Start key: %s level %d attribute %s",keyString.PtrZ(),level,attributeString.PtrZ()); |
397 TUSB_VERBOSE_PRINT3 ("Start key: %s level %d attribute %s",keyString.PtrZ(),level,attributeString.PtrZ()); |
|
398 if(gVerbose) |
|
399 { |
|
400 OstTraceExt3 (TRACE_VERBOSE, CONFIGPTRS_CONFIGPTRS_DUP15, "Start key: %S level %d attribute %S",keyString,level,attributeString); |
|
401 } |
373 } |
402 } |
374 else |
403 else |
375 { |
404 { |
376 error = true; |
405 error = true; |
377 TUSB_PRINT2 ("Incorrect attribute %s for XML key %s",attributeString.PtrZ(),keyString.PtrZ()); |
406 TUSB_PRINT2 ("Incorrect attribute %s for XML key %s",attributeString.PtrZ(),keyString.PtrZ()); |
|
407 OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP16, "Incorrect attribute %s for XML key %s",attributeString,keyString); |
378 } |
408 } |
379 } |
409 } |
380 } |
410 } |
381 } |
411 } |
382 else |
412 else |
383 { |
413 { |
384 attributeString.Append(nextChar); |
414 attributeString.Append(nextChar); |
385 } |
415 } |
386 break; |
416 break; |
387 |
417 |
388 case EValue: |
418 case EValue: |
389 if (nextChar == '<') |
419 if (nextChar == '<') |
390 { |
420 { |
391 state = EStartKey; |
421 state = EStartKey; |
392 } |
422 } |
393 else |
423 else |
394 { |
424 { |
395 // Don't add any leading spaces |
425 // Don't add any leading spaces |
396 if (!nextChar.IsSpace() || valueString.Length() != 0) |
426 if (!nextChar.IsSpace() || valueString.Length() != 0) |
397 { |
427 { |
398 valueString.Append(nextChar); |
428 valueString.Append(nextChar); |
399 } |
429 } |
400 } |
430 } |
401 break; |
431 break; |
402 } |
432 } |
403 } |
433 } |
404 } |
434 } |
405 } |
435 } |
406 } |
436 } |
407 |
437 |
408 delete cpPtr; |
438 delete cpPtr; |
409 |
439 |
410 return !error; |
440 return !error; |
411 } |
441 } |
412 |
442 |
413 |
443 |
414 |
444 |
415 TBool CheckAttribute (CConsoleBase* iConsole, ConfigPtrsPtr cpPtr,TInt aKeyIndex, TPtrC aDes) |
445 TBool CheckAttribute (CConsoleBase* iConsole, ConfigPtrsPtr cpPtr,TInt aKeyIndex, TPtrC aDes) |
416 { |
446 { |
417 TBool retValue = ETrue; |
447 TBool retValue = ETrue; |
418 TBuf<50> attrib = aDes; |
448 TBuf<50> attrib = aDes; |
419 TInt typePos; |
449 TInt typePos; |
434 { |
464 { |
435 attrib.Delete(0,((TDesC&)KAttributeName).Length()); |
465 attrib.Delete(0,((TDesC&)KAttributeName).Length()); |
436 if (attrib[0] == ((TDesC&)KQuote)[0] && attrib[attrib.Length()-1] == ((TDesC&)KQuote)[0]) |
466 if (attrib[0] == ((TDesC&)KQuote)[0] && attrib[attrib.Length()-1] == ((TDesC&)KQuote)[0]) |
437 { |
467 { |
438 TUSB_VERBOSE_PRINT1 ("LDD with attribute name %s",attrib.PtrZ()); |
468 TUSB_VERBOSE_PRINT1 ("LDD with attribute name %s",attrib.PtrZ()); |
439 cpPtr->iThisLDDPtr = new LDDConfig (attrib.MidTPtr(1,attrib.Length()-2)); |
469 if(gVerbose) |
|
470 { |
|
471 OstTraceExt1 (TRACE_VERBOSE, CONFIGPTRS_CONFIGPTRS_DUP17, "LDD with attribute name %s",attrib); |
|
472 } |
|
473 cpPtr->iThisLDDPtr = new LDDConfig (attrib.MidTPtr(1,attrib.Length()-2)); |
440 *cpPtr->iNextLDDPtrPtr = cpPtr->iThisLDDPtr; |
474 *cpPtr->iNextLDDPtrPtr = cpPtr->iThisLDDPtr; |
441 cpPtr->iNextLDDPtrPtr = &(cpPtr->iThisLDDPtr->iPtrNext); |
475 cpPtr->iNextLDDPtrPtr = &(cpPtr->iThisLDDPtr->iPtrNext); |
442 cpPtr->iNextIFPtrPtr = &(cpPtr->iThisLDDPtr->iIFPtr); |
476 cpPtr->iNextIFPtrPtr = &(cpPtr->iThisLDDPtr->iIFPtr); |
443 } |
477 } |
444 else |
478 else |
445 retValue = EFalse; |
479 retValue = EFalse; |
446 } |
480 } |
447 else |
481 else |
448 { |
482 { |
449 retValue = EFalse; |
483 retValue = EFalse; |
450 } |
484 } |
451 break; |
485 break; |
452 |
486 |
453 // level 1 index INTERFACE |
487 // level 1 index INTERFACE |
454 case ExiInterface : |
488 case ExiInterface : |
455 if (attrib.Find(KAttributeNumber) == 0) |
489 if (attrib.Find(KAttributeNumber) == 0) |
456 { |
490 { |
457 attrib.Delete(0,((TDesC&)KAttributeNumber).Length()); |
491 attrib.Delete(0,((TDesC&)KAttributeNumber).Length()); |
460 if (TDesToTUint(attrib.MidTPtr(1,attrib.Length()-2), &ifNumber)) |
494 if (TDesToTUint(attrib.MidTPtr(1,attrib.Length()-2), &ifNumber)) |
461 { |
495 { |
462 if (cpPtr->iThisLDDPtr == NULL) |
496 if (cpPtr->iThisLDDPtr == NULL) |
463 { |
497 { |
464 TUSB_PRINT ("No LDD container for interface"); |
498 TUSB_PRINT ("No LDD container for interface"); |
465 retValue = EFalse; |
499 OstTrace0 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP18, "No LDD container for interface"); |
|
500 retValue = EFalse; |
466 } |
501 } |
467 } |
502 } |
468 else |
503 else |
469 { |
504 { |
470 TUSB_PRINT2 ("Number conversion error %s %d",attrib.PtrZ(),ifNumber); |
505 TUSB_PRINT2 ("Number conversion error %s %d",attrib.PtrZ(),ifNumber); |
|
506 OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP19, "Number conversion error %S %u",attrib,ifNumber); |
471 retValue = EFalse; |
507 retValue = EFalse; |
472 } |
508 } |
473 } |
509 } |
474 else |
510 else |
475 { |
511 { |
476 TUSB_PRINT1 ("Attribute number not in \"\" %s",attrib.PtrZ()); |
512 TUSB_PRINT1 ("Attribute number not in \"\" %s",attrib.PtrZ()); |
477 retValue = EFalse; |
513 OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP20, "Attribute number not in \"\" %s",attrib); |
|
514 retValue = EFalse; |
478 } |
515 } |
479 } |
516 } |
480 if (retValue) |
517 if (retValue) |
481 { |
518 { |
482 TUSB_VERBOSE_PRINT1 ("Interface number %d",ifNumber); |
519 TUSB_VERBOSE_PRINT1 ("Interface number %d",ifNumber); |
|
520 if(gVerbose) |
|
521 { |
|
522 OstTrace1 (TRACE_VERBOSE, CONFIGPTRS_CONFIGPTRS_DUP21, "Interface number %d",ifNumber); |
|
523 } |
483 cpPtr->iThisIFPtr = new IFConfig ((TUint8)ifNumber); |
524 cpPtr->iThisIFPtr = new IFConfig ((TUint8)ifNumber); |
484 * cpPtr->iNextIFPtrPtr = cpPtr->iThisIFPtr; |
525 * cpPtr->iNextIFPtrPtr = cpPtr->iThisIFPtr; |
485 cpPtr->iNextIFPtrPtr = &cpPtr->iThisIFPtr->iPtrNext; |
526 cpPtr->iNextIFPtrPtr = &cpPtr->iThisIFPtr->iPtrNext; |
486 cpPtr->iThisLDDPtr->iNumChannels++; |
527 cpPtr->iThisLDDPtr->iNumChannels++; |
487 } |
528 } |
488 break; |
529 break; |
489 |
530 |
490 |
531 |
491 // level 1 index Setting |
532 // level 1 index Setting |
492 case ExiSetting : |
533 case ExiSetting : |
493 if (aDes.Length() != 0) |
534 if (aDes.Length() != 0) |
494 { |
535 { |
497 else |
538 else |
498 { |
539 { |
499 if (cpPtr->iThisLDDPtr == NULL) |
540 if (cpPtr->iThisLDDPtr == NULL) |
500 { |
541 { |
501 TUSB_PRINT ("No LDD container for interface"); |
542 TUSB_PRINT ("No LDD container for interface"); |
502 retValue = EFalse; |
543 OstTrace0 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP22, "No LDD container for interface"); |
|
544 retValue = EFalse; |
503 } |
545 } |
504 else |
546 else |
505 { |
547 { |
506 TUSB_VERBOSE_PRINT ("Alternate Interface Setting"); |
548 TUSB_VERBOSE_PRINT ("Alternate Interface Setting"); |
507 cpPtr->iThisIFPtr = new IFConfig (0); |
549 if(gVerbose) |
|
550 { |
|
551 OstTrace0 (TRACE_VERBOSE, CONFIGPTRS_CONFIGPTRS_DUP23, "Alternate Interface Setting"); |
|
552 } |
|
553 cpPtr->iThisIFPtr = new IFConfig (0); |
508 * cpPtr->iNextIFPtrPtr = cpPtr->iThisIFPtr; |
554 * cpPtr->iNextIFPtrPtr = cpPtr->iThisIFPtr; |
509 cpPtr->iNextIFPtrPtr = &cpPtr->iThisIFPtr->iPtrNext; |
555 cpPtr->iNextIFPtrPtr = &cpPtr->iThisIFPtr->iPtrNext; |
510 cpPtr->iThisIFPtr->iAlternateSetting = ETrue; |
556 cpPtr->iThisIFPtr->iAlternateSetting = ETrue; |
511 } |
557 } |
512 } |
558 } |
513 break; |
559 break; |
514 |
560 |
515 // level 2 index ENDPOINT |
561 // level 2 index ENDPOINT |
516 case ExiEndpoint : |
562 case ExiEndpoint : |
517 typePos = attrib.Find(KAttributeType); |
563 typePos = attrib.Find(KAttributeType); |
518 dirPos = attrib.Find(KAttributeDirection); |
564 dirPos = attrib.Find(KAttributeDirection); |
519 |
565 |
520 if (typePos == KErrNotFound || dirPos == KErrNotFound) |
566 if (typePos == KErrNotFound || dirPos == KErrNotFound) |
521 { |
567 { |
522 retValue = EFalse; |
568 retValue = EFalse; |
523 } |
569 } |
524 else |
570 else |
525 { |
571 { |
526 if (typePos < dirPos) |
572 if (typePos < dirPos) |
527 { |
573 { |
528 typePos += ((TDesC&)KAttributeType).Length(); |
574 typePos += ((TDesC&)KAttributeType).Length(); |
529 typeLen = dirPos - typePos; |
575 typeLen = dirPos - typePos; |
530 dirPos += ((TDesC&)KAttributeDirection).Length(); |
576 dirPos += ((TDesC&)KAttributeDirection).Length(); |
531 dirLen = attrib.Length() - dirPos; |
577 dirLen = attrib.Length() - dirPos; |
532 } |
578 } |
533 else |
579 else |
534 { |
580 { |
535 dirPos += ((TDesC&)KAttributeDirection).Length(); |
581 dirPos += ((TDesC&)KAttributeDirection).Length(); |
536 dirLen = typePos - dirPos; |
582 dirLen = typePos - dirPos; |
537 typePos += ((TDesC&)KAttributeType).Length(); |
583 typePos += ((TDesC&)KAttributeType).Length(); |
538 typeLen = attrib.Length() - typePos; |
584 typeLen = attrib.Length() - typePos; |
539 } |
585 } |
540 TPtr attribPtr = attrib.MidTPtr(typePos,typeLen); |
586 TPtr attribPtr = attrib.MidTPtr(typePos,typeLen); |
541 attribPtr.UpperCase(); |
587 attribPtr.UpperCase(); |
542 attribPtr.TrimAll(); |
588 attribPtr.TrimAll(); |
543 if (attribPtr == KEpBulk) |
589 if (attribPtr == KEpBulk) |
583 if (retValue) |
629 if (retValue) |
584 { |
630 { |
585 if (cpPtr->iThisIFPtr == NULL) |
631 if (cpPtr->iThisIFPtr == NULL) |
586 { |
632 { |
587 TUSB_PRINT ("No Interface container for Endpoint"); |
633 TUSB_PRINT ("No Interface container for Endpoint"); |
588 retValue = EFalse; |
634 OstTrace0 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP24, "No Interface container for Endpoint"); |
|
635 retValue = EFalse; |
589 } |
636 } |
590 else |
637 else |
591 { |
638 { |
592 TUint epIndex = cpPtr->iThisIFPtr->iInfoPtr->iTotalEndpointsUsed; |
639 TUint epIndex = cpPtr->iThisIFPtr->iInfoPtr->iTotalEndpointsUsed; |
593 TUSB_VERBOSE_PRINT2 ("Endpoint with type %d %d",epType,epDir); |
640 TUSB_VERBOSE_PRINT2 ("Endpoint with type %d %d",epType,epDir); |
|
641 if(gVerbose) |
|
642 { |
|
643 OstTraceExt2 (TRACE_VERBOSE, CONFIGPTRS_CONFIGPTRS_DUP25, "Endpoint with type %u %u",(TUint32)epType,(TUint32)epDir); |
|
644 } |
594 cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iType = epType; |
645 cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iType = epType; |
595 cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iDir = epDir; |
646 cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iDir = epDir; |
596 #ifdef USB_SC |
647 #ifdef USB_SC |
597 cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iBufferSize = 65536; |
648 cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iBufferSize = 65536; |
598 cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iReadSize = 4096; |
649 cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iReadSize = 4096; |
602 cpPtr->iThisIFPtr->iInfoPtr->iTotalEndpointsUsed++; |
653 cpPtr->iThisIFPtr->iInfoPtr->iTotalEndpointsUsed++; |
603 } |
654 } |
604 } |
655 } |
605 } |
656 } |
606 break; |
657 break; |
607 |
658 |
608 default : |
659 default : |
609 if (aDes.Length() != 0) |
660 if (aDes.Length() != 0) |
610 { |
661 { |
611 retValue = EFalse; |
662 retValue = EFalse; |
612 } |
663 } |
613 } |
664 } |
614 |
665 |
615 return retValue; |
666 return retValue; |
616 } |
667 } |
617 |
668 |
618 TBool CheckValue (CConsoleBase* iConsole, ConfigPtrsPtr cpPtr, TInt aKeyIndex, TPtrC16 aDes) |
669 TBool CheckValue (CConsoleBase* iConsole, ConfigPtrsPtr cpPtr, TInt aKeyIndex, TPtrC16 aDes) |
619 { |
670 { |
620 TBool retValue = ETrue; |
671 TBool retValue = ETrue; |
621 TBool boolValue; |
672 TBool boolValue; |
622 TUint uintValue; |
673 TUint uintValue; |
623 TInt epIndex = -1; |
674 TInt epIndex = -1; |
624 |
675 |
625 if (cpPtr->iThisIFPtr != NULL) |
676 if (cpPtr->iThisIFPtr != NULL) |
626 { |
677 { |
627 epIndex = cpPtr->iThisIFPtr->iInfoPtr->iTotalEndpointsUsed -1; |
678 epIndex = cpPtr->iThisIFPtr->iInfoPtr->iTotalEndpointsUsed -1; |
628 } |
679 } |
629 |
680 |
630 TUSB_VERBOSE_PRINT2 ("CheckValue keyIndex %d %s",aKeyIndex,aDes.Ptr()); |
681 TUSB_VERBOSE_PRINT2 ("CheckValue keyIndex %d %s",aKeyIndex,aDes.Ptr()); |
|
682 if(gVerbose) |
|
683 { |
|
684 OstTraceExt2 (TRACE_VERBOSE, CONFIGPTRS_CONFIGPTRS_DUP26, "CheckValue keyIndex %d %s",aKeyIndex,aDes); |
|
685 } |
631 switch (aKeyIndex) |
686 switch (aKeyIndex) |
632 { |
687 { |
633 case ExiLdd: // xmlKeys index for LDD |
688 case ExiLdd: // xmlKeys index for LDD |
634 case ExiInterface: // xmlKeys index for Interface |
689 case ExiInterface: // xmlKeys index for Interface |
635 case ExiEndpoint: // xmlKeys index for Endpoint |
690 case ExiEndpoint: // xmlKeys index for Endpoint |
636 if (aDes.Length() != 0) |
691 if (aDes.Length() != 0) |
637 { |
692 { |
638 retValue = EFalse; |
693 retValue = EFalse; |
639 } |
694 } |
640 break; |
695 break; |
641 |
696 |
642 case ExiEndpoints: |
697 case ExiEndpoints: |
643 retValue = TDesToTUint (aDes, &uintValue); |
698 retValue = TDesToTUint (aDes, &uintValue); |
644 if (uintValue == 0 || uintValue > 128) |
699 if (uintValue == 0 || uintValue > 128) |
645 { |
700 { |
646 retValue = EFalse; |
701 retValue = EFalse; |
647 } |
702 } |
648 else |
703 else |
649 { |
704 { |
650 cpPtr->iThisLDDPtr->iNumEndpoints = uintValue; |
705 cpPtr->iThisLDDPtr->iNumEndpoints = uintValue; |
651 } |
706 } |
652 break; |
707 break; |
653 |
708 |
654 case ExiSoftconnect: |
709 case ExiSoftconnect: |
655 retValue = TDesToBool (aDes, &boolValue); |
710 retValue = TDesToBool (aDes, &boolValue); |
656 if (cpPtr->iThisLDDPtr == NULL) |
711 if (cpPtr->iThisLDDPtr == NULL) |
657 retValue = EFalse; |
712 retValue = EFalse; |
658 if (retValue) |
713 if (retValue) |
659 { |
714 { |
660 cpPtr->iThisLDDPtr->iSoftConnect = boolValue; |
715 cpPtr->iThisLDDPtr->iSoftConnect = boolValue; |
661 } |
716 } |
662 break; |
717 break; |
663 |
718 |
664 case ExiSelfPower: |
719 case ExiSelfPower: |
665 retValue = TDesToBool (aDes, &boolValue); |
720 retValue = TDesToBool (aDes, &boolValue); |
666 if (cpPtr->iThisLDDPtr == NULL) |
721 if (cpPtr->iThisLDDPtr == NULL) |
667 retValue = EFalse; |
722 retValue = EFalse; |
668 if (retValue) |
723 if (retValue) |
669 { |
724 { |
670 cpPtr->iThisLDDPtr->iSelfPower = boolValue; |
725 cpPtr->iThisLDDPtr->iSelfPower = boolValue; |
671 } |
726 } |
672 break; |
727 break; |
673 |
728 |
674 case ExiRemoteWakeup: |
729 case ExiRemoteWakeup: |
675 retValue = TDesToBool (aDes, &boolValue); |
730 retValue = TDesToBool (aDes, &boolValue); |
676 if (cpPtr->iThisLDDPtr == NULL) |
731 if (cpPtr->iThisLDDPtr == NULL) |
677 retValue = EFalse; |
732 retValue = EFalse; |
678 if (retValue) |
733 if (retValue) |
679 { |
734 { |
680 cpPtr->iThisLDDPtr->iRemoteWakeup = boolValue; |
735 cpPtr->iThisLDDPtr->iRemoteWakeup = boolValue; |
681 } |
736 } |
682 break; |
737 break; |
683 |
738 |
684 case ExiHighSpeed: |
739 case ExiHighSpeed: |
685 retValue = TDesToBool (aDes, &boolValue); |
740 retValue = TDesToBool (aDes, &boolValue); |
686 if (cpPtr->iThisLDDPtr == NULL) |
741 if (cpPtr->iThisLDDPtr == NULL) |
687 retValue = EFalse; |
742 retValue = EFalse; |
688 if (retValue) |
743 if (retValue) |
689 { |
744 { |
690 cpPtr->iThisLDDPtr->iHighSpeed = boolValue; |
745 cpPtr->iThisLDDPtr->iHighSpeed = boolValue; |
691 } |
746 } |
692 break; |
747 break; |
693 |
748 |
694 case ExiFeatures: |
749 case ExiFeatures: |
695 retValue = TDesToTUint (aDes, &uintValue); |
750 retValue = TDesToTUint (aDes, &uintValue); |
696 if (cpPtr->iThisLDDPtr == NULL) |
751 if (cpPtr->iThisLDDPtr == NULL) |
697 retValue = EFalse; |
752 retValue = EFalse; |
698 if (retValue) |
753 if (retValue) |
699 { |
754 { |
700 cpPtr->iThisLDDPtr->iFeatures = uintValue; |
755 cpPtr->iThisLDDPtr->iFeatures = uintValue; |
701 } |
756 } |
702 break; |
757 break; |
703 |
758 |
704 case ExiMaxPower: |
759 case ExiMaxPower: |
705 retValue = TDesToTUint (aDes, &uintValue); |
760 retValue = TDesToTUint (aDes, &uintValue); |
706 if (cpPtr->iThisLDDPtr == NULL || uintValue > 50) |
761 if (cpPtr->iThisLDDPtr == NULL || uintValue > 50) |
707 retValue = EFalse; |
762 retValue = EFalse; |
708 if (retValue) |
763 if (retValue) |
709 { |
764 { |
710 cpPtr->iThisLDDPtr->iMaxPower = uintValue; |
765 cpPtr->iThisLDDPtr->iMaxPower = uintValue; |
711 } |
766 } |
712 break; |
767 break; |
713 |
768 |
714 case ExiEpStall: |
769 case ExiEpStall: |
715 retValue = TDesToBool (aDes, &boolValue); |
770 retValue = TDesToBool (aDes, &boolValue); |
716 if (cpPtr->iThisLDDPtr == NULL) |
771 if (cpPtr->iThisLDDPtr == NULL) |
717 retValue = EFalse; |
772 retValue = EFalse; |
718 if (retValue) |
773 if (retValue) |
719 { |
774 { |
720 cpPtr->iThisLDDPtr->iEPStall = boolValue; |
775 cpPtr->iThisLDDPtr->iEPStall = boolValue; |
721 } |
776 } |
722 break; |
777 break; |
723 |
778 |
724 case ExiSpec: |
779 case ExiSpec: |
725 retValue = TDesToTUint (aDes, &uintValue); |
780 retValue = TDesToTUint (aDes, &uintValue); |
726 if (cpPtr->iThisLDDPtr == NULL) |
781 if (cpPtr->iThisLDDPtr == NULL) |
727 retValue = EFalse; |
782 retValue = EFalse; |
728 if (retValue) |
783 if (retValue) |
729 { |
784 { |
730 cpPtr->iThisLDDPtr->iSpec = uintValue; |
785 cpPtr->iThisLDDPtr->iSpec = uintValue; |
731 } |
786 } |
732 break; |
787 break; |
733 |
788 |
734 case ExiVID: |
789 case ExiVID: |
735 retValue = TDesToTUint (aDes, &uintValue); |
790 retValue = TDesToTUint (aDes, &uintValue); |
736 if (cpPtr->iThisLDDPtr == NULL) |
791 if (cpPtr->iThisLDDPtr == NULL) |
737 retValue = EFalse; |
792 retValue = EFalse; |
738 if (retValue) |
793 if (retValue) |
739 { |
794 { |
740 cpPtr->iThisLDDPtr->iVid = uintValue; |
795 cpPtr->iThisLDDPtr->iVid = uintValue; |
741 } |
796 } |
742 break; |
797 break; |
743 |
798 |
744 case ExiPID: |
799 case ExiPID: |
745 retValue = TDesToTUint (aDes, &uintValue); |
800 retValue = TDesToTUint (aDes, &uintValue); |
746 if (cpPtr->iThisLDDPtr == NULL) |
801 if (cpPtr->iThisLDDPtr == NULL) |
747 retValue = EFalse; |
802 retValue = EFalse; |
748 if (retValue) |
803 if (retValue) |
749 { |
804 { |
750 cpPtr->iThisLDDPtr->iPid = uintValue; |
805 cpPtr->iThisLDDPtr->iPid = uintValue; |
751 } |
806 } |
752 break; |
807 break; |
753 |
808 |
754 case ExiRelease: |
809 case ExiRelease: |
755 retValue = TDesToTUint (aDes, &uintValue); |
810 retValue = TDesToTUint (aDes, &uintValue); |
756 if (cpPtr->iThisLDDPtr == NULL) |
811 if (cpPtr->iThisLDDPtr == NULL) |
757 retValue = EFalse; |
812 retValue = EFalse; |
758 if (retValue) |
813 if (retValue) |
759 { |
814 { |
760 cpPtr->iThisLDDPtr->iRelease = uintValue; |
815 cpPtr->iThisLDDPtr->iRelease = uintValue; |
761 } |
816 } |
762 break; |
817 break; |
763 |
818 |
764 case ExiManufacturer: |
819 case ExiManufacturer: |
765 cpPtr->iThisLDDPtr->iManufacturer = aDes.Alloc(); |
820 cpPtr->iThisLDDPtr->iManufacturer = aDes.Alloc(); |
766 break; |
821 break; |
767 |
822 |
768 case ExiProduct: |
823 case ExiProduct: |
773 cpPtr->iThisLDDPtr->iSerialNumber = aDes.Alloc(); |
828 cpPtr->iThisLDDPtr->iSerialNumber = aDes.Alloc(); |
774 break; |
829 break; |
775 |
830 |
776 case ExiOTG: |
831 case ExiOTG: |
777 break; |
832 break; |
778 |
833 |
779 case ExiClass: |
834 case ExiClass: |
780 retValue = TDesToTUint (aDes, &uintValue); |
835 retValue = TDesToTUint (aDes, &uintValue); |
781 if (cpPtr->iThisIFPtr == NULL || uintValue > 0xFF) |
836 if (cpPtr->iThisIFPtr == NULL || uintValue > 0xFF) |
782 retValue = EFalse; |
837 retValue = EFalse; |
783 if (retValue) |
838 if (retValue) |
784 { |
839 { |
785 cpPtr->iThisIFPtr->iInfoPtr->iClass.iClassNum = uintValue; |
840 cpPtr->iThisIFPtr->iInfoPtr->iClass.iClassNum = uintValue; |
786 } |
841 } |
787 break; |
842 break; |
788 |
843 |
789 case ExiSubclass: |
844 case ExiSubclass: |
790 retValue = TDesToTUint (aDes, &uintValue); |
845 retValue = TDesToTUint (aDes, &uintValue); |
791 if (cpPtr->iThisIFPtr == NULL || uintValue > 0xFF) |
846 if (cpPtr->iThisIFPtr == NULL || uintValue > 0xFF) |
792 retValue = EFalse; |
847 retValue = EFalse; |
793 if (retValue) |
848 if (retValue) |
794 { |
849 { |
795 cpPtr->iThisIFPtr->iInfoPtr->iClass.iSubClassNum = uintValue; |
850 cpPtr->iThisIFPtr->iInfoPtr->iClass.iSubClassNum = uintValue; |
796 } |
851 } |
797 break; |
852 break; |
798 |
853 |
799 case ExiProtocol: |
854 case ExiProtocol: |
800 retValue = TDesToTUint (aDes, &uintValue); |
855 retValue = TDesToTUint (aDes, &uintValue); |
801 if (cpPtr->iThisIFPtr == NULL || uintValue > 0xFF) |
856 if (cpPtr->iThisIFPtr == NULL || uintValue > 0xFF) |
802 retValue = EFalse; |
857 retValue = EFalse; |
803 if (retValue) |
858 if (retValue) |
804 { |
859 { |
805 cpPtr->iThisIFPtr->iInfoPtr->iClass.iProtocolNum = uintValue; |
860 cpPtr->iThisIFPtr->iInfoPtr->iClass.iProtocolNum = uintValue; |
806 } |
861 } |
807 break; |
862 break; |
808 |
863 |
809 case ExiDescriptor: |
864 case ExiDescriptor: |
810 cpPtr->iThisIFPtr->iInfoPtr->iString = aDes.Alloc(); |
865 cpPtr->iThisIFPtr->iInfoPtr->iString = aDes.Alloc(); |
811 break; |
866 break; |
812 |
867 |
813 case ExiBandwidthIn: |
868 case ExiBandwidthIn: |
814 #ifdef USB_SC |
869 #ifdef USB_SC |
815 retValue = EFalse; |
870 retValue = EFalse; |
816 #else |
871 #else |
817 retValue = TDesToTUint (aDes, &uintValue); |
872 retValue = TDesToTUint (aDes, &uintValue); |
818 if (cpPtr->iThisIFPtr == NULL || uintValue > 3) |
873 if (cpPtr->iThisIFPtr == NULL || uintValue > 3) |
819 retValue = EFalse; |
874 retValue = EFalse; |
820 if (retValue) |
875 if (retValue) |
821 { |
876 { |
885 { |
940 { |
886 if (!(uintValue == 8 || uintValue == 16 || uintValue == 32 || uintValue == 64)) |
941 if (!(uintValue == 8 || uintValue == 16 || uintValue == 32 || uintValue == 64)) |
887 retValue = EFalse; |
942 retValue = EFalse; |
888 } |
943 } |
889 break; |
944 break; |
890 |
945 |
891 case KUsbEpTypeInterrupt : |
946 case KUsbEpTypeInterrupt : |
892 if ((defaultIF && uintValue > 64) || |
947 if ((defaultIF && uintValue > 64) || |
893 (!cpPtr->iThisLDDPtr->iHighSpeed && uintValue > 64) || |
948 (!cpPtr->iThisLDDPtr->iHighSpeed && uintValue > 64) || |
894 (!defaultIF && cpPtr->iThisLDDPtr->iHighSpeed && uintValue > 1024)) |
949 (!defaultIF && cpPtr->iThisLDDPtr->iHighSpeed && uintValue > 1024)) |
895 retValue = EFalse; |
950 retValue = EFalse; |
896 break; |
951 break; |
897 |
952 |
898 case KUsbEpTypeIsochronous : |
953 case KUsbEpTypeIsochronous : |
899 if ((defaultIF && uintValue > 0) || |
954 if ((defaultIF && uintValue > 0) || |
900 (!defaultIF && !cpPtr->iThisLDDPtr->iHighSpeed && uintValue > 1023) || |
955 (!defaultIF && !cpPtr->iThisLDDPtr->iHighSpeed && uintValue > 1023) || |
901 (!defaultIF && cpPtr->iThisLDDPtr->iHighSpeed && uintValue > 1024)) |
956 (!defaultIF && cpPtr->iThisLDDPtr->iHighSpeed && uintValue > 1024)) |
902 retValue = EFalse; |
957 retValue = EFalse; |
903 break; |
958 break; |
904 } |
959 } |
905 if (retValue) |
960 if (retValue) |
906 { |
961 { |
907 cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iSize = uintValue; |
962 cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iSize = uintValue; |
908 } |
963 } |
909 } |
964 } |
910 |
965 |
911 break; |
966 break; |
912 |
967 |
913 case ExiInterval: |
968 case ExiInterval: |
914 retValue = TDesToTUint (aDes, &uintValue); |
969 retValue = TDesToTUint (aDes, &uintValue); |
915 if (epIndex < 0) |
970 if (epIndex < 0) |
916 retValue = EFalse; |
971 retValue = EFalse; |
917 if (retValue) |
972 if (retValue) |