16 |
16 |
17 #include <barsc.h> |
17 #include <barsc.h> |
18 #include <barsread.h> |
18 #include <barsread.h> |
19 #include <usb_std.h> |
19 #include <usb_std.h> |
20 #include <cusbclasscontrollerplugin.h> |
20 #include <cusbclasscontrollerplugin.h> |
|
21 #include <centralrepository.h> |
21 #include <usbms.rsg> |
22 #include <usbms.rsg> |
22 #include <usbmscfileresource.rsg> |
|
23 #include <data_caging_path_literals.hrh> |
23 #include <data_caging_path_literals.hrh> |
24 #include "usbmscfileclasscontroller.h" |
24 #include "usbmscfileclasscontroller.h" |
25 #include "usbmscfile.h" |
25 #include "usbmscfile.h" |
|
26 #include "usbmscfileclasscontroller_crkeys.h" |
26 #include "debug.h" |
27 #include "debug.h" |
27 |
28 |
28 // Panic category |
29 // Panic category |
29 #ifdef _DEBUG |
30 #ifdef _DEBUG |
30 _LIT( KMsCcPanicCategory, "UsbMscFileCc" ); |
31 _LIT( KMsCcPanicCategory, "UsbMscFileCc" ); |
31 #endif |
32 #endif |
32 |
33 |
33 _LIT( KResourceFileName, "usbmscfileresource.rsc" ); |
|
34 _LIT( KUsbMsResource, "\\private\\101fe1db\\usbms.rsc" ); |
34 _LIT( KUsbMsResource, "\\private\\101fe1db\\usbms.rsc" ); |
35 |
35 |
36 /** |
36 /** |
37 Panic codes for the USB MSC File Class Controller. |
37 Panic codes for the USB MSC File Class Controller. |
38 */ |
38 */ |
395 RFs fs; |
395 RFs fs; |
396 RUsbMscFile mscFile; |
396 RUsbMscFile mscFile; |
397 |
397 |
398 LEAVE_IF_ERROR( mscFile.Connect() ); |
398 LEAVE_IF_ERROR( mscFile.Connect() ); |
399 CleanupClosePushL( mscFile ); |
399 CleanupClosePushL( mscFile ); |
400 LEAVE_IF_ERROR( fs.Connect() ); |
400 CRepository* repository = CRepository::NewLC(KCRUidUsbPhoneAsModemMscFileClassController); |
401 CleanupClosePushL( fs ); |
|
402 |
|
403 TFileName fileName; |
|
404 const TDriveNumber KStoreDrive = EDriveZ; |
|
405 TDriveUnit driveUnit( KStoreDrive ); |
|
406 TDriveName drive = driveUnit.Name(); |
|
407 fileName.Insert( 0, drive ); |
|
408 |
|
409 fileName += KDC_APP_RESOURCE_DIR; // From data_caging_path_literals.hrh |
|
410 fileName += KResourceFileName; |
|
411 |
|
412 RResourceFile resourceFile; |
|
413 CleanupClosePushL( resourceFile ); |
|
414 resourceFile.OpenL( fs, fileName ); |
|
415 resourceFile.ConfirmSignatureL(); |
|
416 |
|
417 HBufC8* buf8 = resourceFile.AllocReadLC( R_USBMSCFILE_IMAGE_PATHS ); |
|
418 |
401 |
419 TResourceReader reader; |
402 RArray<TUint32> lunKeys; |
420 reader.SetBuffer( buf8 ); |
403 CleanupClosePushL(lunKeys); |
421 |
404 |
422 TInt count = reader.ReadInt16(); |
405 repository->FindL(KCRMscFileLogicalUnitNumberColumn, KCRMscFileColumnMask, lunKeys); |
423 |
406 |
424 while ( count-- ) |
407 |
425 { |
408 TInt count = lunKeys.Count(); |
426 TInt protocol = reader.ReadUint16(); |
409 for (TInt i=0; i<count; i++) |
427 TInt lun = reader.ReadUint16(); |
410 { |
428 HBufC* path = reader.ReadHBufCL(); |
411 TUint32 lunKey = lunKeys[i]; |
429 CleanupStack::PushL( path ); |
412 TUint32 fullNameKey = ((lunKey&KCRMscFileRowMask)|KCRMscFileImageFullNameColumn); |
430 LEAVE_IF_ERROR( mscFile.SetupLogicalUnit( *path, protocol, lun ) ); |
413 TRACE_INFO( (_L( "lunKey=%d,fullNameKey=%d" ), lunKey, fullNameKey) ) |
431 CleanupStack::PopAndDestroy( path ); |
414 |
432 } |
415 TInt lun = 0; |
433 CleanupStack::PopAndDestroy( 4 ); // mscFile, fs, resourceFile, buf8 |
416 LEAVE_IF_ERROR(repository->Get(lunKey, lun)); |
|
417 |
|
418 TFileName fullName; |
|
419 LEAVE_IF_ERROR(repository->Get(fullNameKey, fullName)); |
|
420 |
|
421 TRACE_INFO( (_L("lun=%d, fullName=%S"), lun, &fullName) ); |
|
422 |
|
423 TInt protocol = 0; // It is not used. Bulk Transport(0x50), SCSI transparent command Set(0x06), PDT CD/DVD device(0x05) is supported only. |
|
424 |
|
425 LEAVE_IF_ERROR(mscFile.SetupLogicalUnit( fullName, protocol, lun )); |
|
426 } |
|
427 CleanupStack::PopAndDestroy( 3 ); // mscFile, repository, lunKeys |
434 } |
428 } |