kerneltest/e32test/usb/t_usb_device/src/config.cpp
changeset 259 57b9594f5772
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
247:d8d70de2bd36 259:57b9594f5772
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 // e32test/usb/t_usbdev/src/config.cpp
    14 // e32test/usb/t_usbdev/src/config.cpp
    15 // USB Test Program T_USB_DEVICE.
    15 // USB Test Program T_USB_DEVICE.
    16 // Reading and converting the XML configuration file.
    16 // Reading and converting the XML configuration file.
    17 // 
       
    18 //
    17 //
       
    18 //
    19 
    19 
    20 #include "general.h"
    20 #include "general.h"
       
    21 #include "OstTraceDefinitions.h"
       
    22 #ifdef OST_TRACE_COMPILER_IN_USE
       
    23 #include "configTraces.h"
       
    24 #endif
    21 #include "config.h"
    25 #include "config.h"
    22 
    26 
    23 _LIT(KCfgLDD,"LDD");
    27 _LIT(KCfgLDD,"LDD");
    24 _LIT(KCfgLDD1,"ENDPOINTS");
    28 _LIT(KCfgLDD1,"ENDPOINTS");
    25 _LIT(KCfgLDD2,"SOFTCONNECT");
    29 _LIT(KCfgLDD2,"SOFTCONNECT");
    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,
    97 	ExiManufacturer,
   101 	ExiManufacturer,
    98 	ExiProduct,
   102 	ExiProduct,
    99 	ExiSerialNumber,
   103 	ExiSerialNumber,
   100 	ExiOTG,
   104 	ExiOTG,
   101 	ExiInterface,					// xmlKeys index for Interface
   105 	ExiInterface,					// xmlKeys index for Interface
   102 	ExiSetting,						
   106 	ExiSetting,
   103 	ExiClass,
   107 	ExiClass,
   104 	ExiSubclass,
   108 	ExiSubclass,
   105 	ExiProtocol,
   109 	ExiProtocol,
   106 	ExiDescriptor,
   110 	ExiDescriptor,
   107 	ExiBandwidthIn,
   111 	ExiBandwidthIn,
   116 	ExiExtra,
   120 	ExiExtra,
   117 	ExiBufferSize,
   121 	ExiBufferSize,
   118 	ExiReadSize,
   122 	ExiReadSize,
   119 	ExiLAST
   123 	ExiLAST
   120 	};
   124 	};
   121 	
   125 
   122 // This array provides the index into xmlKeys for each level of xml key
   126 // This array provides the index into xmlKeys for each level of xml key
   123 // the first index for level n being defined by xmlLevels[n]
   127 // the first index for level n being defined by xmlLevels[n]
   124 // and the last index for level n being defined by xmlLevels[n+1] - 1
   128 // and the last index for level n being defined by xmlLevels[n+1] - 1
   125 // this means this must have two more entries than the number of nesting levels
   129 // this means this must have two more entries than the number of nesting levels
   126 // and the last entry must be the size of xmlKeys 
   130 // and the last entry must be the size of xmlKeys
   127 static const TUint8 xmlLevels[] = 
   131 static const TUint8 xmlLevels[] =
   128 	{
   132 	{
   129 	ExiLdd,ExiLdd+1,ExiSetting+1,ExiEndpoint+1,ExiLAST
   133 	ExiLdd,ExiLdd+1,ExiSetting+1,ExiEndpoint+1,ExiLAST
   130 	};
   134 	};
   131 
   135 
   132 LDDConfig::LDDConfig (TPtrC aName)
   136 LDDConfig::LDDConfig (TPtrC aName)
   184 extern TInt gSoakCount;
   188 extern TInt gSoakCount;
   185 
   189 
   186 bool ProcessConfigFile (RFile aConfigFile,CConsoleBase* iConsole, LDDConfigPtr * LDDPtrPtr)
   190 bool ProcessConfigFile (RFile aConfigFile,CConsoleBase* iConsole, LDDConfigPtr * LDDPtrPtr)
   187 	{
   191 	{
   188 	TUSB_PRINT ("Processing Configuration File");
   192 	TUSB_PRINT ("Processing Configuration File");
   189 	
   193 	OstTrace0 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS, "Processing Configuration File");
       
   194 
   190 	TBuf8<100> configBuf;
   195 	TBuf8<100> configBuf;
   191 	TBuf<101> stringBuf;
   196 	TBuf<101> stringBuf;
   192 	bool done = false;
   197 	bool done = false;
   193 	bool error = false;
   198 	bool error = false;
   194 	TInt rStatus;
   199 	TInt rStatus;
   201 	TBuf<50> valueString;
   206 	TBuf<50> valueString;
   202 	TInt level = -1;
   207 	TInt level = -1;
   203 	TInt levelKeys[KMaxXMLNesting+1];
   208 	TInt levelKeys[KMaxXMLNesting+1];
   204 
   209 
   205 	* LDDPtrPtr = NULL;
   210 	* LDDPtrPtr = NULL;
   206 	ConfigPtrsPtr cpPtr = new ConfigPtrs (LDDPtrPtr); 			
   211 	ConfigPtrsPtr cpPtr = new ConfigPtrs (LDDPtrPtr);
   207 
   212 
   208 	while (!done && !error)
   213 	while (!done && !error)
   209 		{
   214 		{
   210 		rStatus = aConfigFile.Read((TDes8&)configBuf);
   215 		rStatus = aConfigFile.Read((TDes8&)configBuf);
   211 		if (rStatus != KErrNone)
   216 		if (rStatus != KErrNone)
   212 			{
   217 			{
   213 			error = true;
   218 			error = true;
   214 			TUSB_PRINT1("Config file error %d", rStatus);			
   219 			TUSB_PRINT1("Config file error %d", rStatus);
       
   220 			OstTrace1(TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP01, "Config file error %d", rStatus);
   215 			}
   221 			}
   216 		else
   222 		else
   217 			{
   223 			{
   218 			if (configBuf.Length() == 0)
   224 			if (configBuf.Length() == 0)
   219 				{
   225 				{
   220 				done = true;			
   226 				done = true;
   221 				}
   227 				}
   222 			else
   228 			else
   223 				{
   229 				{
   224 				stringBuf.Copy(configBuf);
   230 				stringBuf.Copy(configBuf);
   225 				for (TInt i = 0; i < stringBuf.Length() && !error; i++)
   231 				for (TInt i = 0; i < stringBuf.Length() && !error; i++)
   230 						((nextChar == '>') && ((state == EEmpty) || (state == EValue))) ||
   236 						((nextChar == '>') && ((state == EEmpty) || (state == EValue))) ||
   231 						((nextChar == '/') && (lastChar != '<')))
   237 						((nextChar == '/') && (lastChar != '<')))
   232 						{
   238 						{
   233 						error = true;
   239 						error = true;
   234 						TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ());
   240 						TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ());
       
   241 						OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP02, "Config File Syntax Error at index %d of %S",i,stringBuf);
   235 						}
   242 						}
   236 					switch (state)
   243 					switch (state)
   237 						{
   244 						{
   238 						case EEmpty:
   245 						case EEmpty:
   239 							if (nextChar == '<')
   246 							if (nextChar == '<')
   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
   295 										valueString.SetLength(0);
   310 										valueString.SetLength(0);
   296 										attributeString.SetLength(0);
   311 										attributeString.SetLength(0);
   297 										if (nextChar.IsSpace())
   312 										if (nextChar.IsSpace())
   298 											{
   313 											{
   299 											error = true;
   314 											error = true;
   300 											TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ());					
   315 											TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ());
       
   316 											OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP08, "Config File Syntax Error at index %d of %S",i,stringBuf);
   301 											}
   317 											}
   302 										}
   318 										}
   303 									if (nextChar.IsSpace())
   319 									if (nextChar.IsSpace())
   304 										{
   320 										{
   305 										state = EAttribute;
   321 										state = EAttribute;
   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)
   556 							{
   602 							{
   557 							epType = KUsbEpTypeIsochronous;
   603 							epType = KUsbEpTypeIsochronous;
   558 							}
   604 							}
   559 						else
   605 						else
   560 							{
   606 							{
   561 							retValue = EFalse;					
   607 							retValue = EFalse;
   562 							}
   608 							}
   563 						}
   609 						}
   564 					}
   610 					}
   565 				attribPtr = attrib.MidTPtr(dirPos,dirLen);
   611 				attribPtr = attrib.MidTPtr(dirPos,dirLen);
   566 				attribPtr.UpperCase();
   612 				attribPtr.UpperCase();
   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 				{
   835 					break;
   890 					break;
   836 					}
   891 					}
   837 				}
   892 				}
   838 			#endif
   893 			#endif
   839 			break;
   894 			break;
   840 			
   895 
   841 		case ExiBandwidthOut:
   896 		case ExiBandwidthOut:
   842 			#ifdef USB_SC
   897 			#ifdef USB_SC
   843 			retValue = EFalse;
   898 			retValue = EFalse;
   844 			#else			
   899 			#else
   845 			retValue = TDesToTUint (aDes, &uintValue);
   900 			retValue = TDesToTUint (aDes, &uintValue);
   846 			if (cpPtr->iThisIFPtr == NULL || uintValue > 3)
   901 			if (cpPtr->iThisIFPtr == NULL || uintValue > 3)
   847 				retValue = EFalse;
   902 				retValue = EFalse;
   848 			if (retValue)
   903 			if (retValue)
   849 				{
   904 				{
   863 					break;
   918 					break;
   864 					}
   919 					}
   865 				}
   920 				}
   866 			#endif
   921 			#endif
   867 			break;
   922 			break;
   868 			
   923 
   869 		case ExiSize:
   924 		case ExiSize:
   870 			retValue = TDesToTUint (aDes, &uintValue);
   925 			retValue = TDesToTUint (aDes, &uintValue);
   871 			if (epIndex < 0)
   926 			if (epIndex < 0)
   872 				retValue = EFalse;
   927 				retValue = EFalse;
   873 			if (retValue)
   928 			if (retValue)
   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)
   919 				switch (cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iType)
   974 				switch (cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iType)
   920 					{
   975 					{
   921 					case KUsbEpTypeBulk :
   976 					case KUsbEpTypeBulk :
   922 						retValue = EFalse;
   977 						retValue = EFalse;
   923 						break;
   978 						break;
   924 						
   979 
   925 					case KUsbEpTypeInterrupt :
   980 					case KUsbEpTypeInterrupt :
   926 						if (uintValue < 1 || uintValue > 255)
   981 						if (uintValue < 1 || uintValue > 255)
   927 							retValue = EFalse;
   982 							retValue = EFalse;
   928 						break;
   983 						break;
   929 						
   984 
   930 					case KUsbEpTypeIsochronous :
   985 					case KUsbEpTypeIsochronous :
   931 						if (uintValue < 1 || uintValue > 16)
   986 						if (uintValue < 1 || uintValue > 16)
   932 							retValue = EFalse;
   987 							retValue = EFalse;
   933 						break;					
   988 						break;
   934 					}
   989 					}
   935 				if (retValue)
   990 				if (retValue)
   936 					{
   991 					{
   937 					cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iInterval = uintValue;
   992 					cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iInterval = uintValue;
   938 					}
   993 					}
   939 				}
   994 				}
   940 			break;
   995 			break;
   941 			
   996 
   942 		case ExiHSInterval:
   997 		case ExiHSInterval:
   943 			retValue = TDesToTUint (aDes, &uintValue);
   998 			retValue = TDesToTUint (aDes, &uintValue);
   944 			if (epIndex < 0 || !cpPtr->iThisLDDPtr->iHighSpeed)
   999 			if (epIndex < 0 || !cpPtr->iThisLDDPtr->iHighSpeed)
   945 				retValue = EFalse;
  1000 				retValue = EFalse;
   946 			if (retValue)
  1001 			if (retValue)
   949 					{
  1004 					{
   950 					case KUsbEpTypeBulk :
  1005 					case KUsbEpTypeBulk :
   951 						if (uintValue > 255)
  1006 						if (uintValue > 255)
   952 							retValue = EFalse;
  1007 							retValue = EFalse;
   953 						break;
  1008 						break;
   954 						
  1009 
   955 					case KUsbEpTypeInterrupt :
  1010 					case KUsbEpTypeInterrupt :
   956 						if (uintValue < 1 || uintValue > 16)
  1011 						if (uintValue < 1 || uintValue > 16)
   957 							retValue = EFalse;
  1012 							retValue = EFalse;
   958 						break;
  1013 						break;
   959 						
  1014 
   960 					case KUsbEpTypeIsochronous :
  1015 					case KUsbEpTypeIsochronous :
   961 						if (uintValue < 1 || uintValue > 16)
  1016 						if (uintValue < 1 || uintValue > 16)
   962 							retValue = EFalse;
  1017 							retValue = EFalse;
   963 						break;					
  1018 						break;
   964 					}
  1019 					}
   965 				if (retValue)
  1020 				if (retValue)
   966 					{
  1021 					{
   967 					cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iInterval_Hs = uintValue;
  1022 					cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iInterval_Hs = uintValue;
   968 					}
  1023 					}
   969 				}
  1024 				}
   970 			break;
  1025 			break;
   971 			
  1026 
   972 		case ExiHSTransactions:
  1027 		case ExiHSTransactions:
   973 			retValue = TDesToTUint (aDes, &uintValue);
  1028 			retValue = TDesToTUint (aDes, &uintValue);
   974 			if (epIndex < 0 || !cpPtr->iThisLDDPtr->iHighSpeed)
  1029 			if (epIndex < 0 || !cpPtr->iThisLDDPtr->iHighSpeed)
   975 				retValue = EFalse;
  1030 				retValue = EFalse;
   976 			if (retValue)
  1031 			if (retValue)
   981 					{
  1036 					{
   982 					cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iTransactions = uintValue;
  1037 					cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iTransactions = uintValue;
   983 					}
  1038 					}
   984 				}
  1039 				}
   985 			break;
  1040 			break;
   986 			
  1041 
   987 		case ExiDMA:
  1042 		case ExiDMA:
   988 			retValue = TDesToBool (aDes, &boolValue);
  1043 			retValue = TDesToBool (aDes, &boolValue);
   989 			if (epIndex < 0)
  1044 			if (epIndex < 0)
   990 				retValue = EFalse;
  1045 				retValue = EFalse;
   991 			if (retValue)
  1046 			if (retValue)
   992 				{
  1047 				{
   993 				cpPtr->iThisIFPtr->iEpDMA[epIndex] = boolValue;
  1048 				cpPtr->iThisIFPtr->iEpDMA[epIndex] = boolValue;
   994 				}
  1049 				}
   995 			break;
  1050 			break;
   996 			
  1051 
   997 		case ExiDoubleBuff:
  1052 		case ExiDoubleBuff:
   998 			#ifdef USB_SC
  1053 			#ifdef USB_SC
   999 			retValue = EFalse;
  1054 			retValue = EFalse;
  1000 			#else
  1055 			#else
  1001 			retValue = TDesToBool (aDes, &boolValue);
  1056 			retValue = TDesToBool (aDes, &boolValue);
  1005 				{
  1060 				{
  1006 				cpPtr->iThisIFPtr->iEpDoubleBuff[epIndex] = boolValue;
  1061 				cpPtr->iThisIFPtr->iEpDoubleBuff[epIndex] = boolValue;
  1007 				}
  1062 				}
  1008 			#endif
  1063 			#endif
  1009 			break;
  1064 			break;
  1010 			
  1065 
  1011 		case ExiExtra:
  1066 		case ExiExtra:
  1012 			retValue = TDesToTUint (aDes, &uintValue);
  1067 			retValue = TDesToTUint (aDes, &uintValue);
  1013 			if (epIndex < 0)
  1068 			if (epIndex < 0)
  1014 				retValue = EFalse;
  1069 				retValue = EFalse;
  1015 			if (retValue)
  1070 			if (retValue)
  1025 				retValue = EFalse;
  1080 				retValue = EFalse;
  1026 			if (retValue)
  1081 			if (retValue)
  1027 				{
  1082 				{
  1028 				cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iBufferSize = uintValue;
  1083 				cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iBufferSize = uintValue;
  1029 				}
  1084 				}
  1030 			#else			
  1085 			#else
  1031 			retValue = EFalse;
  1086 			retValue = EFalse;
  1032 			#endif
  1087 			#endif
  1033 			break;
  1088 			break;
  1034 
  1089 
  1035 		case ExiReadSize:
  1090 		case ExiReadSize:
  1039 				retValue = EFalse;
  1094 				retValue = EFalse;
  1040 			if (retValue)
  1095 			if (retValue)
  1041 				{
  1096 				{
  1042 				cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iReadSize = uintValue;
  1097 				cpPtr->iThisIFPtr->iInfoPtr->iEndpointData[epIndex].iReadSize = uintValue;
  1043 				}
  1098 				}
  1044 			#else			
  1099 			#else
  1045 			retValue = EFalse;
  1100 			retValue = EFalse;
  1046 			#endif
  1101 			#endif
  1047 			break;
  1102 			break;
  1048 		}
  1103 		}
  1049 
  1104 
  1050 	return retValue;
  1105 	return retValue;
  1051 	}
  1106 	}
  1052 	
  1107 
  1053 TInt CheckXmlKey (TPtrC aKey,TInt aLevel)
  1108 TInt CheckXmlKey (TPtrC aKey,TInt aLevel)
  1054 	{
  1109 	{
  1055 	TInt keyIndex = -1;
  1110 	TInt keyIndex = -1;
  1056 	
  1111 
  1057 	for (TInt i = xmlLevels[aLevel]; i < xmlLevels[aLevel+1]; i++)
  1112 	for (TInt i = xmlLevels[aLevel]; i < xmlLevels[aLevel+1]; i++)
  1058 		{
  1113 		{
  1059 		if (aKey == xmlKeys[i])
  1114 		if (aKey == xmlKeys[i])
  1060 			{
  1115 			{
  1061 			keyIndex = i;
  1116 			keyIndex = i;
  1062 			break;
  1117 			break;
  1063 			}
  1118 			}
  1064 		}
  1119 		}
  1065 
  1120 
  1066 			
  1121 
  1067 	return keyIndex;
  1122 	return keyIndex;
  1068 	}
  1123 	}
  1069 
  1124 
  1070 TBool TDesToTUint (TPtrC aDes, TUint * aValue)
  1125 TBool TDesToTUint (TPtrC aDes, TUint * aValue)
  1071 	{
  1126 	{
  1073 	TBuf<50> numDes = aDes;
  1128 	TBuf<50> numDes = aDes;
  1074 	TBool hexBase = EFalse;
  1129 	TBool hexBase = EFalse;
  1075 	TBool conversionOK = ETrue;
  1130 	TBool conversionOK = ETrue;
  1076 	TUint8 desIndex = 0;
  1131 	TUint8 desIndex = 0;
  1077 	* aValue = 0;
  1132 	* aValue = 0;
  1078 	
  1133 
  1079 	if (numDes.LeftTPtr(((TDesC&)KHexPrefix).Length()) == KHexPrefix)
  1134 	if (numDes.LeftTPtr(((TDesC&)KHexPrefix).Length()) == KHexPrefix)
  1080 		{
  1135 		{
  1081 		hexBase = ETrue;
  1136 		hexBase = ETrue;
  1082 		desIndex = ((TDesC&)KHexPrefix).Length();	
  1137 		desIndex = ((TDesC&)KHexPrefix).Length();
  1083 		}
  1138 		}
  1084 		
  1139 
  1085 	while (desIndex < numDes.Length() && conversionOK)
  1140 	while (desIndex < numDes.Length() && conversionOK)
  1086 		{
  1141 		{
  1087 		if (hexBase)
  1142 		if (hexBase)
  1088 			{
  1143 			{
  1089 			TUint maxValue = 0xFFFFFFFF >> 4;
  1144 			TUint maxValue = 0xFFFFFFFF >> 4;
  1110 					* aValue += digit;
  1165 					* aValue += digit;
  1111 					}
  1166 					}
  1112 				else
  1167 				else
  1113 					{
  1168 					{
  1114 					conversionOK = EFalse;
  1169 					conversionOK = EFalse;
  1115 					* aValue = 222;				
  1170 					* aValue = 222;
  1116 					}	
  1171 					}
  1117 				}
  1172 				}
  1118 			else
  1173 			else
  1119 				{
  1174 				{
  1120 				conversionOK = EFalse;	
  1175 				conversionOK = EFalse;
  1121 				* aValue = 333;
  1176 				* aValue = 333;
  1122 				}
  1177 				}
  1123 			
  1178 
  1124 			}
  1179 			}
  1125 		desIndex++;
  1180 		desIndex++;
  1126 		}
  1181 		}
  1127 		
  1182 
  1128 	return conversionOK;
  1183 	return conversionOK;
  1129 	}
  1184 	}
  1130 
  1185 
  1131 TBool TDesToBool (TPtrC aDes, TBool * aValue)
  1186 TBool TDesToBool (TPtrC aDes, TBool * aValue)
  1132 	{
  1187 	{
  1133 	_LIT (KBoolY,"Y");
  1188 	_LIT (KBoolY,"Y");
  1134 	_LIT (KBoolN,"N");
  1189 	_LIT (KBoolN,"N");
  1135 	TBool conversionOK = ETrue;
  1190 	TBool conversionOK = ETrue;
  1136 	TBuf<50> boolDes = aDes;
  1191 	TBuf<50> boolDes = aDes;
  1137 	
  1192 
  1138 	boolDes.TrimAll();
  1193 	boolDes.TrimAll();
  1139 	boolDes.UpperCase();
  1194 	boolDes.UpperCase();
  1140 	if (boolDes == KBoolY)
  1195 	if (boolDes == KBoolY)
  1141 		{
  1196 		{
  1142 		* aValue = ETrue;
  1197 		* aValue = ETrue;
  1147 			{
  1202 			{
  1148 			* aValue = EFalse;
  1203 			* aValue = EFalse;
  1149 			}
  1204 			}
  1150 		else
  1205 		else
  1151 			{
  1206 			{
  1152 			conversionOK = EFalse;	
  1207 			conversionOK = EFalse;
  1153 			}
  1208 			}
  1154 		}
  1209 		}
  1155 		
  1210 
  1156 	return conversionOK;
  1211 	return conversionOK;
  1157 	}
  1212 	}