|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #include "subcommands.h" |
|
24 #include "msmmserver.h" |
|
25 #include "msmmengine.h" |
|
26 #include "msmmnodebase.h" |
|
27 #include "handlerinterface.h" |
|
28 #include "msmm_internal_def.h" |
|
29 #include <usb/hostms/msmmpolicypluginbase.h> |
|
30 #include <usb/hostms/srverr.h> |
|
31 |
|
32 #include <usb/usblogger.h> |
|
33 |
|
34 #ifdef __FLOG_ACTIVE |
|
35 _LIT8(KLogComponent, "UsbHostMsmmServer"); |
|
36 #endif |
|
37 |
|
38 /** |
|
39 * TRegisterInterface member functions |
|
40 */ |
|
41 TRegisterInterface::TRegisterInterface(THostMsSubCommandParam aParam): |
|
42 TSubCommandBase(aParam), |
|
43 iDeviceNode(NULL), |
|
44 iInterfaceNode(NULL) |
|
45 { |
|
46 LOG_FUNC |
|
47 } |
|
48 |
|
49 void TRegisterInterface::DoExecuteL() |
|
50 { |
|
51 LOG_FUNC |
|
52 |
|
53 // Add new interface node into data engine |
|
54 iInterfaceNode = iServer.Engine().AddUsbMsInterfaceL(iEvent.iDeviceId, |
|
55 iEvent.iInterfaceNumber, iEvent.iInterfaceToken); |
|
56 |
|
57 iDeviceNode = iServer.Engine().SearchDevice(iEvent.iDeviceId); |
|
58 if (!iDeviceNode) |
|
59 { |
|
60 User::Leave(KErrArgument); |
|
61 } |
|
62 |
|
63 TUSBMSDeviceDescription& device = iDeviceNode->iDevice; |
|
64 |
|
65 iMsConfig.iInterfaceToken = iEvent.iInterfaceToken; |
|
66 iMsConfig.iInterfaceNumber = iEvent.iInterfaceNumber; |
|
67 iMsConfig.iVendorId = device.iVendorId; |
|
68 iMsConfig.iProductId = device.iProductId; |
|
69 iMsConfig.iBcdDevice = device.iBcdDevice; |
|
70 iMsConfig.iConfigurationNumber = device.iConfigurationNumber; |
|
71 iMsConfig.iSerialNumber.Copy(device.iSerialNumber); |
|
72 iMsConfig.iProtocolId = device.iProtocolId; |
|
73 iMsConfig.iTransportId = device.iTransportId; |
|
74 iMsConfig.iRemoteWakeup = device.iRemoteWakeup; |
|
75 iMsConfig.iIsOtgClient = device.iIsOtgClient; |
|
76 |
|
77 LOGTEXT2(_L8("\t iMsConfig.iProtocolId %d"), iMsConfig.iProtocolId); |
|
78 LOGTEXT2(_L8("\t iMsConfig.iTransportId %d"), iMsConfig.iTransportId); |
|
79 LOGTEXT2(_L8("\t iMsConfig.iRemoteWakeup %d"), iMsConfig.iRemoteWakeup); |
|
80 LOGTEXT2(_L8("\t iMsConfig.iIsOtgClient %d"), iMsConfig.iIsOtgClient); |
|
81 |
|
82 TSuspensionPolicy suspensionPolicy; |
|
83 iServer.PolicyPlugin()->GetSuspensionPolicy(suspensionPolicy); |
|
84 iMsConfig.iOtgSuspendTime = suspensionPolicy.iOtgSuspendTime; |
|
85 iMsConfig.iStatusPollingInterval = suspensionPolicy.iStatusPollingInterval; |
|
86 |
|
87 LOGTEXT2(_L8("\t iMsConfig.iStatusPollingInterval %d"), iMsConfig.iStatusPollingInterval); |
|
88 LOGTEXT2(_L8("\t iMsConfig.iOtgSuspendTime %d"), iMsConfig.iOtgSuspendTime); |
|
89 |
|
90 iHandler.Start(); |
|
91 iInterfaceNode->iUsbMsDevice.Add(iMsConfig, iHandler.Status()); |
|
92 } |
|
93 |
|
94 void TRegisterInterface::HandleError(THostMsErrData& aData, TInt aError) |
|
95 { |
|
96 LOG_FUNC |
|
97 |
|
98 switch (aError) |
|
99 { |
|
100 case KErrNoMemory: |
|
101 aData.iError = EHostMsErrOutOfMemory; |
|
102 break; |
|
103 case KErrAlreadyExists: |
|
104 case KErrArgument: |
|
105 aData.iError = EHostMsErrInvalidParameter; |
|
106 break; |
|
107 default: |
|
108 aData.iError = EHostMsErrGeneral; |
|
109 } |
|
110 aData.iE32Error = aError; |
|
111 if (iDeviceNode) |
|
112 { |
|
113 TUSBMSDeviceDescription& device = iDeviceNode->iDevice; |
|
114 aData.iManufacturerString.Copy(device.iManufacturerString); |
|
115 aData.iProductString.Copy(device.iProductString); |
|
116 aData.iDriveName = 0x0; |
|
117 } |
|
118 if (iInterfaceNode) |
|
119 { |
|
120 iServer.Engine().RemoveUsbMsNode(iInterfaceNode); |
|
121 iInterfaceNode = NULL; |
|
122 } |
|
123 } |
|
124 |
|
125 void TRegisterInterface::DoAsyncCmdCompleteL() |
|
126 { |
|
127 LOG_FUNC |
|
128 |
|
129 User::LeaveIfError(iHandler.Status().Int()); |
|
130 if(iInterfaceNode) |
|
131 { |
|
132 User::LeaveIfError( |
|
133 iInterfaceNode->iUsbMsDevice.GetNumLun(iMaxLogicalUnit)); |
|
134 } |
|
135 |
|
136 LOGTEXT2(_L8("\tGetNumLun %d"), iMaxLogicalUnit); |
|
137 |
|
138 iCreator.CreateSubCmdForRetrieveDriveLetterL(iMaxLogicalUnit); |
|
139 } |
|
140 |
|
141 void TRegisterInterface::DoCancelAsyncCmd() |
|
142 { |
|
143 LOG_FUNC |
|
144 |
|
145 if(iInterfaceNode) |
|
146 { |
|
147 iInterfaceNode->iUsbMsDevice.Remove(); |
|
148 iServer.Engine().RemoveUsbMsNode(iInterfaceNode); |
|
149 iInterfaceNode = NULL; |
|
150 } |
|
151 } |
|
152 |
|
153 /** |
|
154 * TRetrieveDriveLetter member functions |
|
155 */ |
|
156 |
|
157 TRetrieveDriveLetter::TRetrieveDriveLetter( |
|
158 THostMsSubCommandParam& aParameter, TInt aLuNumber): |
|
159 TSubCommandBase(aParameter), |
|
160 iLuNumber(aLuNumber), |
|
161 iDrive(0) |
|
162 { |
|
163 LOG_FUNC |
|
164 } |
|
165 |
|
166 void TRetrieveDriveLetter::DoExecuteL() |
|
167 { |
|
168 LOG_FUNC |
|
169 |
|
170 TUsbMsDevice* deviceEntry(NULL); |
|
171 deviceEntry = iServer.Engine().SearchDevice(iEvent.iDeviceId); |
|
172 if (!deviceEntry) |
|
173 { |
|
174 User::Leave(KErrArgument); |
|
175 } |
|
176 else |
|
177 { |
|
178 TUSBMSDeviceDescription& device = deviceEntry->iDevice; |
|
179 |
|
180 iRequestData.iBcdDevice = device.iBcdDevice; |
|
181 iRequestData.iConfigurationNumber = device.iConfigurationNumber; |
|
182 iRequestData.iInterfaceNumber = iEvent.iInterfaceNumber; |
|
183 iRequestData.iDeviceId = iEvent.iDeviceId; |
|
184 iRequestData.iProductId = device.iProductId; |
|
185 iRequestData.iVendorId = device.iVendorId; |
|
186 iRequestData.iLogicUnitNumber = iLuNumber; |
|
187 iRequestData.iOtgInformation = device.iOtgInformation; |
|
188 iRequestData.iManufacturerString = device.iManufacturerString; |
|
189 iRequestData.iProductString = device.iProductString; |
|
190 iRequestData.iSerialNumber = device.iSerialNumber; |
|
191 |
|
192 iHandler.Start(); |
|
193 TRequestStatus& status = iHandler.Status(); |
|
194 iServer.PolicyPlugin()->RetrieveDriveLetterL( |
|
195 iDrive, iRequestData, status); |
|
196 } |
|
197 } |
|
198 |
|
199 void TRetrieveDriveLetter::HandleError(THostMsErrData& aData, TInt aError) |
|
200 { |
|
201 LOG_FUNC |
|
202 |
|
203 switch (aError) |
|
204 { |
|
205 case KErrArgument: |
|
206 aData.iError = EHostMsErrInvalidParameter; |
|
207 break; |
|
208 case KErrNotFound: |
|
209 aData.iError = EHostMsErrNoDriveLetter; |
|
210 break; |
|
211 case KErrNoMemory: |
|
212 aData.iError = EHostMsErrOutOfMemory; |
|
213 break; |
|
214 default: |
|
215 aData.iError = EHostMsErrGeneral; |
|
216 } |
|
217 aData.iE32Error = aError; |
|
218 aData.iManufacturerString = iRequestData.iManufacturerString; |
|
219 aData.iProductString = iRequestData.iProductString; |
|
220 aData.iDriveName = iDrive; |
|
221 } |
|
222 |
|
223 void TRetrieveDriveLetter::DoAsyncCmdCompleteL() |
|
224 { |
|
225 LOG_FUNC |
|
226 |
|
227 User::LeaveIfError(iHandler.Status().Int()); |
|
228 |
|
229 iCreator.CreateSubCmdForMountingLogicalUnitL(iDrive, iLuNumber); |
|
230 } |
|
231 |
|
232 void TRetrieveDriveLetter::DoCancelAsyncCmd() |
|
233 { |
|
234 LOG_FUNC |
|
235 |
|
236 iServer.PolicyPlugin()->CancelRetrieveDriveLetter(); |
|
237 } |
|
238 |
|
239 /** |
|
240 * TMountLogicalUnit member functions |
|
241 */ |
|
242 |
|
243 TMountLogicalUnit::TMountLogicalUnit(THostMsSubCommandParam& aParameter, |
|
244 TText aDrive, TInt aLuNumber): |
|
245 TSubCommandBase(aParameter), |
|
246 iDrive(aDrive), |
|
247 iLuNumber(aLuNumber) |
|
248 { |
|
249 LOG_FUNC |
|
250 |
|
251 iIsKeyCommand = EFalse; |
|
252 } |
|
253 |
|
254 void TMountLogicalUnit::DoExecuteL() |
|
255 { |
|
256 LOG_FUNC |
|
257 TInt ret(KErrNone); |
|
258 RFs& fs = iServer.FileServerSession(); |
|
259 |
|
260 TInt driveNum; |
|
261 User::LeaveIfError(fs.CharToDrive(iDrive, driveNum)); |
|
262 |
|
263 TUsbMsDevice* device = NULL; |
|
264 TUsbMsInterface* interface = NULL; |
|
265 device = iServer.Engine().SearchDevice(iEvent.iDeviceId); |
|
266 if (!device) |
|
267 { |
|
268 User::Leave(KErrArgument); |
|
269 } |
|
270 interface = iServer.Engine().SearchInterface(device, iEvent.iInterfaceNumber); |
|
271 if (!interface) |
|
272 { |
|
273 User::Leave(KErrArgument); |
|
274 } |
|
275 |
|
276 ret = interface->iUsbMsDevice.MountLun(iLuNumber, driveNum); |
|
277 if ((KErrNone != ret) && (KErrAlreadyExists != ret) |
|
278 && (KErrNotReady != ret)) |
|
279 { |
|
280 User::Leave (ret); |
|
281 } |
|
282 |
|
283 iHandler.Start(); |
|
284 iHandler.Complete(); |
|
285 } |
|
286 |
|
287 void TMountLogicalUnit::HandleError(THostMsErrData& aData, TInt aError) |
|
288 { |
|
289 LOG_FUNC |
|
290 |
|
291 switch (aError) |
|
292 { |
|
293 case KErrNoMemory: |
|
294 aData.iError = EHostMsErrOutOfMemory; |
|
295 break; |
|
296 case KErrArgument: |
|
297 aData.iError = EHostMsErrInvalidParameter; |
|
298 break; |
|
299 case KErrCorrupt: |
|
300 { |
|
301 aData.iError = EHostMsErrUnknownFileSystem; |
|
302 |
|
303 // Current implementation of USB Mass Storage extension will mount |
|
304 // a logical unit successfully even the logical unit is in an |
|
305 // unsupported format like NTFS or CDFS. So we have to recode this |
|
306 // Logical unit down in the our data engine in order to dismount it |
|
307 // in future when the interface which presents this logical unit is |
|
308 // dettached. Reuse DoAsyncCmdCompleteL to do this. |
|
309 |
|
310 // Check if the new drive mounted successfully. |
|
311 RFs& fs = iServer.FileServerSession(); |
|
312 TInt driveNum; |
|
313 User::LeaveIfError(fs.CharToDrive(iDrive, driveNum)); |
|
314 |
|
315 TDriveList drives; |
|
316 User::LeaveIfError(fs.DriveList(drives)); |
|
317 |
|
318 if (drives[driveNum]) |
|
319 { |
|
320 // Drive name mounted |
|
321 DoAsyncCmdCompleteL(); |
|
322 |
|
323 // Restart the handler |
|
324 iHandler.Start(); |
|
325 } |
|
326 } |
|
327 break; |
|
328 default: |
|
329 aData.iError = EHostMsErrGeneral; |
|
330 } |
|
331 aData.iE32Error = aError; |
|
332 TUsbMsDevice* deviceNode = iServer.Engine().SearchDevice(iEvent.iDeviceId); |
|
333 if (deviceNode) |
|
334 { |
|
335 aData.iManufacturerString.Copy(deviceNode->iDevice.iManufacturerString); |
|
336 aData.iProductString.Copy(deviceNode->iDevice.iProductString); |
|
337 } |
|
338 aData.iDriveName = iDrive; |
|
339 } |
|
340 |
|
341 void TMountLogicalUnit::DoAsyncCmdCompleteL() |
|
342 { |
|
343 LOG_FUNC |
|
344 |
|
345 iServer.Engine().AddUsbMsLogicalUnitL( |
|
346 iEvent.iDeviceId, iEvent.iInterfaceNumber, |
|
347 iLuNumber, iDrive); |
|
348 iCreator.CreateSubCmdForSaveLatestMountInfoL(iDrive, iLuNumber); |
|
349 } |
|
350 |
|
351 /** |
|
352 * TSaveLatestMountInfo member functions |
|
353 */ |
|
354 |
|
355 TSaveLatestMountInfo::TSaveLatestMountInfo( |
|
356 THostMsSubCommandParam& aParameter, |
|
357 TText aDrive, TInt aLuNumber): |
|
358 TSubCommandBase(aParameter), |
|
359 iDrive(aDrive), |
|
360 iLuNumber(aLuNumber) |
|
361 { |
|
362 LOG_FUNC |
|
363 |
|
364 iIsKeyCommand = EFalse; |
|
365 } |
|
366 |
|
367 void TSaveLatestMountInfo::DoExecuteL() |
|
368 { |
|
369 LOG_FUNC |
|
370 |
|
371 TUsbMsDevice* deviceEntry(NULL); |
|
372 deviceEntry = iServer.Engine().SearchDevice(iEvent.iDeviceId); |
|
373 if (!deviceEntry) |
|
374 { |
|
375 User::Leave(KErrArgument); |
|
376 } |
|
377 else |
|
378 { |
|
379 TPolicyRequestData& request = iRecord.iLogicUnit; |
|
380 TUSBMSDeviceDescription& device = deviceEntry->iDevice; |
|
381 |
|
382 request.iBcdDevice = device.iBcdDevice; |
|
383 request.iConfigurationNumber = device.iConfigurationNumber; |
|
384 request.iInterfaceNumber = iEvent.iInterfaceNumber; |
|
385 request.iDeviceId = iEvent.iDeviceId; |
|
386 request.iProductId = device.iProductId; |
|
387 request.iVendorId = device.iVendorId; |
|
388 request.iLogicUnitNumber = iLuNumber; |
|
389 request.iOtgInformation = device.iOtgInformation; |
|
390 request.iManufacturerString = device.iManufacturerString; |
|
391 request.iProductString = device.iProductString; |
|
392 request.iSerialNumber = device.iSerialNumber; |
|
393 |
|
394 iRecord.iDriveName = iDrive; |
|
395 |
|
396 iHandler.Start(); |
|
397 TRequestStatus& status = iHandler.Status(); |
|
398 |
|
399 iServer.PolicyPlugin()->SaveLatestMountInfoL(iRecord, status); |
|
400 } |
|
401 } |
|
402 |
|
403 void TSaveLatestMountInfo::DoAsyncCmdCompleteL() |
|
404 { |
|
405 LOG_FUNC |
|
406 User::LeaveIfError(iHandler.Status().Int()); |
|
407 } |
|
408 |
|
409 void TSaveLatestMountInfo::HandleError(THostMsErrData& aData, TInt aError) |
|
410 { |
|
411 LOG_FUNC |
|
412 |
|
413 switch (aError) |
|
414 { |
|
415 case KErrNoMemory: |
|
416 aData.iError = EHostMsErrOutOfMemory; |
|
417 break; |
|
418 case KErrArgument: |
|
419 aData.iError = EHostMsErrInvalidParameter; |
|
420 break; |
|
421 default: |
|
422 aData.iError = EHostMsErrGeneral; |
|
423 } |
|
424 aData.iE32Error = aError; |
|
425 aData.iManufacturerString = iRecord.iLogicUnit.iManufacturerString; |
|
426 aData.iProductString = iRecord.iLogicUnit.iProductString; |
|
427 aData.iDriveName = iDrive; |
|
428 } |
|
429 |
|
430 void TSaveLatestMountInfo::DoCancelAsyncCmd() |
|
431 { |
|
432 LOG_FUNC |
|
433 |
|
434 iServer.PolicyPlugin()->CancelSaveLatestMountInfo(); |
|
435 } |
|
436 |
|
437 |
|
438 /** |
|
439 * TDeregisterInterface member functions |
|
440 */ |
|
441 |
|
442 TDeregisterInterface::TDeregisterInterface( |
|
443 THostMsSubCommandParam& aParameter, |
|
444 TUint8 aInterfaceNumber, TUint32 aInterfaceToken): |
|
445 TSubCommandBase(aParameter), |
|
446 iInterfaceNumber(aInterfaceNumber), |
|
447 iInterfaceToken(aInterfaceToken), |
|
448 iDeviceNode(NULL), |
|
449 iInterfaceNode(NULL) |
|
450 { |
|
451 LOG_FUNC |
|
452 } |
|
453 |
|
454 void TDeregisterInterface::DoExecuteL() |
|
455 { |
|
456 LOG_FUNC |
|
457 |
|
458 iDeviceNode = iServer.Engine().SearchDevice(iEvent.iDeviceId); |
|
459 if (!iDeviceNode) |
|
460 { |
|
461 User::Leave(KErrArgument); |
|
462 } |
|
463 |
|
464 iInterfaceNode = iServer.Engine().SearchInterface(iDeviceNode, |
|
465 iInterfaceNumber); |
|
466 if (!iInterfaceNode) |
|
467 { |
|
468 User::Leave(KErrArgument); |
|
469 } |
|
470 |
|
471 TUSBMSDeviceDescription& device = iDeviceNode->iDevice; |
|
472 |
|
473 iMsConfig.iInterfaceToken = iInterfaceToken; |
|
474 iMsConfig.iVendorId = device.iVendorId; |
|
475 iMsConfig.iProductId = device.iVendorId; |
|
476 iMsConfig.iBcdDevice = device.iBcdDevice; |
|
477 iMsConfig.iConfigurationNumber = device.iConfigurationNumber; |
|
478 iMsConfig.iInterfaceNumber = iInterfaceNumber; |
|
479 iMsConfig.iSerialNumber.Copy(device.iSerialNumber); |
|
480 iInterfaceNode->iUsbMsDevice.Remove(); |
|
481 |
|
482 // Activate the handler. |
|
483 iHandler.Start(); |
|
484 // Simulate a async request be completed. |
|
485 iHandler.Complete(); |
|
486 } |
|
487 |
|
488 void TDeregisterInterface::HandleError(THostMsErrData& aData, TInt aError) |
|
489 { |
|
490 LOG_FUNC |
|
491 |
|
492 switch (aError) |
|
493 { |
|
494 case KErrNoMemory: |
|
495 aData.iError = EHostMsErrOutOfMemory; |
|
496 break; |
|
497 case KErrArgument: |
|
498 aData.iError = EHostMsErrInvalidParameter; |
|
499 break; |
|
500 default: |
|
501 aData.iError = EHostMsErrGeneral; |
|
502 } |
|
503 aData.iE32Error = aError; |
|
504 if (iDeviceNode) |
|
505 { |
|
506 aData.iManufacturerString.Copy(iDeviceNode->iDevice.iManufacturerString); |
|
507 aData.iProductString.Copy(iDeviceNode->iDevice.iProductString); |
|
508 } |
|
509 aData.iDriveName = 0; |
|
510 } |
|
511 |
|
512 /** |
|
513 * TDismountLogicalUnit member functions |
|
514 */ |
|
515 |
|
516 TDismountLogicalUnit::TDismountLogicalUnit( |
|
517 THostMsSubCommandParam& aParameter, |
|
518 const TUsbMsLogicalUnit& aLogicalUnit): |
|
519 TSubCommandBase(aParameter), |
|
520 iLogicalUnit(aLogicalUnit) |
|
521 { |
|
522 LOG_FUNC |
|
523 } |
|
524 |
|
525 void TDismountLogicalUnit::DoExecuteL() |
|
526 { |
|
527 LOG_FUNC |
|
528 RFs& fs = iServer.FileServerSession(); |
|
529 TInt driveNum; |
|
530 fs.CharToDrive(iLogicalUnit.iDrive, driveNum); |
|
531 |
|
532 TUsbMsInterface* interface(NULL); |
|
533 interface = iLogicalUnit.Parent(); |
|
534 if (!interface) |
|
535 { |
|
536 User::Leave(KErrArgument); |
|
537 } |
|
538 User::LeaveIfError(interface->iUsbMsDevice.DismountLun(driveNum)); |
|
539 |
|
540 // Activate the handler. |
|
541 iHandler.Start(); |
|
542 // Simulate a async request be completed. |
|
543 iHandler.Complete(); |
|
544 } |
|
545 |
|
546 void TDismountLogicalUnit::HandleError(THostMsErrData& aData, TInt aError) |
|
547 { |
|
548 LOG_FUNC |
|
549 |
|
550 switch (aError) |
|
551 { |
|
552 case KErrNoMemory: |
|
553 aData.iError = EHostMsErrOutOfMemory; |
|
554 break; |
|
555 case KErrArgument: |
|
556 aData.iError = EHostMsErrInvalidParameter; |
|
557 break; |
|
558 default: |
|
559 aData.iError = EHostMsErrGeneral; |
|
560 } |
|
561 aData.iE32Error = aError; |
|
562 TUsbMsDevice* deviceNode = iServer.Engine().SearchDevice(iEvent.iDeviceId); |
|
563 if (deviceNode) |
|
564 { |
|
565 aData.iManufacturerString.Copy(deviceNode->iDevice.iManufacturerString); |
|
566 aData.iProductString.Copy(deviceNode->iDevice.iProductString); |
|
567 } |
|
568 aData.iDriveName = iLogicalUnit.iDrive; |
|
569 } |
|
570 |
|
571 /** |
|
572 * TRemoveUsbMsDeviceNode member functions |
|
573 */ |
|
574 |
|
575 TRemoveUsbMsDeviceNode::TRemoveUsbMsDeviceNode( |
|
576 THostMsSubCommandParam& aParameter, |
|
577 TMsmmNodeBase* aNodeToBeRemoved): |
|
578 TSubCommandBase(aParameter), |
|
579 iNodeToBeRemoved(aNodeToBeRemoved) |
|
580 { |
|
581 LOG_FUNC |
|
582 } |
|
583 |
|
584 void TRemoveUsbMsDeviceNode::DoExecuteL() |
|
585 { |
|
586 LOG_FUNC |
|
587 if(iNodeToBeRemoved) |
|
588 { |
|
589 iServer.Engine().RemoveUsbMsNode(iNodeToBeRemoved); |
|
590 iNodeToBeRemoved = NULL; |
|
591 } |
|
592 else |
|
593 { |
|
594 User::Leave(KErrArgument); |
|
595 } |
|
596 |
|
597 // Activate the handler. |
|
598 iHandler.Start(); |
|
599 // Simulate a async request be completed. |
|
600 iHandler.Complete(); |
|
601 } |
|
602 |
|
603 void TRemoveUsbMsDeviceNode::HandleError(THostMsErrData& aData, TInt aError) |
|
604 { |
|
605 LOG_FUNC |
|
606 switch (aError) |
|
607 { |
|
608 case KErrArgument: |
|
609 aData.iError = EHostMsErrInvalidParameter; |
|
610 break; |
|
611 default: |
|
612 aData.iError = EHostMsErrGeneral; |
|
613 } |
|
614 aData.iE32Error = aError; |
|
615 TUsbMsDevice* deviceNode = iServer.Engine().SearchDevice(iEvent.iDeviceId); |
|
616 if (deviceNode) |
|
617 { |
|
618 aData.iManufacturerString.Copy(deviceNode->iDevice.iManufacturerString); |
|
619 aData.iProductString.Copy(deviceNode->iDevice.iProductString); |
|
620 } |
|
621 aData.iDriveName = 0; |
|
622 } |
|
623 |
|
624 // End of file |