1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/usb/t_usb_device/src/apitests.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1005 @@
1.4 +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32test/usb/t_usb_device/src/apitests.cpp
1.18 +// USB Test Program T_USB_DEVICE, functional part.
1.19 +// Device-side part, to work against T_USB_HOST running on the host.
1.20 +//
1.21 +//
1.22 +
1.23 +#include "general.h" // CActiveControl, CActiveRW
1.24 +#include "config.h"
1.25 +#include "usblib.h" // Helpers
1.26 +
1.27 +extern RTest test;
1.28 +extern TBool gVerbose;
1.29 +extern TBool gSkip;
1.30 +extern TBool gTempTest;
1.31 +
1.32 +_LIT16(KString_one, "Arbitrary String Descriptor Test String 1");
1.33 +_LIT16(KString_two, "Another Arbitrary String Descriptor Test String");
1.34 +
1.35 +void SetupDescriptors(LDDConfigPtr aLddPtr,RDEVCLIENT* aPort, TUint16 aPid = 0)
1.36 + {
1.37 + // === Device Descriptor
1.38 + test.Start(_L("Set up descriptors"));
1.39 +
1.40 + test.Next(_L("GetDeviceDescriptorSize"));
1.41 + TInt deviceDescriptorSize = 0;
1.42 + aPort->GetDeviceDescriptorSize(deviceDescriptorSize);
1.43 + test_Equal(KUsbDescSize_Device,static_cast<TUint>(deviceDescriptorSize));
1.44 +
1.45 + test.Next(_L("GetDeviceDescriptor"));
1.46 + TBuf8<KUsbDescSize_Device> deviceDescriptor;
1.47 + TInt r = aPort->GetDeviceDescriptor(deviceDescriptor);
1.48 + test_KErrNone(r);
1.49 +
1.50 + test.Next(_L("SetDeviceDescriptor"));
1.51 + const TInt KUsbSpecOffset = 2;
1.52 + const TInt KUsbDevClass = 4;
1.53 + const TInt KUsbDevSubClass = 5;
1.54 + const TInt KUsbDevProtocol = 6;
1.55 + const TInt KUsbVendorIdOffset = 8;
1.56 + const TInt KUsbProductIdOffset = 10;
1.57 + const TInt KUsbDevReleaseOffset = 12;
1.58 + // Change the USB spec number
1.59 + deviceDescriptor[KUsbSpecOffset] = LoByte(aLddPtr->iSpec);
1.60 + deviceDescriptor[KUsbSpecOffset+1] = HiByte(aLddPtr->iSpec);
1.61 + // Change the Device Class, SubClass and Protocol to zero so that they are not device specific
1.62 + // and diferent clases can used on different interfaces
1.63 + deviceDescriptor[KUsbDevClass] = 0;
1.64 + deviceDescriptor[KUsbDevSubClass] = 0;
1.65 + deviceDescriptor[KUsbDevProtocol] = 0;
1.66 + // Change the device vendor ID (VID)
1.67 + deviceDescriptor[KUsbVendorIdOffset] = LoByte(aLddPtr->iVid); // little endian!
1.68 + deviceDescriptor[KUsbVendorIdOffset+1] = HiByte(aLddPtr->iVid);
1.69 + // Change the device product ID (PID)
1.70 + if (aPid != 0)
1.71 + {
1.72 + deviceDescriptor[KUsbProductIdOffset] = LoByte(aPid); // little endian!
1.73 + deviceDescriptor[KUsbProductIdOffset+1] = HiByte(aPid);
1.74 + }
1.75 + else
1.76 + {
1.77 + deviceDescriptor[KUsbProductIdOffset] = LoByte(aLddPtr->iPid); // little endian!
1.78 + deviceDescriptor[KUsbProductIdOffset+1] = HiByte(aLddPtr->iPid);
1.79 + }
1.80 + // Change the device release number
1.81 + deviceDescriptor[KUsbDevReleaseOffset] = LoByte(aLddPtr->iRelease); // little endian!
1.82 + deviceDescriptor[KUsbDevReleaseOffset+1] = HiByte(aLddPtr->iRelease);
1.83 + r = aPort->SetDeviceDescriptor(deviceDescriptor);
1.84 + test_KErrNone(r);
1.85 +
1.86 + if (!gSkip)
1.87 + {
1.88 + test.Next(_L("GetDeviceDescriptor()"));
1.89 + TBuf8<KUsbDescSize_Device> descriptor2;
1.90 + r = aPort->GetDeviceDescriptor(descriptor2);
1.91 + test_KErrNone(r);
1.92 +
1.93 + test.Next(_L("Compare device descriptor with value set"));
1.94 + r = descriptor2.Compare(deviceDescriptor);
1.95 + test_KErrNone(r);
1.96 + }
1.97 +
1.98 + // === Configuration Descriptor
1.99 +
1.100 + test.Next(_L("GetConfigurationDescriptorSize"));
1.101 + TInt configDescriptorSize = 0;
1.102 + aPort->GetConfigurationDescriptorSize(configDescriptorSize);
1.103 + test_Equal(KUsbDescSize_Config,static_cast<TUint>(configDescriptorSize));
1.104 +
1.105 + test.Next(_L("GetConfigurationDescriptor"));
1.106 + TBuf8<KUsbDescSize_Config> configDescriptor;
1.107 + r = aPort->GetConfigurationDescriptor(configDescriptor);
1.108 + test_KErrNone(r);
1.109 +
1.110 + test.Next(_L("SetConfigurationDescriptor"));
1.111 + // Change Self Power and Remote Wakeup
1.112 + const TInt KUsbAttributesOffset = 7;
1.113 + const TUint8 KUsbAttributeDefault = 0x80;
1.114 + const TUint8 KUsbAttributeSelfPower = 0x40;
1.115 + const TUint8 KUsbAttributeRemoteWakeup = 0x20;
1.116 + configDescriptor[KUsbAttributesOffset] = KUsbAttributeDefault | (aLddPtr->iSelfPower ? KUsbAttributeSelfPower : 0)
1.117 + | (aLddPtr->iRemoteWakeup ? KUsbAttributeRemoteWakeup : 0);
1.118 + // Change the reported max power
1.119 + // 100mA (= 2 * 0x32) is the highest value allowed for a bus-powered device.
1.120 + const TInt KUsbMaxPowerOffset = 8;
1.121 + configDescriptor[KUsbMaxPowerOffset] = aLddPtr->iMaxPower;
1.122 + r = aPort->SetConfigurationDescriptor(configDescriptor);
1.123 + test_KErrNone(r);
1.124 +
1.125 + if (!gSkip)
1.126 + {
1.127 + test.Next(_L("GetConfigurationDescriptor()"));
1.128 + TBuf8<KUsbDescSize_Config> descriptor2;
1.129 + r = aPort->GetConfigurationDescriptor(descriptor2);
1.130 + test_KErrNone(r);
1.131 +
1.132 + test.Next(_L("Compare configuration desc with value set"));
1.133 + r = descriptor2.Compare(configDescriptor);
1.134 + test_KErrNone(r);
1.135 + }
1.136 +
1.137 + // === String Descriptors
1.138 +
1.139 + test.Next(_L("SetStringDescriptor"));
1.140 +
1.141 + // Set up any standard string descriptors that were defined in the xml config
1.142 + if (aLddPtr->iManufacturer)
1.143 + {
1.144 + r = aPort->SetManufacturerStringDescriptor(* aLddPtr->iManufacturer);
1.145 + test_KErrNone(r);
1.146 + }
1.147 +
1.148 + if (aLddPtr->iProduct)
1.149 + {
1.150 + r = aPort->SetProductStringDescriptor(* aLddPtr->iProduct);
1.151 + test_KErrNone(r);
1.152 + }
1.153 +
1.154 + if (aLddPtr->iSerialNumber)
1.155 + {
1.156 + r = aPort->SetSerialNumberStringDescriptor(* aLddPtr->iSerialNumber);
1.157 + test_KErrNone(r);
1.158 + }
1.159 +
1.160 + // Set up two arbitrary string descriptors, which can be queried
1.161 + // manually from the host side for testing purposes
1.162 +
1.163 + TBuf16<KUsbStringDescStringMaxSize / 2> wr_str(KString_one);
1.164 + r = aPort->SetStringDescriptor(stridx1, wr_str);
1.165 + test_KErrNone(r);
1.166 +
1.167 + wr_str.FillZ(wr_str.MaxLength());
1.168 + wr_str = KString_two;
1.169 + r = aPort->SetStringDescriptor(stridx2, wr_str);
1.170 + test_KErrNone(r);
1.171 +
1.172 + test.End();
1.173 +
1.174 + }
1.175 +
1.176 +static void TestDeviceQualifierDescriptor(RDEVCLIENT* aPort)
1.177 + {
1.178 + test.Start(_L("Device_Qualifier Descriptor Manipulation"));
1.179 +
1.180 + test.Next(_L("GetDeviceQualifierDescriptor()"));
1.181 + TBuf8<KUsbDescSize_DeviceQualifier> descriptor;
1.182 + TInt r = aPort->GetDeviceQualifierDescriptor(descriptor);
1.183 + test_KErrNone(r);
1.184 +
1.185 + test.Next(_L("SetDeviceQualifierDescriptor()"));
1.186 + // Change the USB spec number to 3.00
1.187 + descriptor[KDevDesc_SpecOffset] = 0x00;
1.188 + descriptor[KDevDesc_SpecOffset+1] = 0x03;
1.189 + // Change the device class, subclass and protocol codes
1.190 + descriptor[KDevDesc_DevClassOffset] = 0xA1;
1.191 + descriptor[KDevDesc_DevSubClassOffset] = 0xB2;
1.192 + descriptor[KDevDesc_DevProtocolOffset] = 0xC3;
1.193 + r = aPort->SetDeviceQualifierDescriptor(descriptor);
1.194 + test_KErrNone(r);
1.195 +
1.196 + test.Next(_L("GetDeviceQualifierDescriptor()"));
1.197 + TBuf8<KUsbDescSize_DeviceQualifier> descriptor2;
1.198 + r = aPort->GetDeviceQualifierDescriptor(descriptor2);
1.199 + test_KErrNone(r);
1.200 +
1.201 + test.Next(_L("Compare Device_Qualifier desc with value set"));
1.202 + r = descriptor2.Compare(descriptor);
1.203 + test_Equal(0,r);
1.204 +
1.205 + test.End();
1.206 + }
1.207 +
1.208 +
1.209 +
1.210 +static void TestOtherSpeedConfigurationDescriptor(RDEVCLIENT* aPort)
1.211 + {
1.212 + test.Start(_L("Other_Speed_Configuration Desc Manipulation"));
1.213 +
1.214 + test.Next(_L("GetOtherSpeedConfigurationDescriptor()"));
1.215 + TBuf8<KUsbDescSize_OtherSpeedConfig> descriptor;
1.216 + TInt r = aPort->GetOtherSpeedConfigurationDescriptor(descriptor);
1.217 + test_KErrNone(r);
1.218 +
1.219 + test.Next(_L("SetOtherSpeedConfigurationDescriptor()"));
1.220 + // Invert Remote-Wakup support
1.221 + descriptor[KConfDesc_AttribOffset] = (descriptor[KConfDesc_AttribOffset] ^ KUsbDevAttr_RemoteWakeup);
1.222 + // Change the reported max power to 330mA (2 * 0xA5)
1.223 + descriptor[KConfDesc_MaxPowerOffset] = 0xA5;
1.224 + r = aPort->SetOtherSpeedConfigurationDescriptor(descriptor);
1.225 + test_KErrNone(r);
1.226 +
1.227 + test.Next(_L("GetOtherSpeedConfigurationDescriptor()"));
1.228 + TBuf8<KUsbDescSize_OtherSpeedConfig> descriptor2;
1.229 + r = aPort->GetOtherSpeedConfigurationDescriptor(descriptor2);
1.230 + test_KErrNone(r);
1.231 +
1.232 + test.Next(_L("Compare O_S_Config desc with value set"));
1.233 + r = descriptor2.Compare(descriptor);
1.234 + test_KErrNone(r);
1.235 +
1.236 + test.End();
1.237 + }
1.238 +
1.239 +
1.240 +static void TestInterfaceDescriptor(RDEVCLIENT* aPort, TInt aNumSettings)
1.241 + {
1.242 + test.Start(_L("Interface Descriptor Manipulation"));
1.243 +
1.244 + // For all settings
1.245 +
1.246 + TInt desc_size = 0;
1.247 + TInt r = 0;
1.248 + TBuf8<KUsbDescSize_Interface> descriptor;
1.249 + TBuf8<KUsbDescSize_Interface> descriptor2;
1.250 + for (TInt i =0; i < aNumSettings; i++)
1.251 + {
1.252 +
1.253 + test.Next(_L("GetInterfaceDescriptorSize()"));
1.254 + r = aPort->GetInterfaceDescriptorSize(i, desc_size);
1.255 + if (r != KErrNone)
1.256 + {
1.257 + RDebug::Printf ("Error %d in GetInterfaceDescriptorSize %d\n",r,i);
1.258 + }
1.259 + test_KErrNone(r);
1.260 + test_Equal(KUsbDescSize_Interface,static_cast<TUint>(desc_size));
1.261 +
1.262 + test.Next(_L("GetInterfaceDescriptor()"));
1.263 + r = aPort->GetInterfaceDescriptor(i, descriptor);
1.264 + test_KErrNone(r);
1.265 +
1.266 + test.Next(_L("SetInterfaceDescriptor()"));
1.267 + // Change the interface protocol to 0x78(+)
1.268 + TUint8 prot = 0x78;
1.269 + if (descriptor[KIfcDesc_ProtocolOffset] == prot)
1.270 + prot++;
1.271 + descriptor[KIfcDesc_ProtocolOffset] = prot;
1.272 + r = aPort->SetInterfaceDescriptor(i, descriptor);
1.273 + test_KErrNone(r);
1.274 +
1.275 + test.Next(_L("GetInterfaceDescriptor()"));
1.276 + r = aPort->GetInterfaceDescriptor(i, descriptor2);
1.277 + test_KErrNone(r);
1.278 +
1.279 + test.Next(_L("Compare interface descriptor with value set"));
1.280 + r = descriptor2.Compare(descriptor);
1.281 + test_KErrNone(r);
1.282 + }
1.283 +
1.284 + test.Next(_L("GetInterfaceDescriptor()"));
1.285 + r = aPort->GetInterfaceDescriptor(aNumSettings, descriptor);
1.286 + test_Equal(KErrNotFound,r);
1.287 +
1.288 + test.Next(_L("SetInterfaceDescriptor()"));
1.289 + r = aPort->SetInterfaceDescriptor(aNumSettings, descriptor);
1.290 + test_Equal(KErrNotFound,r);
1.291 +
1.292 + test.End();
1.293 + }
1.294 +
1.295 +
1.296 +static void TestClassSpecificDescriptors(RDEVCLIENT* aPort)
1.297 + {
1.298 + test.Start(_L("Class-specific Descriptor Manipulation"));
1.299 +
1.300 + // First a class-specific Interface descriptor
1.301 +
1.302 + test.Next(_L("SetCSInterfaceDescriptorBlock()"));
1.303 + // choose arbitrary new descriptor size
1.304 + const TInt KUsbDescSize_CS_Interface = KUsbDescSize_Interface + 10;
1.305 + TBuf8<KUsbDescSize_CS_Interface> cs_ifc_descriptor;
1.306 + cs_ifc_descriptor.FillZ(cs_ifc_descriptor.MaxLength());
1.307 + cs_ifc_descriptor[KUsbDesc_SizeOffset] = KUsbDescSize_CS_Interface;
1.308 + cs_ifc_descriptor[KUsbDesc_TypeOffset] = KUsbDescType_CS_Interface;
1.309 + TInt r = aPort->SetCSInterfaceDescriptorBlock(0, cs_ifc_descriptor);
1.310 + test_KErrNone(r);
1.311 +
1.312 + test.Next(_L("GetCSInterfaceDescriptorBlockSize()"));
1.313 + TInt desc_size = 0;
1.314 + r = aPort->GetCSInterfaceDescriptorBlockSize(0, desc_size);
1.315 + test_KErrNone(r);
1.316 + test_Equal(KUsbDescSize_CS_Interface,desc_size);
1.317 +
1.318 + test.Next(_L("GetCSInterfaceDescriptorBlock()"));
1.319 + TBuf8<KUsbDescSize_CS_Interface> descriptor;
1.320 + r = aPort->GetCSInterfaceDescriptorBlock(0, descriptor);
1.321 + test_KErrNone(r);
1.322 +
1.323 + test.Next(_L("Compare CS ifc descriptor with value set"));
1.324 + r = descriptor.Compare(cs_ifc_descriptor);
1.325 + test_KErrNone(r);
1.326 +
1.327 + // Next a class-specific Endpoint descriptor
1.328 +
1.329 + test.Next(_L("SetCSEndpointDescriptorBlock()"));
1.330 + // choose arbitrary new descriptor size
1.331 + const TInt KUsbDescSize_CS_Endpoint = KUsbDescSize_Endpoint + 5;
1.332 + TBuf8<KUsbDescSize_CS_Endpoint> cs_ep_descriptor;
1.333 + cs_ep_descriptor.FillZ(cs_ep_descriptor.MaxLength());
1.334 + cs_ep_descriptor[KUsbDesc_SizeOffset] = KUsbDescSize_CS_Endpoint;
1.335 + cs_ep_descriptor[KUsbDesc_TypeOffset] = KUsbDescType_CS_Endpoint;
1.336 + r = aPort->SetCSEndpointDescriptorBlock(0, 2, cs_ep_descriptor);
1.337 + test_KErrNone(r);
1.338 +
1.339 + test.Next(_L("GetCSEndpointDescriptorBlockSize()"));
1.340 + r = aPort->GetCSEndpointDescriptorBlockSize(0, 2, desc_size);
1.341 + test_KErrNone(r);
1.342 + test_Equal(KUsbDescSize_CS_Endpoint,desc_size);
1.343 +
1.344 + test.Next(_L("GetCSEndpointDescriptorBlock()"));
1.345 + TBuf8<KUsbDescSize_CS_Endpoint> descriptor2;
1.346 + r = aPort->GetCSEndpointDescriptorBlock(0, 2, descriptor2);
1.347 + test_KErrNone(r);
1.348 +
1.349 + test.Next(_L("Compare CS ep descriptor with value set"));
1.350 + r = descriptor2.Compare(cs_ep_descriptor);
1.351 + test_KErrNone(r);
1.352 +
1.353 + test.End();
1.354 + }
1.355 +
1.356 +
1.357 +void TestEndpointDescriptor(RDEVCLIENT* aPort,TInt aIfSetting, TInt aEpNumber,TUsbcEndpointInfo aEpInfo)
1.358 + {
1.359 + test.Start(_L("Endpoint Descriptor Manipulation"));
1.360 +
1.361 + TBuf8<KUsbDescSize_AudioEndpoint> epDescriptor;
1.362 + TInt desc_size;
1.363 + TInt r = aPort->GetEndpointDescriptorSize(aIfSetting, aEpNumber, desc_size);
1.364 + test_KErrNone(r);
1.365 + test_Equal(KUsbDescSize_Endpoint + aEpInfo.iExtra,static_cast<TUint>(desc_size));
1.366 +
1.367 + r = aPort->GetEndpointDescriptor(aIfSetting, aEpNumber, epDescriptor);
1.368 + test_KErrNone(r);
1.369 +
1.370 + test(((aEpInfo.iDir & KUsbEpDirIn) && (epDescriptor[KEpDesc_AddressOffset] & 0x80) ||
1.371 + !(aEpInfo.iDir & KUsbEpDirIn) && !(epDescriptor[KEpDesc_AddressOffset] & 0x80)) &&
1.372 + EpTypeMask2Value(aEpInfo.iType) == (TUint)(epDescriptor[KEpDesc_AttributesOffset] & 0x03) &&
1.373 + aEpInfo.iInterval == epDescriptor[KEpDesc_IntervalOffset]);
1.374 +
1.375 + // Change the endpoint poll interval
1.376 + TUint8 ival = 0x66;
1.377 + if (epDescriptor[KEpDesc_IntervalOffset] == ival)
1.378 + ival++;
1.379 +
1.380 +
1.381 + TUint8 saveAddr = 0; // save the address
1.382 + if (aEpInfo.iExtra > 0)
1.383 + {
1.384 + saveAddr = epDescriptor[KEpDesc_SynchAddressOffset];
1.385 + TUint8 addr = 0x85; // bogus address
1.386 + if (epDescriptor[KEpDesc_SynchAddressOffset] == addr)
1.387 + addr++;
1.388 + epDescriptor[KEpDesc_SynchAddressOffset] = addr;
1.389 + }
1.390 +
1.391 + epDescriptor[KEpDesc_IntervalOffset] = ival;
1.392 + r = aPort->SetEndpointDescriptor(aIfSetting, aEpNumber, epDescriptor);
1.393 + test_KErrNone(r);
1.394 +
1.395 + TBuf8<KUsbDescSize_AudioEndpoint> descriptor2;
1.396 + r = aPort->GetEndpointDescriptor(aIfSetting, aEpNumber, descriptor2);
1.397 + test_KErrNone(r);
1.398 +
1.399 + r = descriptor2.Compare(epDescriptor);
1.400 + test_KErrNone(r);
1.401 +
1.402 + if (aEpInfo.iExtra > 0)
1.403 + {
1.404 + // Restore the endpoint synch address
1.405 + epDescriptor[KEpDesc_SynchAddressOffset] = saveAddr;
1.406 + }
1.407 +
1.408 + // Restore the endpoint poll interval
1.409 + epDescriptor[KEpDesc_IntervalOffset] = aEpInfo.iInterval;
1.410 + r = aPort->SetEndpointDescriptor(aIfSetting, aEpNumber, epDescriptor);
1.411 + test_KErrNone(r);
1.412 +
1.413 + test.End();
1.414 + }
1.415 +
1.416 +static void TestStandardStringDescriptors(RDEVCLIENT* aPort)
1.417 + {
1.418 + test.Start(_L("String Descriptor Manipulation"));
1.419 +
1.420 + //
1.421 + // --- LANGID code
1.422 + //
1.423 +
1.424 + test.Next(_L("GetStringDescriptorLangId()"));
1.425 + TUint16 rd_langid_orig;
1.426 + TInt r = aPort->GetStringDescriptorLangId(rd_langid_orig);
1.427 + test_KErrNone(r);
1.428 + test.Printf(_L("Original LANGID code: 0x%04X\n"), rd_langid_orig);
1.429 +
1.430 + test.Next(_L("SetStringDescriptorLangId()"));
1.431 + TUint16 wr_langid = 0x0809; // English (UK) Language ID
1.432 + if (wr_langid == rd_langid_orig)
1.433 + wr_langid = 0x0444; // Tatar Language ID
1.434 + r = aPort->SetStringDescriptorLangId(wr_langid);
1.435 + test_KErrNone(r);
1.436 +
1.437 + test.Next(_L("GetStringDescriptorLangId()"));
1.438 + TUint16 rd_langid;
1.439 + r = aPort->GetStringDescriptorLangId(rd_langid);
1.440 + test_KErrNone(r);
1.441 + test.Printf(_L("New LANGID code: 0x%04X\n"), rd_langid);
1.442 +
1.443 + test.Next(_L("Compare LANGID codes"));
1.444 + test_Equal(wr_langid,rd_langid);
1.445 +
1.446 + test.Next(_L("Restore original LANGID code"));
1.447 + r = aPort->SetStringDescriptorLangId(rd_langid_orig);
1.448 + test_KErrNone(r);
1.449 + r = aPort->GetStringDescriptorLangId(rd_langid);
1.450 + test_KErrNone(r);
1.451 + test_Equal(rd_langid_orig,rd_langid);
1.452 +
1.453 + //
1.454 + // --- Manufacturer string
1.455 + //
1.456 +
1.457 + test.Next(_L("GetManufacturerStringDescriptor()"));
1.458 + TBuf16<KUsbStringDescStringMaxSize / 2> rd_str_orig;
1.459 + r = aPort->GetManufacturerStringDescriptor(rd_str_orig);
1.460 + test(r == KErrNone || r == KErrNotFound);
1.461 + TBool restore_string;
1.462 + if (r == KErrNone)
1.463 + {
1.464 + test.Printf(_L("Original Manufacturer string: \"%lS\"\n"), &rd_str_orig);
1.465 + restore_string = ETrue;
1.466 + }
1.467 + else
1.468 + {
1.469 + test.Printf(_L("No Manufacturer string set\n"));
1.470 + restore_string = EFalse;
1.471 + }
1.472 +
1.473 + test.Next(_L("SetManufacturerStringDescriptor()"));
1.474 + _LIT16(manufacturer, "Manufacturer Which Manufactures Devices");
1.475 + TBuf16<KUsbStringDescStringMaxSize / 2> wr_str(manufacturer);
1.476 + r = aPort->SetManufacturerStringDescriptor(wr_str);
1.477 + test_KErrNone(r);
1.478 +
1.479 + test.Next(_L("GetManufacturerStringDescriptor()"));
1.480 + TBuf16<KUsbStringDescStringMaxSize / 2> rd_str;
1.481 + r = aPort->GetManufacturerStringDescriptor(rd_str);
1.482 + test_KErrNone(r);
1.483 + test.Printf(_L("New Manufacturer string: \"%lS\"\n"), &rd_str);
1.484 +
1.485 + test.Next(_L("Compare Manufacturer strings"));
1.486 + r = rd_str.Compare(wr_str);
1.487 + test_KErrNone(r);
1.488 +
1.489 + test.Next(_L("SetManufacturerStringDescriptor()"));
1.490 + _LIT16(manufacturer2, "Different Manufacturer Which Manufactures Different Devices");
1.491 + wr_str.FillZ(wr_str.MaxLength());
1.492 + wr_str = manufacturer2;
1.493 + r = aPort->SetManufacturerStringDescriptor(wr_str);
1.494 + test_KErrNone(r);
1.495 +
1.496 + test.Next(_L("GetManufacturerStringDescriptor()"));
1.497 + rd_str.FillZ(rd_str.MaxLength());
1.498 + r = aPort->GetManufacturerStringDescriptor(rd_str);
1.499 + test_KErrNone(r);
1.500 + test.Printf(_L("New Manufacturer string: \"%lS\"\n"), &rd_str);
1.501 +
1.502 + test.Next(_L("Compare Manufacturer strings"));
1.503 + r = rd_str.Compare(wr_str);
1.504 + test_KErrNone(r);
1.505 +
1.506 + test.Next(_L("RemoveManufacturerStringDescriptor()"));
1.507 + r = aPort->RemoveManufacturerStringDescriptor();
1.508 + test_KErrNone(r);
1.509 + r = aPort->GetManufacturerStringDescriptor(rd_str);
1.510 + test_Equal(KErrNotFound,r);
1.511 +
1.512 + if (restore_string)
1.513 + {
1.514 + test.Next(_L("Restore original string"));
1.515 + r = aPort->SetManufacturerStringDescriptor(rd_str_orig);
1.516 + test_KErrNone(r);
1.517 + r = aPort->GetManufacturerStringDescriptor(rd_str);
1.518 + test_KErrNone(r);
1.519 + r = rd_str.Compare(rd_str_orig);
1.520 + test_KErrNone(r);
1.521 + }
1.522 +
1.523 + //
1.524 + // --- Product string
1.525 + //
1.526 +
1.527 + test.Next(_L("GetProductStringDescriptor()"));
1.528 + rd_str_orig.FillZ(rd_str.MaxLength());
1.529 + r = aPort->GetProductStringDescriptor(rd_str_orig);
1.530 + test(r == KErrNone || r == KErrNotFound);
1.531 + if (r == KErrNone)
1.532 + {
1.533 + test.Printf(_L("Old Product string: \"%lS\"\n"), &rd_str_orig);
1.534 + restore_string = ETrue;
1.535 + }
1.536 + else
1.537 + restore_string = EFalse;
1.538 +
1.539 + test.Next(_L("SetProductStringDescriptor()"));
1.540 + _LIT16(product, "Product That Was Produced By A Manufacturer");
1.541 + wr_str.FillZ(wr_str.MaxLength());
1.542 + wr_str = product;
1.543 + r = aPort->SetProductStringDescriptor(wr_str);
1.544 + test_KErrNone(r);
1.545 +
1.546 + test.Next(_L("GetProductStringDescriptor()"));
1.547 + rd_str.FillZ(rd_str.MaxLength());
1.548 + r = aPort->GetProductStringDescriptor(rd_str);
1.549 + test_KErrNone(r);
1.550 + test.Printf(_L("New Product string: \"%lS\"\n"), &rd_str);
1.551 +
1.552 + test.Next(_L("Compare Product strings"));
1.553 + r = rd_str.Compare(wr_str);
1.554 + test_KErrNone(r);
1.555 +
1.556 + test.Next(_L("SetProductStringDescriptor()"));
1.557 + _LIT16(product2, "Different Product That Was Produced By A Different Manufacturer");
1.558 + wr_str.FillZ(wr_str.MaxLength());
1.559 + wr_str = product2;
1.560 + r = aPort->SetProductStringDescriptor(wr_str);
1.561 + test_KErrNone(r);
1.562 +
1.563 + test.Next(_L("GetProductStringDescriptor()"));
1.564 + rd_str.FillZ(rd_str.MaxLength());
1.565 + r = aPort->GetProductStringDescriptor(rd_str);
1.566 + test_KErrNone(r);
1.567 + test.Printf(_L("New Product string: \"%lS\"\n"), &rd_str);
1.568 +
1.569 + test.Next(_L("Compare Product strings"));
1.570 + r = rd_str.Compare(wr_str);
1.571 + test_KErrNone(r);
1.572 +
1.573 + test.Next(_L("RemoveProductStringDescriptor()"));
1.574 + r = aPort->RemoveProductStringDescriptor();
1.575 + test_KErrNone(r);
1.576 + r = aPort->GetProductStringDescriptor(rd_str);
1.577 + test_Equal(KErrNotFound,r);
1.578 +
1.579 + if (restore_string)
1.580 + {
1.581 + test.Next(_L("Restore original string"));
1.582 + r = aPort->SetProductStringDescriptor(rd_str_orig);
1.583 + test_KErrNone(r);
1.584 + r = aPort->GetProductStringDescriptor(rd_str);
1.585 + test_KErrNone(r);
1.586 + r = rd_str.Compare(rd_str_orig);
1.587 + test_KErrNone(r);
1.588 + }
1.589 +
1.590 + //
1.591 + // --- Serial Number string
1.592 + //
1.593 +
1.594 + test.Next(_L("GetSerialNumberStringDescriptor()"));
1.595 + rd_str_orig.FillZ(rd_str.MaxLength());
1.596 + r = aPort->GetSerialNumberStringDescriptor(rd_str_orig);
1.597 + test(r == KErrNone || r == KErrNotFound);
1.598 + if (r == KErrNone)
1.599 + {
1.600 + test.Printf(_L("Old Serial Number: \"%lS\"\n"), &rd_str_orig);
1.601 + restore_string = ETrue;
1.602 + }
1.603 + else
1.604 + restore_string = EFalse;
1.605 +
1.606 + test.Next(_L("SetSerialNumberStringDescriptor()"));
1.607 + _LIT16(serial, "000666000XYZ");
1.608 + wr_str.FillZ(wr_str.MaxLength());
1.609 + wr_str = serial;
1.610 + r = aPort->SetSerialNumberStringDescriptor(wr_str);
1.611 + test_KErrNone(r);
1.612 +
1.613 + test.Next(_L("GetSerialNumberStringDescriptor()"));
1.614 + rd_str.FillZ(rd_str.MaxLength());
1.615 + r = aPort->GetSerialNumberStringDescriptor(rd_str);
1.616 + test_KErrNone(r);
1.617 + test.Printf(_L("New Serial Number: \"%lS\"\n"), &rd_str);
1.618 +
1.619 + test.Next(_L("Compare Serial Number strings"));
1.620 + r = rd_str.Compare(wr_str);
1.621 + test_KErrNone(r);
1.622 +
1.623 + test.Next(_L("SetSerialNumberStringDescriptor()"));
1.624 + _LIT16(serial2, "Y11611193111711111Y");
1.625 + wr_str.FillZ(wr_str.MaxLength());
1.626 + wr_str = serial2;
1.627 + r = aPort->SetSerialNumberStringDescriptor(wr_str);
1.628 + test_KErrNone(r);
1.629 +
1.630 + test.Next(_L("GetSerialNumberStringDescriptor()"));
1.631 + rd_str.FillZ(rd_str.MaxLength());
1.632 + r = aPort->GetSerialNumberStringDescriptor(rd_str);
1.633 + test_KErrNone(r);
1.634 + test.Printf(_L("New Serial Number: \"%lS\"\n"), &rd_str);
1.635 +
1.636 + test.Next(_L("Compare Serial Number strings"));
1.637 + r = rd_str.Compare(wr_str);
1.638 + test_KErrNone(r);
1.639 +
1.640 + test.Next(_L("RemoveSerialNumberStringDescriptor()"));
1.641 + r = aPort->RemoveSerialNumberStringDescriptor();
1.642 + test_KErrNone(r);
1.643 + r = aPort->GetSerialNumberStringDescriptor(rd_str);
1.644 + test_Equal(KErrNotFound,r);
1.645 +
1.646 + if (restore_string)
1.647 + {
1.648 + test.Next(_L("Restore original string"));
1.649 + r = aPort->SetSerialNumberStringDescriptor(rd_str_orig);
1.650 + test_KErrNone(r);
1.651 + r = aPort->GetSerialNumberStringDescriptor(rd_str);
1.652 + test_KErrNone(r);
1.653 + r = rd_str.Compare(rd_str_orig);
1.654 + test_KErrNone(r);
1.655 + }
1.656 +
1.657 + //
1.658 + // --- Configuration string
1.659 + //
1.660 +
1.661 + test.Next(_L("GetConfigurationStringDescriptor()"));
1.662 + rd_str_orig.FillZ(rd_str.MaxLength());
1.663 + r = aPort->GetConfigurationStringDescriptor(rd_str_orig);
1.664 + test(r == KErrNone || r == KErrNotFound);
1.665 + if (r == KErrNone)
1.666 + {
1.667 + test.Printf(_L("Old Configuration string: \"%lS\"\n"), &rd_str_orig);
1.668 + restore_string = ETrue;
1.669 + }
1.670 + else
1.671 + restore_string = EFalse;
1.672 +
1.673 + test.Next(_L("SetConfigurationStringDescriptor()"));
1.674 + _LIT16(config, "Relatively Simple Configuration That Is Still Useful");
1.675 + wr_str.FillZ(wr_str.MaxLength());
1.676 + wr_str = config;
1.677 + r = aPort->SetConfigurationStringDescriptor(wr_str);
1.678 + test_KErrNone(r);
1.679 +
1.680 + test.Next(_L("GetConfigurationStringDescriptor()"));
1.681 + rd_str.FillZ(rd_str.MaxLength());
1.682 + r = aPort->GetConfigurationStringDescriptor(rd_str);
1.683 + test_KErrNone(r);
1.684 + test.Printf(_L("New Configuration string: \"%lS\"\n"), &rd_str);
1.685 +
1.686 + test.Next(_L("Compare Configuration strings"));
1.687 + r = rd_str.Compare(wr_str);
1.688 + test_KErrNone(r);
1.689 +
1.690 + test.Next(_L("SetConfigurationStringDescriptor()"));
1.691 + _LIT16(config2, "Convenient Configuration That Can Be Very Confusing");
1.692 + wr_str.FillZ(wr_str.MaxLength());
1.693 + wr_str = config2;
1.694 + r = aPort->SetConfigurationStringDescriptor(wr_str);
1.695 + test_KErrNone(r);
1.696 +
1.697 + test.Next(_L("GetConfigurationStringDescriptor()"));
1.698 + rd_str.FillZ(rd_str.MaxLength());
1.699 + r = aPort->GetConfigurationStringDescriptor(rd_str);
1.700 + test_KErrNone(r);
1.701 + test.Printf(_L("New Configuration string: \"%lS\"\n"), &rd_str);
1.702 +
1.703 + test.Next(_L("Compare Configuration strings"));
1.704 + r = rd_str.Compare(wr_str);
1.705 + test_KErrNone(r);
1.706 +
1.707 + test.Next(_L("RemoveConfigurationStringDescriptor()"));
1.708 + r = aPort->RemoveConfigurationStringDescriptor();
1.709 + test_KErrNone(r);
1.710 + r = aPort->GetConfigurationStringDescriptor(rd_str);
1.711 + test_Equal(KErrNotFound,r);
1.712 +
1.713 + if (restore_string)
1.714 + {
1.715 + test.Next(_L("Restore original string"));
1.716 + r = aPort->SetConfigurationStringDescriptor(rd_str_orig);
1.717 + test_KErrNone(r);
1.718 + r = aPort->GetConfigurationStringDescriptor(rd_str);
1.719 + test_KErrNone(r);
1.720 + r = rd_str.Compare(rd_str_orig);
1.721 + test_KErrNone(r);
1.722 + }
1.723 +
1.724 + test.End();
1.725 + }
1.726 +
1.727 +
1.728 +static void TestArbitraryStringDescriptors(RDEVCLIENT* aPort,TInt aNumSettings)
1.729 + {
1.730 + test.Start(_L("Arbitrary String Descriptor Manipulation"));
1.731 +
1.732 + // First test string
1.733 +
1.734 + test.Next(_L("GetStringDescriptor() 1"));
1.735 + TBuf16<KUsbStringDescStringMaxSize / 2> rd_str;
1.736 + TInt r = aPort->GetStringDescriptor(stridx1, rd_str);
1.737 + test_KErrNone(r);
1.738 +
1.739 + TBuf16<KUsbStringDescStringMaxSize / 2> wr_str(KString_one);
1.740 + r = rd_str.Compare(wr_str);
1.741 + test_KErrNone(r);
1.742 +
1.743 + // Second test string
1.744 +
1.745 + test.Next(_L("GetStringDescriptor() 2"));
1.746 + rd_str.FillZ(rd_str.MaxLength());
1.747 + r = aPort->GetStringDescriptor(stridx2, rd_str);
1.748 + test_KErrNone(r);
1.749 +
1.750 + wr_str = KString_two;
1.751 + r = rd_str.Compare(wr_str);
1.752 + test_KErrNone(r);
1.753 +
1.754 + // Third test string
1.755 +
1.756 + test.Next(_L("GetStringDescriptor() 3"));
1.757 + rd_str.FillZ(rd_str.MaxLength());
1.758 + r = aPort->GetStringDescriptor(stridx3, rd_str);
1.759 + test_Equal(KErrNotFound,r);
1.760 +
1.761 + test.Next(_L("SetStringDescriptor() 3"));
1.762 + _LIT16(string_three, "Arbitrary String Descriptor Test String 3");
1.763 + wr_str.FillZ(wr_str.MaxLength());
1.764 + wr_str = string_three;
1.765 + r = aPort->SetStringDescriptor(stridx3, wr_str);
1.766 + test_KErrNone(r);
1.767 +
1.768 + // In between we create another interface setting to see what happens
1.769 + // to the existing string descriptor indices.
1.770 + // (We don't have to test this on every platform -
1.771 + // besides, those that don't support alt settings
1.772 + // are by now very rare.)
1.773 + if (SupportsAlternateInterfaces())
1.774 + {
1.775 + #ifdef USB_SC
1.776 + TUsbcScInterfaceInfoBuf ifc;
1.777 + #else
1.778 + TUsbcInterfaceInfoBuf ifc;
1.779 + #endif
1.780 + _LIT16(string, "T_USB_DEVICE Bogus Test Interface (Next Setting)");
1.781 + ifc().iString = const_cast<TDesC16*>(&string);
1.782 + ifc().iTotalEndpointsUsed = 0;
1.783 + TInt r = aPort->SetInterface(aNumSettings, ifc);
1.784 + test_KErrNone(r);
1.785 + }
1.786 +
1.787 + test.Next(_L("GetStringDescriptor() 3"));
1.788 + r = aPort->GetStringDescriptor(stridx3, rd_str);
1.789 + test_KErrNone(r);
1.790 + test.Printf(_L("New test string @ idx %d: \"%lS\"\n"), stridx3, &rd_str);
1.791 +
1.792 + test.Next(_L("Compare test strings 3"));
1.793 + r = rd_str.Compare(wr_str);
1.794 + test_KErrNone(r);
1.795 +
1.796 + // Remove string descriptors 3 and 4
1.797 +
1.798 + test.Next(_L("RemoveStringDescriptor() 4"));
1.799 + r = aPort->RemoveStringDescriptor(stridx4);
1.800 + test_Equal(KErrNotFound,r);
1.801 +
1.802 + test.Next(_L("RemoveStringDescriptor() 3"));
1.803 + r = aPort->RemoveStringDescriptor(stridx3);
1.804 + test_KErrNone(r);
1.805 +
1.806 + r = aPort->GetStringDescriptor(stridx3, rd_str);
1.807 + test_Equal(KErrNotFound,r);
1.808 +
1.809 + if (SupportsAlternateInterfaces())
1.810 + {
1.811 + TInt r = aPort->ReleaseInterface(aNumSettings);
1.812 + test_KErrNone(r);
1.813 + }
1.814 +
1.815 + test.End();
1.816 + }
1.817 +
1.818 +void TestInvalidSetInterface (RDEVCLIENT* aPort,TInt aNumSettings)
1.819 + {
1.820 + #ifdef USB_SC
1.821 + TUsbcScInterfaceInfoBuf ifc;
1.822 + #else
1.823 + TUsbcInterfaceInfoBuf ifc;
1.824 + #endif
1.825 + _LIT16(string, "T_USB_DEVICE Invalid Interface");
1.826 + ifc().iString = const_cast<TDesC16*>(&string);
1.827 + ifc().iTotalEndpointsUsed = 0;
1.828 +
1.829 + test.Start(_L("Test Invalid Interface Setting"));
1.830 +
1.831 + if (SupportsAlternateInterfaces())
1.832 + {
1.833 + TInt r = aPort->SetInterface(aNumSettings+1, ifc);
1.834 + test_Compare(r,!=,KErrNone);
1.835 + }
1.836 +
1.837 + if (aNumSettings > 1)
1.838 + {
1.839 + TInt r = aPort->SetInterface(aNumSettings-1, ifc);
1.840 + test_Compare(r,!=,KErrNone);
1.841 + }
1.842 +
1.843 + TInt r = aPort->SetInterface(0, ifc);
1.844 + test_Compare(r,!=,KErrNone);
1.845 +
1.846 + test.End();
1.847 + }
1.848 +
1.849 +void TestInvalidReleaseInterface (RDEVCLIENT* aPort,TInt aNumSettings)
1.850 + {
1.851 + test.Start(_L("Test Invalid Interface Release"));
1.852 +
1.853 + if (aNumSettings > 2)
1.854 + {
1.855 + TInt r = aPort->ReleaseInterface(aNumSettings-3);
1.856 + test_Compare(r,!=,KErrNone);
1.857 + }
1.858 +
1.859 + if (aNumSettings > 1)
1.860 + {
1.861 + TInt r = aPort->ReleaseInterface(aNumSettings-2);
1.862 + test_Compare(r,!=,KErrNone);
1.863 + }
1.864 +
1.865 + test.End();
1.866 + }
1.867 +
1.868 +void TestDescriptorManipulation(TBool aHighSpeed, RDEVCLIENT* aPort, TInt aNumSettings)
1.869 + {
1.870 + test.Start(_L("Test USB Descriptor Manipulation"));
1.871 +
1.872 + if (aHighSpeed)
1.873 + {
1.874 + TestDeviceQualifierDescriptor(aPort);
1.875 +
1.876 + TestOtherSpeedConfigurationDescriptor(aPort);
1.877 + }
1.878 +
1.879 + TestInterfaceDescriptor(aPort,aNumSettings);
1.880 +
1.881 + TestClassSpecificDescriptors(aPort);
1.882 +
1.883 + TestStandardStringDescriptors(aPort);
1.884 +
1.885 + TestArbitraryStringDescriptors(aPort,aNumSettings);
1.886 +
1.887 + test.End();
1.888 + }
1.889 +
1.890 +
1.891 +void TestOtgExtensions(RDEVCLIENT* aPort)
1.892 + {
1.893 + test.Start(_L("Test Some OTG API Extensions"));
1.894 +
1.895 + // Test OTG descriptor manipulation
1.896 + test.Next(_L("Get OTG Descriptor Size"));
1.897 + TInt size;
1.898 + aPort->GetOtgDescriptorSize(size);
1.899 + test_Equal(KUsbDescSize_Otg,static_cast<TUint>(size));
1.900 +
1.901 + test.Next(_L("Get OTG Descriptor"));
1.902 + TBuf8<KUsbDescSize_Otg> otgDesc;
1.903 + TInt r = aPort->GetOtgDescriptor(otgDesc);
1.904 + test(r == KErrNotSupported || r == KErrNone);
1.905 +
1.906 + test.Next(_L("Set OTG Descriptor"));
1.907 + TBool supportOtg = EFalse;
1.908 + if (r == KErrNotSupported)
1.909 + {
1.910 + r = aPort->SetOtgDescriptor(otgDesc);
1.911 + test_Equal(KErrNotSupported,r);
1.912 + }
1.913 + else
1.914 + {
1.915 + supportOtg = ETrue;
1.916 + otgDesc[0] = KUsbDescSize_Otg;
1.917 + otgDesc[1] = KUsbDescType_Otg;
1.918 + otgDesc[2] = KUsbOtgAttr_SrpSupp;
1.919 + r = aPort->SetOtgDescriptor(otgDesc);
1.920 + test_KErrNone(r);
1.921 + TBuf8<KUsbDescSize_Otg> desc;
1.922 + r = aPort->GetOtgDescriptor(desc);
1.923 + test_KErrNone(r);
1.924 + test_Equal(0,desc.Compare(otgDesc));
1.925 + }
1.926 +
1.927 + // Test get/set OTG feature
1.928 + test.Next(_L("Get OTG Features"));
1.929 + TUint8 features;
1.930 + r = aPort->GetOtgFeatures(features);
1.931 + if (supportOtg)
1.932 + {
1.933 + test_KErrNone(r);
1.934 + TBool b_HnpEnable = (features & KUsbOtgAttr_B_HnpEnable) ? ETrue : EFalse;
1.935 + TBool a_HnpSupport = (features & KUsbOtgAttr_A_HnpSupport) ? ETrue : EFalse;
1.936 + TBool a_AltHnpSupport = (features & KUsbOtgAttr_A_AltHnpSupport) ? ETrue : EFalse;
1.937 + test.Printf(_L("### OTG Features:\nB_HnpEnable(%d)\nA_HnpSupport(%d)\nA_Alt_HnpSupport(%d)\n"),
1.938 + b_HnpEnable, a_HnpSupport, a_AltHnpSupport);
1.939 + }
1.940 + else
1.941 + {
1.942 + test_Equal(KErrNotSupported,r);
1.943 + test.Printf(_L("GetOtgFeatures() not supported\n"));
1.944 + }
1.945 +
1.946 + test.End();
1.947 +}
1.948 +
1.949 +
1.950 +void TestEndpoint0MaxPacketSizes(RDEVCLIENT* aPort)
1.951 + {
1.952 + test.Start(_L("Test Endpoint0 MaxPacketSizes"));
1.953 +
1.954 + TUint32 sizes = aPort->EndpointZeroMaxPacketSizes();
1.955 + TInt r = KErrNone;
1.956 + TBool good;
1.957 + TInt mpsize = 0;
1.958 + for (TInt i = 0; i < 32; i++)
1.959 + {
1.960 + TUint bit = sizes & (1 << i);
1.961 + if (bit != 0)
1.962 + {
1.963 + switch (bit)
1.964 + {
1.965 + case KUsbEpSizeCont:
1.966 + good = EFalse;
1.967 + break;
1.968 + case KUsbEpSize8:
1.969 + mpsize = 8;
1.970 + good = ETrue;
1.971 + break;
1.972 + case KUsbEpSize16:
1.973 + mpsize = 16;
1.974 + good = ETrue;
1.975 + break;
1.976 + case KUsbEpSize32:
1.977 + mpsize = 32;
1.978 + good = ETrue;
1.979 + break;
1.980 + case KUsbEpSize64:
1.981 + mpsize = 64;
1.982 + good = ETrue;
1.983 + break;
1.984 + case KUsbEpSize128:
1.985 + case KUsbEpSize256:
1.986 + case KUsbEpSize512:
1.987 + case KUsbEpSize1023:
1.988 + default:
1.989 + good = EFalse;
1.990 + break;
1.991 + }
1.992 + if (good)
1.993 + {
1.994 + test.Printf(_L("Ep0 supports %d bytes MaxPacketSize\n"), mpsize);
1.995 + }
1.996 + else
1.997 + {
1.998 + test.Printf(_L("Bad Ep0 size: 0x%08x, failure will occur\n"), bit);
1.999 + r = KErrGeneral;
1.1000 + }
1.1001 + }
1.1002 + }
1.1003 + test_KErrNone(r);
1.1004 +
1.1005 + test.End();
1.1006 + }
1.1007 +
1.1008 +