19 |
19 |
20 /** |
20 /** |
21 @file |
21 @file |
22 */ |
22 */ |
23 |
23 |
24 #include "CUsbDevice.h" |
|
25 #include "CUsbDeviceStateWatcher.h" |
|
26 #include <cusbclasscontrolleriterator.h> |
24 #include <cusbclasscontrolleriterator.h> |
27 #include "MUsbDeviceNotify.h" |
|
28 #include "UsbSettings.h" |
|
29 #include "CUsbServer.h" |
|
30 #include <cusbclasscontrollerbase.h> |
25 #include <cusbclasscontrollerbase.h> |
31 #include <cusbclasscontrollerplugin.h> |
26 #include <cusbclasscontrollerplugin.h> |
32 #include "UsbUtils.h" |
|
33 #include <cusbmanextensionplugin.h> |
27 #include <cusbmanextensionplugin.h> |
34 |
|
35 #ifdef USE_DUMMY_CLASS_CONTROLLER |
|
36 #include "CUsbDummyClassController.h" |
|
37 #endif |
|
38 |
|
39 #include <bafl/sysutil.h> |
28 #include <bafl/sysutil.h> |
40 #include <usb/usblogger.h> |
29 #include <usb/usblogger.h> |
41 #include <e32svr.h> |
30 #include <e32svr.h> |
42 #include <e32base.h> |
31 #include <e32base.h> |
43 #include <e32std.h> |
32 #include <e32std.h> |
44 #include <usbman.rsg> |
|
45 #include <f32file.h> |
33 #include <f32file.h> |
46 #include <barsc.h> |
34 #include <barsc.h> |
47 #include <barsread.h> |
35 #include <barsread.h> |
48 #include <bautils.h> |
36 #include <bautils.h> |
49 #include <e32property.h> //Publish & Subscribe header |
37 #include <e32property.h> //Publish & Subscribe header |
|
38 #ifdef USE_DUMMY_CLASS_CONTROLLER |
|
39 #include "CUsbDummyClassController.h" |
|
40 #endif |
|
41 #include "MUsbDeviceNotify.h" |
|
42 #include "UsbSettings.h" |
|
43 #include "CUsbServer.h" |
|
44 #include "UsbUtils.h" |
|
45 #include "CUsbDevice.h" |
|
46 #include "CUsbDeviceStateWatcher.h" |
50 #include "CPersonality.h" |
47 #include "CPersonality.h" |
|
48 #include "usbmancenrepmanager.h" |
|
49 #include "usbmanprivatecrkeys.h" |
51 |
50 |
52 _LIT(KUsbLDDName, "eusbc"); //Name used in call to User::LoadLogicalDevice |
51 _LIT(KUsbLDDName, "eusbc"); //Name used in call to User::LoadLogicalDevice |
53 _LIT(KUsbLDDFreeName, "Usbc"); //Name used in call to User::FreeLogicalDevice |
52 _LIT(KUsbLDDFreeName, "Usbc"); //Name used in call to User::FreeLogicalDevice |
54 |
53 |
55 #ifdef __FLOG_ACTIVE |
54 #ifdef __FLOG_ACTIVE |
868 { |
876 { |
869 aDeviceDescriptor.iDeviceClass = KUsbDefaultDeviceClass; |
877 aDeviceDescriptor.iDeviceClass = KUsbDefaultDeviceClass; |
870 aDeviceDescriptor.iDeviceSubClass = KUsbDefaultDeviceSubClass; |
878 aDeviceDescriptor.iDeviceSubClass = KUsbDefaultDeviceSubClass; |
871 aDeviceDescriptor.iDeviceProtocol = KUsbDefaultDeviceProtocol; |
879 aDeviceDescriptor.iDeviceProtocol = KUsbDefaultDeviceProtocol; |
872 aDeviceDescriptor.iIdVendor = KUsbDefaultVendorId; |
880 aDeviceDescriptor.iIdVendor = KUsbDefaultVendorId; |
873 aDeviceDescriptor.iIdProduct = KUsbDefaultProductId; |
881 aDeviceDescriptor.iProductId = KUsbDefaultProductId; |
874 } |
882 } |
875 |
883 |
876 void CUsbDevice::SetUsbDeviceSettingsL(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor) |
884 void CUsbDevice::SetUsbDeviceSettingsFromPersonalityL(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor) |
877 /** |
885 /** |
878 * Configure the USB device, reading in the settings from a |
886 * Configure the USB device from the current personality. |
879 * resource file where possible. |
|
880 * |
887 * |
881 * @param aDeviceDescriptor The device descriptor for the USB device |
888 * @param aDeviceDescriptor The device descriptor for the USB device |
882 */ |
889 */ |
883 { |
890 { |
884 LOG_FUNC |
891 LOG_FUNC |
885 |
892 |
886 // First, use the default values |
893 // First, use the default values |
887 LOGTEXT(_L8("Setting default values for the configuration")); |
894 LOGTEXT(_L8("Setting default values for the configuration")); |
888 SetUsbDeviceSettingsDefaultsL(aDeviceDescriptor); |
895 SetUsbDeviceSettingsDefaultsL(aDeviceDescriptor); |
889 |
896 |
890 // Now try to get the configuration from the resource file |
897 // Now try to get the configuration from the current personality |
891 RFs fs; |
898 aDeviceDescriptor.iDeviceClass = iCurrentPersonality->DeviceClass(); |
892 LEAVEIFERRORL(fs.Connect()); |
899 aDeviceDescriptor.iDeviceSubClass = iCurrentPersonality->DeviceSubClass(); |
893 CleanupClosePushL(fs); |
900 aDeviceDescriptor.iDeviceProtocol = iCurrentPersonality->DeviceProtocol(); |
894 |
901 aDeviceDescriptor.iIdVendor = iDeviceConfiguration.iVendorId; |
895 RResourceFile resource; |
902 aDeviceDescriptor.iProductId = iCurrentPersonality->ProductId(); |
896 TRAPD(err, resource.OpenL(fs, KUsbManagerResource)); |
903 aDeviceDescriptor.iBcdDevice = iCurrentPersonality->BcdDevice(); |
897 LOGTEXT2(_L8("Opened resource file with error %d"), err); |
904 aDeviceDescriptor.iNumConfigurations = iCurrentPersonality->NumConfigurations(); |
898 |
905 |
899 if (err != KErrNone) |
906 |
900 { |
|
901 LOGTEXT(_L8("Unable to open resource file: using default settings")); |
|
902 CleanupStack::PopAndDestroy(&fs); |
|
903 return; |
|
904 } |
|
905 |
|
906 CleanupClosePushL(resource); |
|
907 |
|
908 resource.ConfirmSignatureL(KUsbManagerResourceVersion); |
|
909 |
|
910 HBufC8* id = resource.AllocReadLC(USB_CONFIG); |
|
911 |
|
912 // The format of the USB resource structure is: |
|
913 // |
|
914 // STRUCT usb_configuration |
|
915 // { |
|
916 // WORD vendorId = 0x0e22; |
|
917 // WORD productId = 0x000b; |
|
918 // WORD bcdDevice = 0x0000; |
|
919 // LTEXT manufacturer = "Symbian Ltd."; |
|
920 // LTEXT product = "Symbian OS"; |
|
921 // } |
|
922 // |
|
923 // Note that the resource must be read in this order! |
|
924 |
|
925 TResourceReader reader; |
|
926 reader.SetBuffer(id); |
|
927 |
|
928 aDeviceDescriptor.iIdVendor = static_cast<TUint16>(reader.ReadUint16()); |
|
929 aDeviceDescriptor.iIdProduct = static_cast<TUint16>(reader.ReadUint16()); |
|
930 aDeviceDescriptor.iBcdDevice = static_cast<TUint16>(reader.ReadUint16()); |
|
931 |
|
932 // Try to read device and manufacturer name from new SysUtil API |
|
933 TPtrC16 sysUtilModelName; |
|
934 TPtrC16 sysUtilManuName; |
|
935 |
|
936 // This method returns ownership. |
|
937 CDeviceTypeInformation* deviceInfo = SysUtil::GetDeviceTypeInfoL(); |
|
938 CleanupStack::PushL(deviceInfo); |
|
939 TInt gotSysUtilModelName = deviceInfo->GetModelName(sysUtilModelName); |
|
940 TInt gotSysUtilManuName = deviceInfo->GetManufacturerName(sysUtilManuName); |
|
941 |
|
942 TPtrC manufacturerString = reader.ReadTPtrC(); |
|
943 TPtrC productString = reader.ReadTPtrC(); |
|
944 |
|
945 // If we succesfully read the manufacturer or device name from SysUtil API |
|
946 // then set these results, otherwise use the values defined in resource file |
|
947 #ifndef __OVER_DUMMYUSBDI__ |
907 #ifndef __OVER_DUMMYUSBDI__ |
948 #ifndef __WINS__ |
908 #ifndef __WINS__ |
949 if (gotSysUtilManuName == KErrNone) |
909 LEAVEIFERRORL(iLdd.SetManufacturerStringDescriptor(*(iDeviceConfiguration.iManufacturerName))); |
950 { |
910 LEAVEIFERRORL(iLdd.SetProductStringDescriptor(*(iDeviceConfiguration.iProductName))); |
951 LEAVEIFERRORL(iLdd.SetManufacturerStringDescriptor(sysUtilManuName)); |
911 |
952 } |
|
953 else |
|
954 { |
|
955 LEAVEIFERRORL(iLdd.SetManufacturerStringDescriptor(manufacturerString)); |
|
956 } |
|
957 |
|
958 if (gotSysUtilModelName == KErrNone) |
|
959 { |
|
960 LEAVEIFERRORL(iLdd.SetProductStringDescriptor(sysUtilModelName)); |
|
961 } |
|
962 else |
|
963 { |
|
964 LEAVEIFERRORL(iLdd.SetProductStringDescriptor(productString)); |
|
965 } |
|
966 |
|
967 #endif |
|
968 #endif // __OVER_DUMMYUSBDI__ |
|
969 |
|
970 #ifdef __FLOG_ACTIVE |
|
971 PrintDescriptor(aDeviceDescriptor); |
|
972 TBuf8<KUsbStringDescStringMaxSize> narrowString; |
|
973 narrowString.Copy(manufacturerString); |
|
974 LOGTEXT2(_L8("Manufacturer is: '%S'"), &narrowString); |
|
975 narrowString.Copy(productString); |
|
976 LOGTEXT2(_L8("Product is: '%S'"), &narrowString); |
|
977 #endif // __FLOG_ACTIVE |
|
978 |
|
979 #ifndef __OVER_DUMMYUSBDI__ |
|
980 #ifndef __WINS__ |
|
981 //Read the published serial number. The key is the UID KUidUsbmanServer = 0x101FE1DB |
912 //Read the published serial number. The key is the UID KUidUsbmanServer = 0x101FE1DB |
982 TBuf16<KUsbStringDescStringMaxSize> serNum; |
913 TBuf16<KUsbStringDescStringMaxSize> serNum; |
983 TInt r = RProperty::Get(KUidSystemCategory,0x101FE1DB,serNum); |
914 TInt r = RProperty::Get(KUidSystemCategory,0x101FE1DB,serNum); |
984 if(r==KErrNone) |
915 if(r==KErrNone) |
985 { |
916 { |
1001 |
932 |
1002 #endif |
933 #endif |
1003 #endif // __OVER_DUMMYUSBDI__ |
934 #endif // __OVER_DUMMYUSBDI__ |
1004 |
935 |
1005 |
936 |
1006 CleanupStack::PopAndDestroy(4, &fs); // deviceInfo, id, resource, fs |
|
1007 } |
|
1008 |
|
1009 void CUsbDevice::SetUsbDeviceSettingsFromPersonalityL(CUsbDevice::TUsbDeviceDescriptor& aDeviceDescriptor) |
|
1010 /** |
|
1011 * Configure the USB device from the current personality. |
|
1012 * |
|
1013 * @param aDeviceDescriptor The device descriptor for the USB device |
|
1014 */ |
|
1015 { |
|
1016 LOG_FUNC |
|
1017 |
|
1018 // First, use the default values |
|
1019 LOGTEXT(_L8("Setting default values for the configuration")); |
|
1020 SetUsbDeviceSettingsDefaultsL(aDeviceDescriptor); |
|
1021 |
|
1022 // Now try to get the configuration from the current personality |
|
1023 const CUsbDevice::TUsbDeviceDescriptor& deviceDes = iCurrentPersonality->DeviceDescriptor(); |
|
1024 aDeviceDescriptor.iDeviceClass = deviceDes.iDeviceClass; |
|
1025 aDeviceDescriptor.iDeviceSubClass = deviceDes.iDeviceSubClass; |
|
1026 aDeviceDescriptor.iDeviceProtocol = deviceDes.iDeviceProtocol; |
|
1027 aDeviceDescriptor.iIdVendor = deviceDes.iIdVendor; |
|
1028 aDeviceDescriptor.iIdProduct = deviceDes.iIdProduct; |
|
1029 aDeviceDescriptor.iBcdDevice = deviceDes.iBcdDevice; |
|
1030 aDeviceDescriptor.iSerialNumber = deviceDes.iSerialNumber; |
|
1031 aDeviceDescriptor.iNumConfigurations = deviceDes.iNumConfigurations; |
|
1032 |
|
1033 #ifndef __OVER_DUMMYUSBDI__ |
|
1034 #ifndef __WINS__ |
|
1035 LEAVEIFERRORL(iLdd.SetManufacturerStringDescriptor(*(iCurrentPersonality->Manufacturer()))); |
|
1036 LEAVEIFERRORL(iLdd.SetProductStringDescriptor(*(iCurrentPersonality->Product()))); |
|
1037 |
|
1038 //Read the published serial number. The key is the UID KUidUsbmanServer = 0x101FE1DB |
|
1039 TBuf16<KUsbStringDescStringMaxSize> serNum; |
|
1040 TInt r = RProperty::Get(KUidSystemCategory,0x101FE1DB,serNum); |
|
1041 if(r==KErrNone) |
|
1042 { |
|
1043 #ifdef __FLOG_ACTIVE |
|
1044 TBuf8<KUsbStringDescStringMaxSize> narrowString; |
|
1045 narrowString.Copy(serNum); |
|
1046 LOGTEXT2(_L8("Setting published SerialNumber: %S"), &narrowString); |
|
1047 #endif // __FLOG_ACTIVE |
|
1048 //USB spec doesn't give any constraints on what constitutes a valid serial number. |
|
1049 //As long as it is a string descriptor it is valid. |
|
1050 LEAVEIFERRORL(iLdd.SetSerialNumberStringDescriptor(serNum)); |
|
1051 } |
|
1052 #ifdef __FLOG_ACTIVE |
|
1053 else |
|
1054 { |
|
1055 LOGTEXT(_L8("SerialNumber has not been published")); |
|
1056 } |
|
1057 #endif // __FLOG_ACTIVE |
|
1058 |
|
1059 #endif |
|
1060 #endif // __OVER_DUMMYUSBDI__ |
|
1061 |
|
1062 |
|
1063 #ifdef __FLOG_ACTIVE |
937 #ifdef __FLOG_ACTIVE |
1064 PrintDescriptor(aDeviceDescriptor); |
938 PrintDescriptor(aDeviceDescriptor); |
1065 |
939 |
1066 #ifndef __OVER_DUMMYUSBDI__ |
940 #ifndef __OVER_DUMMYUSBDI__ |
1067 #ifndef __WINS__ |
941 #ifndef __WINS__ |
1226 } |
1103 } |
1227 while (!input.Eos()); |
1104 while (!input.Eos()); |
1228 } |
1105 } |
1229 |
1106 |
1230 void CUsbDevice::ReadPersonalitiesL() |
1107 void CUsbDevice::ReadPersonalitiesL() |
1231 /** |
1108 { |
1232 * Reads configured personalities from the resource file |
1109 LOG_FUNC |
1233 */ |
1110 TPtrC16 sysUtilModelName; |
1234 { |
1111 TPtrC16 sysUtilManuName; |
1235 LOG_FUNC |
1112 |
1236 iPersonalityCfged = EFalse; |
1113 iPersonalityCfged = EFalse; |
1237 // Now try to connect to file server |
1114 |
1238 RFs fs; |
1115 iCenRepManager->ReadDeviceConfigurationL(iDeviceConfiguration); |
1239 LEAVEIFERRORL(fs.Connect()); |
1116 |
1240 CleanupClosePushL(fs); |
1117 iCenRepManager->ReadPersonalitiesL(iSupportedPersonalities); |
1241 |
1118 |
1242 TFileName resourceFileName; |
1119 //update info for SetManufacturer & SetProduct |
1243 ResourceFileNameL(resourceFileName); |
1120 CDeviceTypeInformation* deviceInfo = SysUtil::GetDeviceTypeInfoL(); |
1244 RResourceFile resource; |
1121 CleanupStack::PushL(deviceInfo); |
1245 TRAPD(err, resource.OpenL(fs, resourceFileName)); |
1122 TInt gotSysUtilModelName = deviceInfo->GetModelName(sysUtilModelName); |
1246 LOGTEXT2(_L8("Opened resource file with error %d"), err); |
1123 TInt gotSysUtilManuName = deviceInfo->GetManufacturerName(sysUtilManuName); |
1247 |
1124 |
1248 if (err != KErrNone) |
1125 //To overlap info |
1249 { |
1126 if (gotSysUtilManuName == KErrNone) |
1250 LOGTEXT(_L8("Unable to open resource file")); |
1127 { |
1251 CleanupStack::PopAndDestroy(&fs); |
1128 iDeviceConfiguration.iManufacturerName->Des().Copy(sysUtilManuName); |
1252 return; |
1129 } |
1253 } |
1130 |
1254 |
1131 if (gotSysUtilModelName == KErrNone) |
1255 CleanupClosePushL(resource); |
1132 { |
1256 |
1133 iDeviceConfiguration.iProductName->Des().Copy(sysUtilModelName); |
1257 TInt resourceVersion = resource.SignatureL(); |
1134 } |
1258 LOGTEXT2(_L8("Resource file signature is %d"), resourceVersion); |
1135 CleanupStack::PopAndDestroy(deviceInfo); |
1259 // Check for the version is valid(EUsbManagerResourceVersionOne, EUsbManagerResourceVersionTwo |
1136 iPersonalityCfged = ETrue; |
1260 // or EUsbManagerResourceVersionThree). |
1137 } |
1261 if(resourceVersion > EUsbManagerResourceVersionThree) |
|
1262 { |
|
1263 LOGTEXT2(_L8("Version of resource file is valid (>%d)"), EUsbManagerResourceVersionThree); |
|
1264 User::LeaveIfError(KErrNotSupported); |
|
1265 } |
|
1266 |
|
1267 resource.ConfirmSignatureL(resourceVersion); |
|
1268 |
|
1269 HBufC8* personalityBuf = 0; |
|
1270 TRAPD(ret, personalityBuf = resource.AllocReadL(DEVICE_PERSONALITIES)); |
|
1271 // If personalities resource is not found, swallow the error and return |
|
1272 // as no specified personalities is a valid configuration |
|
1273 if (ret == KErrNotFound) |
|
1274 { |
|
1275 LOGTEXT(_L8("Personalities are not configured")); |
|
1276 CleanupStack::PopAndDestroy(2, &fs); |
|
1277 return; |
|
1278 } |
|
1279 // Otherwise leave noisily if the AllocRead fails |
|
1280 LEAVEIFERRORL(ret); |
|
1281 CleanupStack::PushL(personalityBuf); |
|
1282 |
|
1283 // The format of the USB resource structure is: |
|
1284 // |
|
1285 // STRUCT PERSONALITY |
|
1286 // { |
|
1287 // WORD bcdDeviceClass; |
|
1288 // WORD bcdDeviceSubClass; |
|
1289 // WORD protocol; |
|
1290 // WORD numConfigurations; |
|
1291 // WORD vendorId; |
|
1292 // WORD productId; |
|
1293 // WORD bcdDevice; |
|
1294 // LTEXT manufacturer; |
|
1295 // LTEXT product; |
|
1296 // WORD id; // personality id |
|
1297 // LTEXT class_uids; |
|
1298 // LTEXT description; // personality description |
|
1299 // LTEXT detailedDescription; //detailed description. This is in version 2 |
|
1300 // LONG Property; |
|
1301 // } |
|
1302 // |
|
1303 // Note that the resource must be read in this order! |
|
1304 |
|
1305 TResourceReader reader; |
|
1306 reader.SetBuffer(personalityBuf); |
|
1307 |
|
1308 TUint16 personalityCount = static_cast<TUint16>(reader.ReadUint16()); |
|
1309 |
|
1310 // Read the manufacturer and device name (product) here from SysUtil class |
|
1311 TPtrC16 sysUtilModelName; |
|
1312 TPtrC16 sysUtilManuName; |
|
1313 |
|
1314 // This method returns ownership. |
|
1315 CDeviceTypeInformation* deviceInfo = SysUtil::GetDeviceTypeInfoL(); |
|
1316 CleanupStack::PushL(deviceInfo); |
|
1317 TInt gotSysUtilModelName = deviceInfo->GetModelName(sysUtilModelName); |
|
1318 TInt gotSysUtilManuName = deviceInfo->GetManufacturerName(sysUtilManuName); |
|
1319 |
|
1320 for (TInt idx = 0; idx < personalityCount; idx++) |
|
1321 { |
|
1322 // read a personality |
|
1323 TUint8 bDeviceClass = static_cast<TUint8>(reader.ReadUint8()); |
|
1324 TUint8 bDeviceSubClass = static_cast<TUint8>(reader.ReadUint8()); |
|
1325 TUint8 protocol = static_cast<TUint8>(reader.ReadUint8()); |
|
1326 TUint8 numConfigurations = static_cast<TUint8>(reader.ReadUint8()); |
|
1327 TUint16 vendorId = static_cast<TUint16>(reader.ReadUint16()); |
|
1328 TUint16 productId = static_cast<TUint16>(reader.ReadUint16()); |
|
1329 TUint16 bcdDevice = static_cast<TUint16>(reader.ReadUint16()); |
|
1330 TPtrC manufacturer = reader.ReadTPtrC(); |
|
1331 TPtrC product = reader.ReadTPtrC(); |
|
1332 TUint16 id = static_cast<TUint16>(reader.ReadUint16()); |
|
1333 TPtrC uidsStr = reader.ReadTPtrC(); |
|
1334 TPtrC description = reader.ReadTPtrC(); |
|
1335 |
|
1336 RArray<TUint> uids; |
|
1337 CleanupClosePushL(uids); |
|
1338 ConvertUidsL(uidsStr, uids); |
|
1339 // creates a CPersonality object |
|
1340 CPersonality* personality = CPersonality::NewL(); |
|
1341 CleanupStack::PushL(personality); |
|
1342 |
|
1343 personality->SetVersion(resourceVersion); |
|
1344 |
|
1345 // populates personality object |
|
1346 personality->SetId(id); |
|
1347 |
|
1348 for (TInt uidIdx = 0; uidIdx < uids.Count(); uidIdx++) |
|
1349 { |
|
1350 LEAVEIFERRORL(personality->AddSupportedClasses(TUid::Uid(uids[uidIdx]))); |
|
1351 } |
|
1352 |
|
1353 // gets a handle to iDeviceDescriptor of personality |
|
1354 CUsbDevice::TUsbDeviceDescriptor& dvceDes = personality->DeviceDescriptor(); |
|
1355 if (gotSysUtilManuName == KErrNone) |
|
1356 { |
|
1357 personality->SetManufacturer(&sysUtilManuName); |
|
1358 } |
|
1359 else |
|
1360 { |
|
1361 personality->SetManufacturer(&manufacturer); |
|
1362 } |
|
1363 |
|
1364 if (gotSysUtilModelName == KErrNone) |
|
1365 { |
|
1366 personality->SetProduct(&sysUtilModelName); |
|
1367 } |
|
1368 else |
|
1369 { |
|
1370 personality->SetProduct(&product); |
|
1371 } |
|
1372 |
|
1373 personality->SetDescription(&description); |
|
1374 dvceDes.iDeviceClass = bDeviceClass; |
|
1375 dvceDes.iDeviceSubClass = bDeviceSubClass; |
|
1376 dvceDes.iDeviceProtocol = protocol; |
|
1377 dvceDes.iIdVendor = vendorId; |
|
1378 dvceDes.iIdProduct= productId; |
|
1379 dvceDes.iBcdDevice = bcdDevice; |
|
1380 dvceDes.iNumConfigurations = numConfigurations; |
|
1381 |
|
1382 //detailedDescription is only supported after EUsbManagerResourceVersionTwo |
|
1383 if(resourceVersion >= EUsbManagerResourceVersionTwo) |
|
1384 { |
|
1385 TPtrC detailedDescription = reader.ReadTPtrC(); |
|
1386 personality->SetDetailedDescription(&detailedDescription); |
|
1387 #ifdef __FLOG_ACTIVE |
|
1388 TBuf8<KUsbDescMaxSize_String> narrowLongBuf; |
|
1389 narrowLongBuf.Copy(detailedDescription); |
|
1390 LOGTEXT2(_L8("detailed description = '%S'"), &narrowLongBuf); |
|
1391 #endif // __FLOG_ACTIVE |
|
1392 } |
|
1393 |
|
1394 //Property is only supported after EUsbManagerResourceVersionThree |
|
1395 if(resourceVersion >= EUsbManagerResourceVersionThree) |
|
1396 { |
|
1397 TUint32 property = static_cast<TUint32>(reader.ReadUint32()); |
|
1398 personality->SetProperty(property); |
|
1399 #ifdef __FLOG_ACTIVE |
|
1400 LOGTEXT2(_L8("property = %d\n"), property); |
|
1401 #endif // __FLOG_ACTIVE |
|
1402 } |
|
1403 |
|
1404 // Append personality to iSupportedPersonalities |
|
1405 iSupportedPersonalities.AppendL(personality); |
|
1406 // Now pop off personality |
|
1407 CleanupStack::Pop(personality); |
|
1408 #ifdef __FLOG_ACTIVE |
|
1409 // Debugging |
|
1410 LOGTEXT2(_L8("personalityCount = %d\n"), personalityCount); |
|
1411 LOGTEXT2(_L8("bDeviceClass = %d\n"), bDeviceClass); |
|
1412 LOGTEXT2(_L8("bDeviceSubClass = %d\n"), bDeviceSubClass); |
|
1413 LOGTEXT2(_L8("protocol = %d\n"), protocol); |
|
1414 LOGTEXT2(_L8("numConfigurations = %d\n"), numConfigurations); |
|
1415 LOGTEXT2(_L8("vendorId = %d\n"), vendorId); |
|
1416 LOGTEXT2(_L8("productId = %d\n"), productId); |
|
1417 LOGTEXT2(_L8("bcdDevice = %d\n"), bcdDevice); |
|
1418 TBuf8<KMaxName> narrowBuf; |
|
1419 narrowBuf.Copy(manufacturer); |
|
1420 LOGTEXT2(_L8("manufacturer = '%S'"), &narrowBuf); |
|
1421 narrowBuf.Copy(product); |
|
1422 LOGTEXT2(_L8("product = '%S'"), &narrowBuf); |
|
1423 LOGTEXT2(_L8("id = %d\n"), id); |
|
1424 LOGTEXT(_L8("ClassUids{")); |
|
1425 for (TInt k = 0; k < uids.Count(); k++) |
|
1426 { |
|
1427 LOGTEXT2(_L8("%d"), uids[k]); |
|
1428 } |
|
1429 LOGTEXT(_L8("}")); |
|
1430 narrowBuf.Copy(description); |
|
1431 LOGTEXT2(_L8("description = '%S'"), &narrowBuf); |
|
1432 #endif // __FLOG_ACTIVE |
|
1433 CleanupStack::PopAndDestroy(&uids); // close uid array |
|
1434 } |
|
1435 |
|
1436 CleanupStack::PopAndDestroy(4, &fs); // deviceInfo, personalityBuf, resource, fs |
|
1437 iPersonalityCfged = ETrue; |
|
1438 } |
|
1439 |
1138 |
1440 void CUsbDevice::SelectClassControllersL() |
1139 void CUsbDevice::SelectClassControllersL() |
1441 /** |
1140 /** |
1442 * Selects class controllers for the current personality |
1141 * Selects class controllers for the current personality |
1443 */ |
1142 */ |
1444 { |
1143 { |
1445 LOG_FUNC |
1144 LOG_FUNC |
1446 |
1145 const RArray<CPersonalityConfigurations::TUsbClasses>& classes = iCurrentPersonality->SupportedClasses(); |
1447 CreateClassControllersL(iCurrentPersonality->SupportedClasses()); |
1146 RArray<TUid> classUids; |
|
1147 CleanupClosePushL( classUids ); |
|
1148 TInt classCount = classes.Count(); |
|
1149 for(TInt classIndex = 0; classIndex<classCount; ++classIndex) |
|
1150 { |
|
1151 TUid uid = classes[classIndex].iClassUid; |
|
1152 classUids.AppendL(uid); |
|
1153 } |
|
1154 |
|
1155 CreateClassControllersL(classUids); |
|
1156 |
|
1157 CleanupStack::PopAndDestroy( &classUids ); |
1448 } |
1158 } |
1449 #ifdef USE_DUMMY_CLASS_CONTROLLER |
1159 #ifdef USE_DUMMY_CLASS_CONTROLLER |
1450 void CUsbDevice::CreateClassControllersL(const RArray<TUid>& /* aClassUids*/) |
1160 void CUsbDevice::CreateClassControllersL(const RArray<TUid>& /* aClassUids*/) |
1451 #else |
1161 #else |
1452 void CUsbDevice::CreateClassControllersL(const RArray<TUid>& aClassUids) |
1162 void CUsbDevice::CreateClassControllersL(const RArray<TUid>& aClassUids) |