equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
18 #include <e32base.h> |
18 #include <e32base.h> |
19 #include <usbhosterrors.h> |
19 #include <usbhosterrors.h> |
20 #include <d32otgdi_errors.h> |
20 #include <d32otgdi_errors.h> |
21 #include <d32usbdi_errors.h> |
21 #include <d32usbdi_errors.h> |
22 |
22 |
|
23 #include "cusbotgwatcher.h" |
23 #include "cusbstatehostabase.h" |
24 #include "cusbstatehostabase.h" |
24 #include "cusbstatehosthandledropping.h" |
25 #include "cusbstatehosthandledropping.h" |
25 |
26 |
26 #include "errors.h" |
27 #include "errors.h" |
27 |
28 |
42 // --------------------------------------------------------------------------- |
43 // --------------------------------------------------------------------------- |
43 // |
44 // |
44 void CUsbStateHostABase::ConstructL() |
45 void CUsbStateHostABase::ConstructL() |
45 { |
46 { |
46 LOG_FUNC |
47 LOG_FUNC |
|
48 CUsbState::ConstructL(); |
47 } |
49 } |
48 |
50 |
49 // --------------------------------------------------------------------------- |
51 // --------------------------------------------------------------------------- |
50 // |
52 // |
51 // --------------------------------------------------------------------------- |
53 // --------------------------------------------------------------------------- |
149 case KErrUsbOtgBusControlProblem:// = -6685; |
151 case KErrUsbOtgBusControlProblem:// = -6685; |
150 case KErrUsbOtgVbusPowerUpError:// = -6686; |
152 case KErrUsbOtgVbusPowerUpError:// = -6686; |
151 case KErrUsbOtgHnpEnableProblem:// = -6687; |
153 case KErrUsbOtgHnpEnableProblem:// = -6687; |
152 case KErrUsbOtgVbusError:// = -6690; |
154 case KErrUsbOtgVbusError:// = -6690; |
153 |
155 |
154 // hosterrors.h |
156 // hosterrors.h |
155 case KErrUsbConfigurationHasNoInterfaces: |
157 case KErrUsbConfigurationHasNoInterfaces: |
156 case KErrUsbInterfaceCountMismatch: |
158 case KErrUsbInterfaceCountMismatch: |
157 case KErrUsbDuplicateInterfaceNumbers: |
159 case KErrUsbDuplicateInterfaceNumbers: |
158 case KErrUsbBadDescriptor: |
160 case KErrUsbBadDescriptor: |
159 case KErrUsbDeviceDetachedDuringDriverLoading: |
161 case KErrUsbDeviceDetachedDuringDriverLoading: |
162 LOG( "ErrorInConnection" ); |
164 LOG( "ErrorInConnection" ); |
163 HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandleDropping); |
165 HandleL(EUsbWatcherErrorInConnection, EUsbStateHostHandleDropping); |
164 break; |
166 break; |
165 } |
167 } |
166 |
168 |
167 // OTGDI |
169 // OTGDI |
168 case KErrUsbOtgPeriphNotSupported: // = -6688, for OPT only |
170 case KErrUsbOtgPeriphNotSupported: // = -6688, for OPT only |
169 |
171 |
170 // USBDI |
172 // USBDI |
171 case KErrUsbRequestsPending: |
173 case KErrUsbRequestsPending: |
172 case KErrUsbBadAddress: |
174 case KErrUsbBadAddress: |
173 case KErrUsbNoAddress: |
175 case KErrUsbNoAddress: |
174 case KErrUsbSetAddrFailed: |
176 case KErrUsbSetAddrFailed: |
175 case KErrUsbNoPower: |
177 case KErrUsbNoPower: |
187 case KErrUsbBadDevice: // = -6656 |
189 case KErrUsbBadDevice: // = -6656 |
188 case KErrUsbBadHub: |
190 case KErrUsbBadHub: |
189 case KErrUsbEventOverflow: |
191 case KErrUsbEventOverflow: |
190 case KErrUsbBadDeviceAttached: |
192 case KErrUsbBadDeviceAttached: |
191 |
193 |
192 // hosterrors.h |
194 // hosterrors.h |
193 case KErrUsbUnsupportedDevice: |
195 case KErrUsbUnsupportedDevice: |
194 { |
196 { |
195 LOG( "UnsupportedDevice" ); |
197 LOG( "UnsupportedDevice" ); |
196 HandleL(EUsbWatcherErrUnsupportedDevice, |
198 HandleL(EUsbWatcherErrUnsupportedDevice, |
197 EUsbStateHostHandleDropping); |
199 EUsbStateHostHandleDropping); |
236 // |
238 // |
237 void CUsbStateHostABase::SrpReceivedL() |
239 void CUsbStateHostABase::SrpReceivedL() |
238 { |
240 { |
239 LOG_FUNC |
241 LOG_FUNC |
240 |
242 |
|
243 if (iWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) |
|
244 { |
|
245 LOG( "Session is ongoing (VBus high); ignore SRP request." ); |
|
246 return; |
|
247 } |
|
248 |
241 TInt err = iWatcher.Usb().BusRespondSrp(); |
249 TInt err = iWatcher.Usb().BusRespondSrp(); |
242 if (KErrNone != err) |
250 LOG1( "BusRespondSrp() error = %d" , err ); |
243 { |
251 |
244 LOG1( "BusRespondSrp error = %d" , err ); |
252 if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) |
|
253 { |
245 iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection, |
254 iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection, |
246 EUsbStateHostHandleDropping); |
255 EUsbStateHostHandleDropping); |
247 } |
256 } |
248 } |
257 } |
249 |
258 |
256 LOG_FUNC |
265 LOG_FUNC |
257 |
266 |
258 if (iWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) |
267 if (iWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) |
259 { |
268 { |
260 // session already ongoing; BusRequest() in this case returns KErrUsbOtgBadState... |
269 // session already ongoing; BusRequest() in this case returns KErrUsbOtgBadState... |
261 LOG( "VBus is already UP; ignore Session request." ); |
270 LOG( "Session is ongoing (VBus high); ignore Session Request." ); |
262 return; |
271 return; |
263 } |
272 } |
264 |
273 |
265 TInt err = iWatcher.Usb().BusRequest(); |
274 TInt err = iWatcher.Usb().BusRequest(); |
266 if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) // sometimes this also comes... |
275 LOG1( "BusRequest() err = %d" , err); |
267 { |
276 |
268 LOG1( "BusRequestError err = %d" , err); |
277 if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) |
|
278 { |
269 iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection, |
279 iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection, |
270 EUsbStateHostHandleDropping); |
280 EUsbStateHostHandleDropping); |
271 return; |
281 } |
272 } |
282 } |
273 } |
|