199 TInt CDevice::GetEndpointAddress(RUsbInterface& aUsbInterface, |
189 TInt CDevice::GetEndpointAddress(RUsbInterface& aUsbInterface, |
200 TInt aInterfaceSetting, |
190 TInt aInterfaceSetting, |
201 TUint8 aTransferType, |
191 TUint8 aTransferType, |
202 TUint8 aDirection, |
192 TUint8 aDirection, |
203 TInt& aEndpointAddress) const |
193 TInt& aEndpointAddress) const |
204 { |
194 { |
205 __MSFNSLOG |
195 // Get the interface descriptor |
206 |
196 RDebug::Print(_L("GetEndpointAddress : Getting the interface descriptor for this alternate setting")); |
207 // Get the interface descriptor |
197 |
208 RDebug::Print(_L("GetEndpointAddress : Getting the interface descriptor for this alternate setting")); |
198 TUsbInterfaceDescriptor alternateInterfaceDescriptor; |
209 |
199 TInt err = aUsbInterface.GetAlternateInterfaceDescriptor(aInterfaceSetting, alternateInterfaceDescriptor); |
210 TUsbInterfaceDescriptor alternateInterfaceDescriptor; |
200 |
211 TInt err = aUsbInterface.GetAlternateInterfaceDescriptor(aInterfaceSetting, alternateInterfaceDescriptor); |
201 if (err) |
212 |
202 { |
213 if (err) |
203 RDebug::Print(_L("GetEndpointAddress : <Error %d> Unable to get alternate interface (%d) descriptor"),err,aInterfaceSetting); |
214 { |
204 return err; |
215 RDebug::Print(_L("GetEndpointAddress : <Error %d> Unable to get alternate interface (%d) descriptor"),err,aInterfaceSetting); |
205 } |
216 return err; |
206 |
217 } |
207 // Parse the descriptor tree from the interface |
218 |
208 RDebug::Print(_L("Search the child descriptors for matching endpoint attributes")); |
219 // Parse the descriptor tree from the interface |
209 |
220 RDebug::Print(_L("Search the child descriptors for matching endpoint attributes")); |
210 TUsbGenericDescriptor* descriptor = alternateInterfaceDescriptor.iFirstChild; |
221 |
211 |
222 TUsbGenericDescriptor* descriptor = alternateInterfaceDescriptor.iFirstChild; |
212 while (descriptor) |
223 |
213 { |
224 while (descriptor) |
214 RDebug::Print(_L("GetEndpointAddress : Check descriptor type for endpoint")); |
225 { |
215 |
226 RDebug::Print(_L("GetEndpointAddress : Check descriptor type for endpoint")); |
216 // Cast the descriptor to an endpoint descriptor |
227 |
217 TUsbEndpointDescriptor* endpoint = TUsbEndpointDescriptor::Cast(descriptor); |
228 // Cast the descriptor to an endpoint descriptor |
218 |
229 TUsbEndpointDescriptor* endpoint = TUsbEndpointDescriptor::Cast(descriptor); |
219 if (endpoint) |
230 |
220 { |
231 if (endpoint) |
221 RDebug::Print(_L("GetEndpointAddress : Match attributes for transfer type")); |
232 { |
222 |
233 RDebug::Print(_L("GetEndpointAddress : Match attributes for transfer type")); |
223 if ( (endpoint->Attributes() & aTransferType) == aTransferType) |
234 |
224 { |
235 if ( (endpoint->Attributes() & aTransferType) == aTransferType) |
225 RDebug::Print(_L("GetEndpointAddress : Match attributes for endpoint direction")); |
236 { |
226 |
237 RDebug::Print(_L("GetEndpointAddress : Match attributes for endpoint direction")); |
227 if ( (endpoint->EndpointAddress() & 0x80) == aDirection) |
238 |
228 { |
239 if ( (endpoint->EndpointAddress() & 0x80) == aDirection) |
229 aEndpointAddress = endpoint->EndpointAddress(); |
240 { |
230 RDebug::Print(_L("GetEndpointAddress : Endpoint address found")); |
241 aEndpointAddress = endpoint->EndpointAddress(); |
231 return KErrNone; |
242 RDebug::Print(_L("GetEndpointAddress : Endpoint address found")); |
232 } |
243 return KErrNone; |
233 } |
244 } |
234 } |
245 } |
235 |
246 } |
236 descriptor = descriptor->iNextPeer; |
247 |
237 } |
248 descriptor = descriptor->iNextPeer; |
238 |
249 } |
239 // Unable to find the endpoint address |
250 |
240 RDebug::Print(_L("GetEndpointAddress : Unable to find endpoint address matching the specified attributes")); |
251 // Unable to find the endpoint address |
241 |
252 RDebug::Print(_L("GetEndpointAddress : Unable to find endpoint address matching the specified attributes")); |
242 return KErrNotFound; |
253 |
243 } |
254 return KErrNotFound; |
|
255 } |
|
256 |
244 |
257 |
245 |
258 TBool CDevice::IsDeviceMassStorage(const TUsbInterfaceDescriptor& aInterfaceDesc, |
246 TBool CDevice::IsDeviceMassStorage(const TUsbInterfaceDescriptor& aInterfaceDesc, |
259 const TUsbDeviceDescriptor& aDeviceDesc) const |
247 const TUsbDeviceDescriptor& aDeviceDesc) const |
260 { |
248 { |
261 __MSFNSLOG |
249 /* check the interface descriptor */ |
262 /* check the interface descriptor */ |
250 if(aInterfaceDesc.InterfaceClass() == 0x08 && |
263 if(aInterfaceDesc.InterfaceClass() == 0x08 && |
251 aInterfaceDesc.InterfaceSubClass() == 0x06 && |
264 aInterfaceDesc.InterfaceSubClass() == 0x06 && |
252 aInterfaceDesc.InterfaceProtocol() == 0x50) |
265 aInterfaceDesc.InterfaceProtocol() == 0x50) |
253 { |
266 { |
254 if(aDeviceDesc.DeviceClass() == 0x00 && |
267 if(aDeviceDesc.DeviceClass() == 0x00 && |
255 aDeviceDesc.DeviceSubClass() == 0x00 && |
268 aDeviceDesc.DeviceSubClass() == 0x00 && |
256 aDeviceDesc.DeviceProtocol() == 0x00) |
269 aDeviceDesc.DeviceProtocol() == 0x00) |
257 return ETrue; |
270 return ETrue; |
258 } |
271 } |
259 |
272 |
260 return EFalse; |
273 return EFalse; |
|
274 |
261 |
275 } |
262 } |
276 |
263 |
277 |
264 |
278 TLun CDevice::DriveMap(TDriveMap& aDriveMap) const |
265 TLun CDevice::DriveMap(TDriveMap& aDriveMap) const |
279 { |
266 { |
280 __MSFNSLOG |
|
281 TDriveNumber driveNumber; |
267 TDriveNumber driveNumber; |
282 RDebug::Printf("LuList.Count=%d", iLuList.Count()); |
268 RDebug::Printf("LuList.Count=%d", iLuList.Count()); |
283 for (TInt i = 0; i < iLuList.Count(); i++) |
269 for (TInt i = 0; i < iLuList.Count(); i++) |
284 { |
270 { |
285 driveNumber = iLuList[i]; |
271 driveNumber = iLuList[i]; |
466 : iDebug(EFalse) |
437 : iDebug(EFalse) |
467 { |
438 { |
468 } |
439 } |
469 |
440 |
470 void TUsbPrint::PrintTree(const TUsbGenericDescriptor& aDesc, TInt aDepth) |
441 void TUsbPrint::PrintTree(const TUsbGenericDescriptor& aDesc, TInt aDepth) |
471 { |
442 { |
472 if (!iDebug) |
443 if (!iDebug) |
473 { |
444 { |
474 return; |
445 return; |
475 } |
446 } |
476 |
447 |
477 TBuf<20> buf; |
448 TBuf<20> buf; |
478 for(TInt depth=aDepth;depth>=0;--depth) |
449 for(TInt depth=aDepth;depth>=0;--depth) |
479 { |
450 { |
480 buf.Append(_L(" ")); |
451 buf.Append(_L(" ")); |
481 } |
452 } |
482 if(aDesc.iRecognisedAndParsed == TUsbGenericDescriptor::ERecognised) |
453 if(aDesc.iRecognisedAndParsed == TUsbGenericDescriptor::ERecognised) |
483 { |
454 { |
484 RDebug::Print(_L("%S+0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType); |
455 RDebug::Print(_L("%S+0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType); |
485 } |
456 } |
486 else |
457 else |
487 { |
458 { |
488 RDebug::Print(_L("%S-0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType); |
459 RDebug::Print(_L("%S-0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType); |
489 } |
460 } |
490 HBufC* blob = HBufC::New(5*aDesc.iBlob.Length()); // 5* for " 0x" + 2*bytes for hex representation |
461 HBufC* blob = HBufC::New(5*aDesc.iBlob.Length()); // 5* for " 0x" + 2*bytes for hex representation |
491 if(blob) |
462 if(blob) |
492 { |
463 { |
493 for(TInt i=0;i<aDesc.iBlob.Length();++i) |
464 for(TInt i=0;i<aDesc.iBlob.Length();++i) |
494 { |
465 { |
495 blob->Des().AppendFormat(_L("0x%02x "), aDesc.iBlob[i]); |
466 blob->Des().AppendFormat(_L("0x%02x "), aDesc.iBlob[i]); |
496 } |
467 } |
497 RDebug::Print(_L("%S >%S"), &buf, blob); |
468 RDebug::Print(_L("%S >%S"), &buf, blob); |
498 delete blob; |
469 delete blob; |
499 } |
470 } |
500 if(aDesc.iFirstChild) |
471 if(aDesc.iFirstChild) |
501 { |
472 { |
502 RDebug::Print(_L("%S \\ "), &buf); |
473 RDebug::Print(_L("%S \\ "), &buf); |
503 PrintTree(*(aDesc.iFirstChild), aDepth+1); |
474 PrintTree(*(aDesc.iFirstChild), aDepth+1); |
504 RDebug::Print(_L("%S / "), &buf); |
475 RDebug::Print(_L("%S / "), &buf); |
505 } |
476 } |
506 if(aDesc.iNextPeer) |
477 if(aDesc.iNextPeer) |
507 { |
478 { |
508 PrintTree(*(aDesc.iNextPeer), aDepth); |
479 PrintTree(*(aDesc.iNextPeer), aDepth); |
509 } |
480 } |
510 } |
481 } |
511 |
482 |
512 |
483 |
513 static TUint16 gLangId = 0x0000; |
484 static TUint16 gLangId = 0x0000; |
514 |
485 |
515 void TUsbPrint::SetLanguageToPrintL(RUsbDevice& aDevice) |
486 void TUsbPrint::SetLanguageToPrintL(RUsbDevice& aDevice) |
516 { |
487 { |
517 if (!iDebug) return; |
488 if (!iDebug) return; |
518 |
489 |
519 // Try to set language to US Eng, otherwise take the first one listed. |
490 // Try to set language to US Eng, otherwise take the first one listed. |
520 if(gLangId == 0x0000) // Only make the request if not been made before. |
491 if(gLangId == 0x0000) // Only make the request if not been made before. |
521 { |
492 { |
522 // Get string descriptor 0. |
493 // Get string descriptor 0. |
523 TBuf8<256> stringBuf; |
494 TBuf8<256> stringBuf; |
524 TUsbStringDescriptor* stringDesc = NULL; |
495 TUsbStringDescriptor* stringDesc = NULL; |
525 User::LeaveIfError(aDevice.GetStringDescriptor(stringDesc, stringBuf, 0)); |
496 User::LeaveIfError(aDevice.GetStringDescriptor(stringDesc, stringBuf, 0)); |
526 CleanupStack::PushL(*stringDesc); |
497 CleanupStack::PushL(*stringDesc); |
527 |
498 |
528 // Search for US English |
499 // Search for US English |
529 TBool usEngLang = EFalse; |
500 TBool usEngLang = EFalse; |
530 TInt langId = 0; |
501 TInt langId = 0; |
531 TInt index = 0; |
502 TInt index = 0; |
532 const TUint16 KLangIdUsEng = 0x0409; |
503 const TUint16 KLangIdUsEng = 0x0409; |
533 while(!usEngLang && langId != KErrNotFound) |
504 while(!usEngLang && langId != KErrNotFound) |
534 { |
505 { |
535 langId = stringDesc->GetLangId(index); |
506 langId = stringDesc->GetLangId(index); |
536 usEngLang = (langId == KLangIdUsEng); |
507 usEngLang = (langId == KLangIdUsEng); |
537 index++; |
508 index++; |
538 } |
509 } |
539 |
510 |
540 // Set the language appropriately |
511 // Set the language appropriately |
541 if(usEngLang) |
512 if(usEngLang) |
542 { |
513 { |
543 gLangId = KLangIdUsEng; |
514 gLangId = KLangIdUsEng; |
544 } |
515 } |
545 else |
516 else |
546 { |
517 { |
547 gLangId = stringDesc->GetLangId(0); |
518 gLangId = stringDesc->GetLangId(0); |
548 } |
519 } |
549 |
520 |
550 CleanupStack::PopAndDestroy(); // stringDesc |
521 CleanupStack::PopAndDestroy(); // stringDesc |
551 } |
522 } |
552 } |
523 } |
553 |
524 |
554 |
525 |
555 void TUsbPrint::PrintStringFromIndex(const TDesC& aFormatString, |
526 void TUsbPrint::PrintStringFromIndex(const TDesC& aFormatString, |
556 TInt aIndex, |
527 TInt aIndex, |
557 RUsbDevice* aDevice) |
528 RUsbDevice* aDevice) |
558 { |
529 { |
559 if (!iDebug) return; |
530 if (!iDebug) return; |
560 |
531 |
561 // If we have no device handle, we cannot go and get any strings. |
532 // If we have no device handle, we cannot go and get any strings. |
562 // If we have index 0, this indicates we don't have a string for this entry. |
533 // If we have index 0, this indicates we don't have a string for this entry. |
563 if(aDevice && aIndex != 0) |
534 if(aDevice && aIndex != 0) |
564 { |
535 { |
565 TRAPD(err, SetLanguageToPrintL(*aDevice)); |
536 TRAPD(err, SetLanguageToPrintL(*aDevice)); |
566 if(err == KErrNone) |
537 if(err == KErrNone) |
567 { |
538 { |
568 TBuf8<255> stringBuf; |
539 TBuf8<255> stringBuf; |
569 TUsbStringDescriptor* stringDesc = NULL; |
540 TUsbStringDescriptor* stringDesc = NULL; |
570 err = aDevice->GetStringDescriptor(stringDesc, stringBuf, aIndex, gLangId); |
541 err = aDevice->GetStringDescriptor(stringDesc, stringBuf, aIndex, gLangId); |
571 if(err == KErrNone) |
542 if(err == KErrNone) |
572 { |
543 { |
573 TBuf<128> buf; |
544 TBuf<128> buf; |
574 stringDesc->StringData(buf); |
545 stringDesc->StringData(buf); |
575 RDebug::Print(aFormatString, &buf); |
546 RDebug::Print(aFormatString, &buf); |
576 stringDesc->DestroyTree(); |
547 stringDesc->DestroyTree(); |
577 } |
548 } |
578 delete stringDesc; |
549 delete stringDesc; |
579 } |
550 } |
580 else |
551 else |
581 { |
552 { |
582 RDebug::Print(_L("Error while Selecting Langauge %d\n"), err); |
553 RDebug::Print(_L("Error while Selecting Langauge %d\n"), err); |
583 } |
554 } |
584 } |
555 } |
585 } |
556 } |
586 |
557 |
587 |
558 |
588 void TUsbPrint::PrintDescriptor(const TUsbDeviceDescriptor& aDeviceDesc, |
559 void TUsbPrint::PrintDescriptor(const TUsbDeviceDescriptor& aDeviceDesc, |
589 TInt /*aVariant*/, |
560 TInt /*aVariant*/, |
590 RUsbDevice* aDevice) |
561 RUsbDevice* aDevice) |
591 { |
562 { |
592 if (!iDebug) return; |
563 if (!iDebug) return; |
593 |
564 |
594 RDebug::Print(_L("USBBcd = 0x%04x\n"), aDeviceDesc.USBBcd()); |
565 RDebug::Print(_L("USBBcd = 0x%04x\n"), aDeviceDesc.USBBcd()); |
595 RDebug::Print(_L("DeviceClass = 0x%02x\n"), aDeviceDesc.DeviceClass()); |
566 RDebug::Print(_L("DeviceClass = 0x%02x\n"), aDeviceDesc.DeviceClass()); |
596 RDebug::Print(_L("DeviceSubClass = 0x%02x\n"), aDeviceDesc.DeviceSubClass()); |
567 RDebug::Print(_L("DeviceSubClass = 0x%02x\n"), aDeviceDesc.DeviceSubClass()); |
597 RDebug::Print(_L("DeviceProtocol = 0x%02x\n"), aDeviceDesc.DeviceProtocol()); |
568 RDebug::Print(_L("DeviceProtocol = 0x%02x\n"), aDeviceDesc.DeviceProtocol()); |
598 RDebug::Print(_L("MaxPacketSize0 = 0x%02x\n"), aDeviceDesc.MaxPacketSize0()); |
569 RDebug::Print(_L("MaxPacketSize0 = 0x%02x\n"), aDeviceDesc.MaxPacketSize0()); |
599 RDebug::Print(_L("VendorId = 0x%04x\n"), aDeviceDesc.VendorId()); |
570 RDebug::Print(_L("VendorId = 0x%04x\n"), aDeviceDesc.VendorId()); |
600 RDebug::Print(_L("ProductId = 0x%04x\n"), aDeviceDesc.ProductId()); |
571 RDebug::Print(_L("ProductId = 0x%04x\n"), aDeviceDesc.ProductId()); |
601 RDebug::Print(_L("DeviceBcd = 0x%04x\n"), aDeviceDesc.DeviceBcd()); |
572 RDebug::Print(_L("DeviceBcd = 0x%04x\n"), aDeviceDesc.DeviceBcd()); |
602 RDebug::Print(_L("ManufacturerIndex = 0x%02x\n"), aDeviceDesc.ManufacturerIndex()); |
573 RDebug::Print(_L("ManufacturerIndex = 0x%02x\n"), aDeviceDesc.ManufacturerIndex()); |
603 PrintStringFromIndex(_L("ManufacturerString = %S\n"), aDeviceDesc.ManufacturerIndex(), aDevice); |
574 PrintStringFromIndex(_L("ManufacturerString = %S\n"), aDeviceDesc.ManufacturerIndex(), aDevice); |
604 RDebug::Print(_L("ProductIndex = 0x%02x\n"), aDeviceDesc.ProductIndex()); |
575 RDebug::Print(_L("ProductIndex = 0x%02x\n"), aDeviceDesc.ProductIndex()); |
605 PrintStringFromIndex(_L("ProductString = %S\n"), aDeviceDesc.ProductIndex(), aDevice); |
576 PrintStringFromIndex(_L("ProductString = %S\n"), aDeviceDesc.ProductIndex(), aDevice); |
606 RDebug::Print(_L("SerialNumberIndex = 0x%02x\n"), aDeviceDesc.SerialNumberIndex()); |
577 RDebug::Print(_L("SerialNumberIndex = 0x%02x\n"), aDeviceDesc.SerialNumberIndex()); |
607 PrintStringFromIndex(_L("SerialNumberString = %S\n"), aDeviceDesc.SerialNumberIndex(), aDevice); |
578 PrintStringFromIndex(_L("SerialNumberString = %S\n"), aDeviceDesc.SerialNumberIndex(), aDevice); |
608 RDebug::Print(_L("NumConfigurations = 0x%02x\n"), aDeviceDesc.NumConfigurations()); |
579 RDebug::Print(_L("NumConfigurations = 0x%02x\n"), aDeviceDesc.NumConfigurations()); |
609 } |
580 } |
610 |
581 |
611 |
582 |
612 void TUsbPrint::PrintDescriptor(const TUsbConfigurationDescriptor& aConfigDesc, |
583 void TUsbPrint::PrintDescriptor(const TUsbConfigurationDescriptor& aConfigDesc, |
613 TInt /*aVariant*/, |
584 TInt /*aVariant*/, |
614 RUsbDevice* aDevice) |
585 RUsbDevice* aDevice) |
615 { |
586 { |
616 if (!iDebug) return; |
587 if (!iDebug) return; |
617 RDebug::Print(_L("TotalLength = 0x%04x\n"), aConfigDesc.TotalLength()); |
588 RDebug::Print(_L("TotalLength = 0x%04x\n"), aConfigDesc.TotalLength()); |
618 RDebug::Print(_L("NumInterfaces = 0x%02x\n"), aConfigDesc.NumInterfaces()); |
589 RDebug::Print(_L("NumInterfaces = 0x%02x\n"), aConfigDesc.NumInterfaces()); |
619 RDebug::Print(_L("ConfigurationValue = 0x%02x\n"), aConfigDesc.ConfigurationValue()); |
590 RDebug::Print(_L("ConfigurationValue = 0x%02x\n"), aConfigDesc.ConfigurationValue()); |
620 RDebug::Print(_L("ConfigurationIndex = 0x%02x\n"), aConfigDesc.ConfigurationIndex()); |
591 RDebug::Print(_L("ConfigurationIndex = 0x%02x\n"), aConfigDesc.ConfigurationIndex()); |
621 PrintStringFromIndex(_L("ConfigurationString = %S\n"), aConfigDesc.ConfigurationIndex(), aDevice); |
592 PrintStringFromIndex(_L("ConfigurationString = %S\n"), aConfigDesc.ConfigurationIndex(), aDevice); |
622 RDebug::Print(_L("Attributes = 0x%02x\n"), aConfigDesc.Attributes()); |
593 RDebug::Print(_L("Attributes = 0x%02x\n"), aConfigDesc.Attributes()); |
623 RDebug::Print(_L("MaxPower = 0x%02x\n"), aConfigDesc.MaxPower()); |
594 RDebug::Print(_L("MaxPower = 0x%02x\n"), aConfigDesc.MaxPower()); |
624 } |
595 } |
625 |
596 |
626 |
597 |
627 void TUsbPrint::PrintDescriptor(const TUsbEndpointDescriptor& aEndpointDesc, |
598 void TUsbPrint::PrintDescriptor(const TUsbEndpointDescriptor& aEndpointDesc, |
628 TInt /*aVariant*/, |
599 TInt /*aVariant*/, |
629 RUsbDevice* /*aDevice*/) |
600 RUsbDevice* /*aDevice*/) |
630 { |
601 { |
631 if (!iDebug) return; |
602 if (!iDebug) return; |
632 RDebug::Print(_L("EndpointAddress = 0x%02x\n"), aEndpointDesc.EndpointAddress()); |
603 RDebug::Print(_L("EndpointAddress = 0x%02x\n"), aEndpointDesc.EndpointAddress()); |
633 RDebug::Print(_L("Attributes = 0x%02x\n"), aEndpointDesc.Attributes()); |
604 RDebug::Print(_L("Attributes = 0x%02x\n"), aEndpointDesc.Attributes()); |
634 RDebug::Print(_L("MaxPacketSize = 0x%04x\n"), aEndpointDesc.MaxPacketSize()); |
605 RDebug::Print(_L("MaxPacketSize = 0x%04x\n"), aEndpointDesc.MaxPacketSize()); |
635 RDebug::Print(_L("Interval = 0x%02x\n"), aEndpointDesc.Interval()); |
606 RDebug::Print(_L("Interval = 0x%02x\n"), aEndpointDesc.Interval()); |
636 } |
607 } |
637 |
608 |
638 |
609 |
639 void TUsbPrint::PrintDescriptor(const TUsbInterfaceDescriptor& aInterfaceDesc, |
610 void TUsbPrint::PrintDescriptor(const TUsbInterfaceDescriptor& aInterfaceDesc, |
640 TInt /*aVariant*/, |
611 TInt /*aVariant*/, |
641 RUsbDevice* /*aDevice*/) |
612 RUsbDevice* /*aDevice*/) |
642 { |
613 { |
643 if (!iDebug) return; |
614 if (!iDebug) return; |
644 RDebug::Print(_L("InterfaceNumber = 0x%02x\n"), aInterfaceDesc.InterfaceNumber()); |
615 RDebug::Print(_L("InterfaceNumber = 0x%02x\n"), aInterfaceDesc.InterfaceNumber()); |
645 RDebug::Print(_L("AlternateSetting = 0x%02x\n"), aInterfaceDesc.AlternateSetting()); |
616 RDebug::Print(_L("AlternateSetting = 0x%02x\n"), aInterfaceDesc.AlternateSetting()); |
646 RDebug::Print(_L("NumEndpoints = 0x%02x\n"), aInterfaceDesc.NumEndpoints()); |
617 RDebug::Print(_L("NumEndpoints = 0x%02x\n"), aInterfaceDesc.NumEndpoints()); |
647 RDebug::Print(_L("InterfaceClass = 0x%02x\n"), aInterfaceDesc.InterfaceClass()); |
618 RDebug::Print(_L("InterfaceClass = 0x%02x\n"), aInterfaceDesc.InterfaceClass()); |
648 RDebug::Print(_L("InterfaceSubClass = 0x%02x\n"), aInterfaceDesc.InterfaceSubClass()); |
619 RDebug::Print(_L("InterfaceSubClass = 0x%02x\n"), aInterfaceDesc.InterfaceSubClass()); |
649 RDebug::Print(_L("InterfaceProtocol = 0x%02x\n"), aInterfaceDesc.InterfaceProtocol()); |
620 RDebug::Print(_L("InterfaceProtocol = 0x%02x\n"), aInterfaceDesc.InterfaceProtocol()); |
650 RDebug::Print(_L("Interface = 0x%02x\n"), aInterfaceDesc.Interface()); |
621 RDebug::Print(_L("Interface = 0x%02x\n"), aInterfaceDesc.Interface()); |
651 } |
622 } |
652 |
623 |
653 |
624 |
654 void TUsbPrint::PrintDescriptor(const TUsbStringDescriptor& aStringDesc, |
625 void TUsbPrint::PrintDescriptor(const TUsbStringDescriptor& aStringDesc, |
655 TInt aVariant, |
626 TInt aVariant, |
656 RUsbDevice* /*aDevice*/) |
627 RUsbDevice* /*aDevice*/) |
657 { |
628 { |
658 if (!iDebug) return; |
629 if (!iDebug) return; |
659 if(aVariant == 0) |
630 if(aVariant == 0) |
660 { |
631 { |
661 RDebug::Print(_L("String Descriptor Zero\n")); |
632 RDebug::Print(_L("String Descriptor Zero\n")); |
662 TInt index = 0; |
633 TInt index = 0; |
663 TInt langId = 0; |
634 TInt langId = 0; |
664 while((langId = aStringDesc.GetLangId(index)) != KErrNotFound) |
635 while((langId = aStringDesc.GetLangId(index)) != KErrNotFound) |
665 { |
636 { |
666 RDebug::Print(_L(" >0x%04x\n"), langId); |
637 RDebug::Print(_L(" >0x%04x\n"), langId); |
667 ++index; |
638 ++index; |
668 } |
639 } |
669 } |
640 } |
670 else |
641 else |
671 { |
642 { |
672 RDebug::Print(_L("Generic String Descriptor\n")); |
643 RDebug::Print(_L("Generic String Descriptor\n")); |
673 HBufC16* string = HBufC16::New(128); |
644 HBufC16* string = HBufC16::New(128); |
674 if(string) |
645 if(string) |
675 { |
646 { |
676 TPtr16 stringPtr = string->Des(); |
647 TPtr16 stringPtr = string->Des(); |
677 aStringDesc.StringData(stringPtr); |
648 aStringDesc.StringData(stringPtr); |
678 RDebug::Print(_L(" >%S\n"), string); |
649 RDebug::Print(_L(" >%S\n"), string); |
679 } |
650 } |
680 delete string; |
651 delete string; |
681 } |
652 } |
682 } |
653 } |