userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevice.cpp
equal
deleted
inserted
replaced
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of the License "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
150 |
150 |
151 |
151 |
152 void CUsbHostMsDevice::InitLunL(TLun aLun) |
152 void CUsbHostMsDevice::InitLunL(TLun aLun) |
153 { |
153 { |
154 __MSFNLOG |
154 __MSFNLOG |
155 SetLunL(aLun); |
155 CUsbHostMsLogicalUnit& lu = SetLunL(aLun); |
156 iLuList.GetLuL(aLun).InitL(); |
156 lu.InitL(); |
157 } |
157 } |
158 |
158 |
159 |
159 |
160 void CUsbHostMsDevice::SuspendLunL(TLun aLun) |
160 void CUsbHostMsDevice::SuspendLunL(TLun aLun) |
161 { |
161 { |
172 } |
172 } |
173 |
173 |
174 for (TInt i = 0; i < iLuList.Count(); i++) |
174 for (TInt i = 0; i < iLuList.Count(); i++) |
175 { |
175 { |
176 CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i); |
176 CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i); |
177 SetLunL(lu.Lun()); |
177 SetLunL(lu); |
178 lu.SuspendL(); |
178 lu.SuspendL(); |
179 } |
179 } |
180 |
180 |
181 StopTimer(); |
181 StopTimer(); |
182 iDeviceSuspendResume->Suspend(); |
182 iDeviceSuspendResume->Suspend(); |
215 CUsbHostMsLogicalUnit& CUsbHostMsDevice::GetLuL(TInt aLunNum) const |
215 CUsbHostMsLogicalUnit& CUsbHostMsDevice::GetLuL(TInt aLunNum) const |
216 { |
216 { |
217 return iLuList.GetLuL(aLunNum); |
217 return iLuList.GetLuL(aLunNum); |
218 } |
218 } |
219 |
219 |
220 void CUsbHostMsDevice::SetLunL(TLun aLun) |
220 |
221 { |
221 void CUsbHostMsDevice::SetLunL(CUsbHostMsLogicalUnit& aLu) |
222 __MSFNLOG |
222 { |
223 if (aLun <= iMaxLun) |
223 __MSFNLOG |
224 { |
224 TLun lun = aLu.Lun(); |
225 __HOSTPRINT1(_L("SetLun %d"), aLun); |
225 if (lun <= iMaxLun) |
226 iTransport->SetLun(aLun); |
226 { |
227 CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(aLun); |
227 __HOSTPRINT1(_L("SetLun %d"), lun); |
228 if (lu.IsReadyToSuspend()) |
228 iTransport->SetLun(lun); |
|
229 if (aLu.IsReadyToSuspend()) |
229 { |
230 { |
230 lu.CancelReadyToSuspend(); |
231 aLu.CancelReadyToSuspend(); |
231 } |
232 } |
232 } |
233 } |
|
234 } |
|
235 |
|
236 |
|
237 CUsbHostMsLogicalUnit& CUsbHostMsDevice::SetLunL(TLun aLun) |
|
238 { |
|
239 __MSFNLOG |
|
240 CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(aLun); |
|
241 SetLunL(lu); |
|
242 return lu; |
233 } |
243 } |
234 |
244 |
235 /** |
245 /** |
236 Starts timer to periodically check LUN. If the timer is not yet running then |
246 Starts timer to periodically check LUN. If the timer is not yet running then |
237 start it. |
247 start it. |
288 __MSFNLOG |
298 __MSFNLOG |
289 TInt err; |
299 TInt err; |
290 for (TInt i = 0; i < iLuList.Count(); i++) |
300 for (TInt i = 0; i < iLuList.Count(); i++) |
291 { |
301 { |
292 CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i); |
302 CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i); |
293 SetLunL(lu.Lun()); |
303 SetLunL(lu); |
294 TRAP(err, lu.DoLunReadyCheckL()); |
304 TRAP(err, lu.DoLunReadyCheckL()); |
295 } |
305 } |
296 } |
306 } |
297 |
307 |
298 void CUsbHostMsDevice::DoHandleRemoteWakeupL() |
308 void CUsbHostMsDevice::DoHandleRemoteWakeupL() |
316 } |
326 } |
317 |
327 |
318 for (TInt i = 0; i < iLuList.Count(); i++) |
328 for (TInt i = 0; i < iLuList.Count(); i++) |
319 { |
329 { |
320 CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i); |
330 CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i); |
321 SetLunL(lu.Lun()); |
331 SetLunL(lu); |
322 lu.SuspendL(); |
332 lu.SuspendL(); |
323 } |
333 } |
324 |
334 |
325 iDeviceSuspendResume->Suspend(); |
335 iDeviceSuspendResume->Suspend(); |
326 iState = ESuspended; |
336 iState = ESuspended; |
330 { |
340 { |
331 __MSFNLOG |
341 __MSFNLOG |
332 for (TInt i = 0; i < iLuList.Count(); i++) |
342 for (TInt i = 0; i < iLuList.Count(); i++) |
333 { |
343 { |
334 CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i); |
344 CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(i); |
335 SetLunL(lu.Lun()); |
345 SetLunL(lu); |
336 lu.ResumeL(); |
346 lu.ResumeL(); |
337 } |
347 } |
338 } |
348 } |
339 |
349 |
340 void CUsbHostMsDevice::ResumeCompletedL() |
350 void CUsbHostMsDevice::ResumeCompletedL() |