123 |
119 |
124 EXPORT_C RUsb::RUsb() |
120 EXPORT_C RUsb::RUsb() |
125 : iDeviceStatePkg(0), iServiceStatePkg(0), iMessagePkg(0), |
121 : iDeviceStatePkg(0), iServiceStatePkg(0), iMessagePkg(0), |
126 iHostPkg(TDeviceEventInformation()) |
122 iHostPkg(TDeviceEventInformation()) |
127 { |
123 { |
128 OstTraceFunctionEntry0( RUSB_RUSB_CONS_ENTRY ); |
124 LOG_LINE |
129 OstTraceFunctionExit0( RUSB_RUSB_CONS_EXIT ); |
125 LOG_FUNC |
130 } |
126 } |
131 |
127 |
132 EXPORT_C RUsb::~RUsb() |
128 EXPORT_C RUsb::~RUsb() |
133 { |
129 { |
134 OstTraceFunctionEntry0( RUSB_RUSB_DES_ENTRY ); |
130 LOG_LINE |
135 OstTraceFunctionExit0( RUSB_RUSB_DES_EXIT ); |
131 LOG_FUNC |
136 } |
132 } |
137 |
133 |
138 EXPORT_C TVersion RUsb::Version() const |
134 EXPORT_C TVersion RUsb::Version() const |
139 { |
135 { |
140 return(TVersion(KUsbSrvMajorVersionNumber,KUsbSrvMinorVersionNumber,KUsbSrvBuildVersionNumber)); |
136 return(TVersion(KUsbSrvMajorVersionNumber,KUsbSrvMinorVersionNumber,KUsbSrvBuildVersionNumber)); |
141 } |
137 } |
142 |
138 |
143 EXPORT_C TInt RUsb::Connect() |
139 EXPORT_C TInt RUsb::Connect() |
144 { |
140 { |
145 OstTraceFunctionEntry0( RUSB_CONNECT_ENTRY ); |
141 LOG_LINE |
|
142 LOG_FUNC |
|
143 |
146 TInt retry = 2; |
144 TInt retry = 2; |
147 |
145 |
148 FOREVER |
146 FOREVER |
149 { |
147 { |
150 // Create the session to UsbSrv with 10 asynchronous message slots |
148 // Create the session to UsbSrv with 10 asynchronous message slots |
151 TInt err = CreateSession(KUsbServerName, Version(), 10); |
149 TInt err = CreateSession(KUsbServerName, Version(), 10); |
152 |
150 |
153 if ((err != KErrNotFound) && (err != KErrServerTerminated)) |
151 if ((err != KErrNotFound) && (err != KErrServerTerminated)) |
154 { |
152 { |
155 OstTraceFunctionExit0( RUSB_CONNECT_EXIT ); |
|
156 return err; |
153 return err; |
157 } |
154 } |
158 |
155 |
159 if (--retry == 0) |
156 if (--retry == 0) |
160 { |
157 { |
161 OstTraceFunctionExit0( RUSB_CONNECT_EXIT_DUP1 ); |
|
162 return err; |
158 return err; |
163 } |
159 } |
164 |
160 |
165 err = StartServer(); |
161 err = StartServer(); |
166 |
162 |
167 if ((err != KErrNone) && (err != KErrAlreadyExists)) |
163 if ((err != KErrNone) && (err != KErrAlreadyExists)) |
168 { |
164 { |
169 OstTraceFunctionExit0( RUSB_CONNECT_EXIT_DUP2 ); |
|
170 return err; |
165 return err; |
171 } |
166 } |
172 } |
167 } |
173 } |
168 } |
174 |
169 |
175 EXPORT_C void RUsb::Start(TRequestStatus& aStatus) |
170 EXPORT_C void RUsb::Start(TRequestStatus& aStatus) |
176 { |
171 { |
177 OstTraceFunctionEntry0( RUSB_START_ENTRY ); |
172 LOG_LINE |
178 |
173 LOG_FUNC |
|
174 |
179 SendReceive(EUsbStart, aStatus); |
175 SendReceive(EUsbStart, aStatus); |
180 OstTraceFunctionExit0( RUSB_START_EXIT ); |
|
181 } |
176 } |
182 |
177 |
183 EXPORT_C void RUsb::StartCancel() |
178 EXPORT_C void RUsb::StartCancel() |
184 { |
179 { |
185 OstTraceFunctionEntry0( RUSB_STARTCANCEL_ENTRY ); |
180 LOG_LINE |
|
181 LOG_FUNC |
|
182 |
186 SendReceive(EUsbStartCancel); |
183 SendReceive(EUsbStartCancel); |
187 OstTraceFunctionExit0( RUSB_STARTCANCEL_EXIT ); |
|
188 } |
184 } |
189 |
185 |
190 EXPORT_C void RUsb::Stop() |
186 EXPORT_C void RUsb::Stop() |
191 { |
187 { |
192 OstTraceFunctionEntry0( RUSB_STOP_ENTRY ); |
188 LOG_LINE |
|
189 LOG_FUNC |
|
190 |
193 SendReceive(EUsbStop); |
191 SendReceive(EUsbStop); |
194 OstTraceFunctionExit0( RUSB_STOP_EXIT ); |
|
195 } |
192 } |
196 |
193 |
197 EXPORT_C void RUsb::Stop(TRequestStatus& aStatus) |
194 EXPORT_C void RUsb::Stop(TRequestStatus& aStatus) |
198 { |
195 { |
199 OstTraceFunctionEntry0( RUSB_STOP_TREQUESTSTATUS_ENTRY ); |
196 LOG_LINE |
|
197 LOG_FUNC |
|
198 |
200 SendReceive(EUsbStop, aStatus); |
199 SendReceive(EUsbStop, aStatus); |
201 OstTraceFunctionExit0( RUSB_STOP_TREQUESTSTATUS_EXIT ); |
|
202 } |
200 } |
203 |
201 |
204 EXPORT_C void RUsb::StopCancel() |
202 EXPORT_C void RUsb::StopCancel() |
205 { |
203 { |
206 OstTraceFunctionEntry0( RUSB_STOPCANCEL_ENTRY ); |
204 LOG_LINE |
|
205 LOG_FUNC |
|
206 |
207 SendReceive(EUsbStopCancel); |
207 SendReceive(EUsbStopCancel); |
208 OstTraceFunctionExit0( RUSB_STOPCANCEL_EXIT ); |
|
209 } |
208 } |
210 |
209 |
211 EXPORT_C TInt RUsb::GetServiceState(TUsbServiceState& aState) |
210 EXPORT_C TInt RUsb::GetServiceState(TUsbServiceState& aState) |
212 { |
211 { |
213 OstTraceFunctionEntry0( RUSB_GETSERVICESTATE_ENTRY ); |
212 LOG_LINE |
|
213 LOG_FUNC |
|
214 |
214 TPckg<TUint32> pkg(aState); |
215 TPckg<TUint32> pkg(aState); |
215 TInt ret=SendReceive(EUsbGetCurrentState, TIpcArgs(&pkg)); |
216 TInt ret=SendReceive(EUsbGetCurrentState, TIpcArgs(&pkg)); |
216 aState=(TUsbServiceState)pkg(); |
217 aState=(TUsbServiceState)pkg(); |
217 OstTraceFunctionExit0( RUSB_GETSERVICESTATE_EXIT ); |
|
218 return ret; |
218 return ret; |
219 } |
219 } |
220 |
220 |
221 EXPORT_C TInt RUsb::GetCurrentState(TUsbServiceState& aState) |
221 EXPORT_C TInt RUsb::GetCurrentState(TUsbServiceState& aState) |
222 { |
222 { |
223 OstTraceFunctionEntry0( RUSB_GETCURRENTSTATE_ENTRY ); |
223 LOG_LINE |
|
224 LOG_FUNC |
|
225 |
224 return GetServiceState(aState); |
226 return GetServiceState(aState); |
225 } |
227 } |
226 |
228 |
227 EXPORT_C void RUsb::ServiceStateNotification(TUsbServiceState& aState, |
229 EXPORT_C void RUsb::ServiceStateNotification(TUsbServiceState& aState, |
228 TRequestStatus& aStatus) |
230 TRequestStatus& aStatus) |
229 { |
231 { |
230 OstTraceFunctionEntry0( RUSB_SERVICESTATENOTIFICATION_ENTRY ); |
232 LOG_LINE |
|
233 LOG_FUNC |
231 |
234 |
232 iServiceStatePkg.Set((TUint8*)&aState, sizeof(TUint32), sizeof(TUint32)); |
235 iServiceStatePkg.Set((TUint8*)&aState, sizeof(TUint32), sizeof(TUint32)); |
233 |
236 |
234 SendReceive(EUsbRegisterServiceObserver, TIpcArgs(&iServiceStatePkg), aStatus); |
237 SendReceive(EUsbRegisterServiceObserver, TIpcArgs(&iServiceStatePkg), aStatus); |
235 OstTraceFunctionExit0( RUSB_SERVICESTATENOTIFICATION_EXIT ); |
|
236 } |
238 } |
237 |
239 |
238 EXPORT_C void RUsb::ServiceStateNotificationCancel() |
240 EXPORT_C void RUsb::ServiceStateNotificationCancel() |
239 { |
241 { |
240 OstTraceFunctionEntry0( RUSB_SERVICESTATENOTIFICATIONCANCEL_ENTRY ); |
242 LOG_LINE |
|
243 LOG_FUNC |
|
244 |
241 SendReceive(EUsbCancelServiceObserver); |
245 SendReceive(EUsbCancelServiceObserver); |
242 OstTraceFunctionExit0( RUSB_SERVICESTATENOTIFICATIONCANCEL_EXIT ); |
|
243 } |
246 } |
244 |
247 |
245 EXPORT_C TInt RUsb::GetDeviceState(TUsbDeviceState& aState) |
248 EXPORT_C TInt RUsb::GetDeviceState(TUsbDeviceState& aState) |
246 { |
249 { |
247 OstTraceFunctionEntry0( RUSB_GETDEVICESTATE_ENTRY ); |
250 LOG_LINE |
|
251 LOG_FUNC |
|
252 |
248 TPckg<TUint32> pkg(aState); |
253 TPckg<TUint32> pkg(aState); |
249 TInt ret=SendReceive(EUsbGetCurrentDeviceState, TIpcArgs(&pkg)); |
254 TInt ret=SendReceive(EUsbGetCurrentDeviceState, TIpcArgs(&pkg)); |
250 aState=(TUsbDeviceState)pkg(); |
255 aState=(TUsbDeviceState)pkg(); |
251 OstTraceFunctionExit0( RUSB_GETDEVICESTATE_EXIT ); |
|
252 return ret; |
256 return ret; |
253 } |
257 } |
254 |
258 |
255 EXPORT_C void RUsb::DeviceStateNotification(TUint aEventMask, TUsbDeviceState& aState, |
259 EXPORT_C void RUsb::DeviceStateNotification(TUint aEventMask, TUsbDeviceState& aState, |
256 TRequestStatus& aStatus) |
260 TRequestStatus& aStatus) |
257 { |
261 { |
258 OstTraceFunctionEntry0( RUSB_DEVICESTATENOTIFICATION_ENTRY ); |
262 LOG_LINE |
|
263 LOG_FUNC |
|
264 |
259 iDeviceStatePkg.Set((TUint8*)&aState, sizeof(TUint32), sizeof(TUint32)); |
265 iDeviceStatePkg.Set((TUint8*)&aState, sizeof(TUint32), sizeof(TUint32)); |
260 |
266 |
261 SendReceive(EUsbRegisterObserver, TIpcArgs(aEventMask, &iDeviceStatePkg), aStatus); |
267 SendReceive(EUsbRegisterObserver, TIpcArgs(aEventMask, &iDeviceStatePkg), aStatus); |
262 OstTraceFunctionExit0( RUSB_DEVICESTATENOTIFICATION_EXIT ); |
|
263 } |
268 } |
264 |
269 |
265 EXPORT_C void RUsb::DeviceStateNotificationCancel() |
270 EXPORT_C void RUsb::DeviceStateNotificationCancel() |
266 { |
271 { |
267 OstTraceFunctionEntry0( RUSB_DEVICESTATENOTIFICATIONCANCEL_ENTRY ); |
272 LOG_LINE |
|
273 LOG_FUNC |
|
274 |
268 SendReceive(EUsbCancelObserver); |
275 SendReceive(EUsbCancelObserver); |
269 OstTraceFunctionExit0( RUSB_DEVICESTATENOTIFICATIONCANCEL_EXIT ); |
|
270 } |
276 } |
271 |
277 |
272 EXPORT_C void RUsb::StateNotification(TUint aEventMask, TUsbDeviceState& aState, TRequestStatus& aStatus) |
278 EXPORT_C void RUsb::StateNotification(TUint aEventMask, TUsbDeviceState& aState, TRequestStatus& aStatus) |
273 { |
279 { |
274 OstTraceFunctionEntry0( RUSB_STATENOTIFICATION_ENTRY ); |
280 LOG_LINE |
|
281 LOG_FUNC |
|
282 |
275 DeviceStateNotification(aEventMask, aState, aStatus); |
283 DeviceStateNotification(aEventMask, aState, aStatus); |
276 OstTraceFunctionExit0( RUSB_STATENOTIFICATION_EXIT ); |
|
277 } |
284 } |
278 |
285 |
279 EXPORT_C void RUsb::StateNotificationCancel() |
286 EXPORT_C void RUsb::StateNotificationCancel() |
280 { |
287 { |
281 OstTraceFunctionEntry0( RUSB_STATENOTIFICATIONCANCEL_ENTRY ); |
288 LOG_LINE |
|
289 LOG_FUNC |
|
290 |
282 DeviceStateNotificationCancel(); |
291 DeviceStateNotificationCancel(); |
283 OstTraceFunctionExit0( RUSB_STATENOTIFICATIONCANCEL_EXIT ); |
|
284 } |
292 } |
285 |
293 |
286 EXPORT_C void RUsb::TryStart(TInt aPersonalityId, TRequestStatus& aStatus) |
294 EXPORT_C void RUsb::TryStart(TInt aPersonalityId, TRequestStatus& aStatus) |
287 { |
295 { |
288 OstTraceFunctionEntry0( RUSB_TRYSTART_ENTRY ); |
296 LOG_LINE |
|
297 LOG_FUNC |
289 |
298 |
290 TIpcArgs ipcArgs(aPersonalityId); |
299 TIpcArgs ipcArgs(aPersonalityId); |
291 SendReceive(EUsbTryStart, ipcArgs, aStatus); |
300 SendReceive(EUsbTryStart, ipcArgs, aStatus); |
292 OstTraceFunctionExit0( RUSB_TRYSTART_EXIT ); |
|
293 } |
301 } |
294 |
302 |
295 EXPORT_C void RUsb::TryStop(TRequestStatus& aStatus) |
303 EXPORT_C void RUsb::TryStop(TRequestStatus& aStatus) |
296 { |
304 { |
297 OstTraceFunctionEntry0( RUSB_TRYSTOP_ENTRY ); |
305 LOG_LINE |
|
306 LOG_FUNC |
|
307 |
298 SendReceive(EUsbTryStop, aStatus); |
308 SendReceive(EUsbTryStop, aStatus); |
299 OstTraceFunctionExit0( RUSB_TRYSTOP_EXIT ); |
|
300 } |
309 } |
301 |
310 |
302 EXPORT_C TInt RUsb::CancelInterest(TUsbReqType aMessageId) |
311 EXPORT_C TInt RUsb::CancelInterest(TUsbReqType aMessageId) |
303 { |
312 { |
304 OstTraceFunctionEntry0( RUSB_CANCELINTEREST_ENTRY ); |
313 LOG_LINE |
|
314 LOG_FUNC |
305 |
315 |
306 TInt messageId; |
316 TInt messageId; |
307 switch (aMessageId) |
317 switch (aMessageId) |
308 { |
318 { |
309 case EStart: |
319 case EStart: |
556 return KErrNone; |
565 return KErrNone; |
557 #endif |
566 #endif |
558 } |
567 } |
559 |
568 |
560 EXPORT_C void panic() |
569 EXPORT_C void panic() |
561 { |
570 { |
562 OstTrace1( TRACE_FATAL, RUSB_PANIC, "::panic;Panic reason=%d", EUsbPanicRemovedExport ); |
571 _USB_PANIC(KUsbCliPncCat, EUsbPanicRemovedExport); |
563 User::Panic(KUsbCliPncCat, EUsbPanicRemovedExport); |
|
564 } |
572 } |
565 |
573 |
566 EXPORT_C TInt RUsb::SetCtlSessionMode(TBool aValue) |
574 EXPORT_C TInt RUsb::SetCtlSessionMode(TBool aValue) |
567 { |
575 { |
568 OstTraceFunctionEntry0( RUSB_SETCTLSESSIONMODE_ENTRY ); |
576 LOG_LINE |
|
577 LOG_FUNC |
569 |
578 |
570 TPckg<TBool> pkg(aValue); |
579 TPckg<TBool> pkg(aValue); |
571 return SendReceive(EUsbSetCtlSessionMode, TIpcArgs(&pkg)); |
580 return SendReceive(EUsbSetCtlSessionMode, TIpcArgs(&pkg)); |
572 } |
581 } |
573 |
582 |
574 EXPORT_C TInt RUsb::BusRequest() |
583 EXPORT_C TInt RUsb::BusRequest() |
575 { |
584 { |
576 OstTraceFunctionEntry0( RUSB_BUSREQUEST_ENTRY ); |
585 LOG_LINE |
|
586 LOG_FUNC |
577 |
587 |
578 return SendReceive(EUsbBusRequest); |
588 return SendReceive(EUsbBusRequest); |
579 } |
589 } |
580 |
590 |
581 EXPORT_C TInt RUsb::BusRespondSrp() |
591 EXPORT_C TInt RUsb::BusRespondSrp() |
582 { |
592 { |
583 OstTraceFunctionEntry0( RUSB_BUSRESPONDSRP_ENTRY ); |
593 LOG_LINE |
|
594 LOG_FUNC |
584 |
595 |
585 return SendReceive(EUsbBusRespondSrp); |
596 return SendReceive(EUsbBusRespondSrp); |
586 } |
597 } |
587 |
598 |
588 EXPORT_C TInt RUsb::BusClearError() |
599 EXPORT_C TInt RUsb::BusClearError() |
589 { |
600 { |
590 OstTraceFunctionEntry0( RUSB_BUSCLEARERROR_ENTRY ); |
601 LOG_LINE |
|
602 LOG_FUNC |
|
603 |
591 return SendReceive(EUsbBusClearError); |
604 return SendReceive(EUsbBusClearError); |
592 } |
605 } |
593 |
606 |
594 |
607 |
595 EXPORT_C TInt RUsb::BusDrop() |
608 EXPORT_C TInt RUsb::BusDrop() |
596 { |
609 { |
597 OstTraceFunctionEntry0( RUSB_BUSDROP_ENTRY ); |
610 LOG_LINE |
|
611 LOG_FUNC |
|
612 |
598 return SendReceive(EUsbBusDrop); |
613 return SendReceive(EUsbBusDrop); |
599 } |
614 } |
600 |
615 |
601 EXPORT_C void RUsb::MessageNotification(TRequestStatus& aStatus, TInt& aMessage) |
616 EXPORT_C void RUsb::MessageNotification(TRequestStatus& aStatus, TInt& aMessage) |
602 { |
617 { |
603 OstTraceFunctionEntry0( RUSB_MESSAGENOTIFICATION_ENTRY ); |
618 LOG_LINE |
|
619 LOG_FUNC |
|
620 |
604 iMessagePkg.Set((TUint8*)&aMessage, sizeof(TInt), sizeof(TInt)); |
621 iMessagePkg.Set((TUint8*)&aMessage, sizeof(TInt), sizeof(TInt)); |
605 |
622 |
606 SendReceive(EUsbRegisterMessageObserver, TIpcArgs(&iMessagePkg), aStatus); |
623 SendReceive(EUsbRegisterMessageObserver, TIpcArgs(&iMessagePkg), aStatus); |
607 OstTraceFunctionExit0( RUSB_MESSAGENOTIFICATION_EXIT ); |
|
608 } |
624 } |
609 |
625 |
610 EXPORT_C void RUsb::MessageNotificationCancel() |
626 EXPORT_C void RUsb::MessageNotificationCancel() |
611 { |
627 { |
612 OstTraceFunctionEntry0( RUSB_MESSAGENOTIFICATIONCANCEL_ENTRY ); |
628 LOG_LINE |
|
629 LOG_FUNC |
|
630 |
613 SendReceive(EUsbCancelMessageObserver); |
631 SendReceive(EUsbCancelMessageObserver); |
614 OstTraceFunctionExit0( RUSB_MESSAGENOTIFICATIONCANCEL_EXIT ); |
|
615 } |
632 } |
616 |
633 |
617 EXPORT_C void RUsb::HostEventNotification(TRequestStatus& aStatus, |
634 EXPORT_C void RUsb::HostEventNotification(TRequestStatus& aStatus, |
618 TDeviceEventInformation& aDeviceInformation) |
635 TDeviceEventInformation& aDeviceInformation) |
619 { |
636 { |
620 OstTraceFunctionEntry0( RUSB_HOSTEVENTNOTIFICATION_ENTRY ); |
637 LOG_LINE |
|
638 LOG_FUNC |
621 |
639 |
622 iHostPkg.Set((TUint8*)&aDeviceInformation, sizeof(TDeviceEventInformation), sizeof(TDeviceEventInformation)); |
640 iHostPkg.Set((TUint8*)&aDeviceInformation, sizeof(TDeviceEventInformation), sizeof(TDeviceEventInformation)); |
623 |
641 |
624 SendReceive(EUsbRegisterHostObserver, TIpcArgs(&iHostPkg), aStatus); |
642 SendReceive(EUsbRegisterHostObserver, TIpcArgs(&iHostPkg), aStatus); |
625 OstTraceFunctionExit0( RUSB_HOSTEVENTNOTIFICATION_EXIT ); |
|
626 } |
643 } |
627 |
644 |
628 EXPORT_C void RUsb::HostEventNotificationCancel() |
645 EXPORT_C void RUsb::HostEventNotificationCancel() |
629 { |
646 { |
630 OstTraceFunctionEntry0( RUSB_HOSTEVENTNOTIFICATIONCANCEL_ENTRY ); |
647 LOG_LINE |
|
648 LOG_FUNC |
|
649 |
631 SendReceive(EUsbCancelHostObserver); |
650 SendReceive(EUsbCancelHostObserver); |
632 OstTraceFunctionExit0( RUSB_HOSTEVENTNOTIFICATIONCANCEL_EXIT ); |
|
633 } |
651 } |
634 |
652 |
635 EXPORT_C TInt RUsb::EnableFunctionDriverLoading() |
653 EXPORT_C TInt RUsb::EnableFunctionDriverLoading() |
636 { |
654 { |
637 OstTraceFunctionEntry0( RUSB_ENABLEFUNCTIONDRIVERLOADING_ENTRY ); |
655 LOG_LINE |
|
656 LOG_FUNC |
638 |
657 |
639 return SendReceive(EUsbEnableFunctionDriverLoading); |
658 return SendReceive(EUsbEnableFunctionDriverLoading); |
640 } |
659 } |
641 |
660 |
642 EXPORT_C void RUsb::DisableFunctionDriverLoading() |
661 EXPORT_C void RUsb::DisableFunctionDriverLoading() |
643 { |
662 { |
644 OstTraceFunctionEntry0( RUSB_DISABLEFUNCTIONDRIVERLOADING_ENTRY ); |
663 LOG_LINE |
|
664 LOG_FUNC |
|
665 |
645 SendReceive(EUsbDisableFunctionDriverLoading); |
666 SendReceive(EUsbDisableFunctionDriverLoading); |
646 OstTraceFunctionExit0( RUSB_DISABLEFUNCTIONDRIVERLOADING_EXIT ); |
|
647 } |
667 } |
648 |
668 |
649 EXPORT_C TInt RUsb::GetSupportedLanguages(TUint aDeviceId, RArray<TUint>& aLangIds) |
669 EXPORT_C TInt RUsb::GetSupportedLanguages(TUint aDeviceId, RArray<TUint>& aLangIds) |
650 { |
670 { |
651 OstTraceFunctionEntry0( RUSB_GETSUPPORTEDLANGUAGES_ENTRY ); |
671 LOG_LINE |
|
672 LOG_FUNC |
652 |
673 |
653 aLangIds.Reset(); |
674 aLangIds.Reset(); |
654 |
675 |
655 TInt ret = KErrNone; |
676 TInt ret = KErrNone; |
656 HBufC8* buf = NULL; |
677 HBufC8* buf = NULL; |
657 // +1 for the actual count of language ids |
678 // +1 for the actual count of language ids |
658 TRAP(ret, buf = HBufC8::NewL((KUsbMaxSupportedLanguageIds + 1)*sizeof (TUint))); |
679 TRAP(ret, buf = HBufC8::NewL((KUsbMaxSupportedLanguageIds + 1)*sizeof (TUint))); |
659 if (ret != KErrNone) |
680 if (ret != KErrNone) |
660 { |
681 { |
661 OstTraceFunctionExit0( RUSB_GETSUPPORTEDLANGUAGES_EXIT ); |
|
662 return ret; |
682 return ret; |
663 } |
683 } |
664 |
684 |
665 TPtr8 ptr8 = buf->Des(); |
685 TPtr8 ptr8 = buf->Des(); |
666 ret = SendReceive(EUsbGetSupportedLanguages, TIpcArgs(aDeviceId, &ptr8)); |
686 ret = SendReceive(EUsbGetSupportedLanguages, TIpcArgs(aDeviceId, &ptr8)); |
719 } |
742 } |
720 |
743 |
721 |
744 |
722 EXPORT_C TInt RUsb::RequestSession() |
745 EXPORT_C TInt RUsb::RequestSession() |
723 { |
746 { |
724 OstTraceFunctionEntry0( RUSB_REQUESTSESSION_ENTRY ); |
747 LOG_LINE |
|
748 LOG_FUNC |
725 |
749 |
726 return SendReceive(EUsbRequestSession); |
750 return SendReceive(EUsbRequestSession); |
727 } |
751 } |
728 |
752 |
729 EXPORT_C TInt RUsb::GetDetailedDescription(TInt /*aPersonalityId*/, HBufC*& /*aLocalizedPersonalityDescriptor*/) |
753 EXPORT_C TInt RUsb::GetDetailedDescription(TInt aPersonalityId, HBufC*& aLocalizedPersonalityDescriptor) |
730 { |
754 { |
731 OstTraceFunctionEntry0( RUSB_GETDETAILEDDESCRIPTION_ENTRY ); |
755 LOG_LINE |
732 //This API has been deprecated |
756 LOG_FUNC |
733 OstTraceFunctionExit0( RUSB_GETDETAILEDDESCRIPTION_EXIT ); |
757 |
734 return KErrNotSupported; |
758 TInt ret = KErrNone; |
|
759 // caller is responsible for freeing up memory allocated for aLocalizedPersonalityDescriptor |
|
760 TRAP(ret, aLocalizedPersonalityDescriptor = HBufC::NewL(KUsbStringDescStringMaxSize)); |
|
761 if (ret == KErrNone) |
|
762 { |
|
763 TPtr ptr = aLocalizedPersonalityDescriptor->Des(); |
|
764 TIpcArgs ipcArgs(0, &ptr); |
|
765 ipcArgs.Set(0, aPersonalityId); |
|
766 ret = SendReceive(EUsbGetDetailedDescription, ipcArgs); |
|
767 } |
|
768 else |
|
769 { |
|
770 // just in case caller tries to free the memory before checking the return code |
|
771 aLocalizedPersonalityDescriptor = NULL; |
|
772 } |
|
773 |
|
774 return ret; |
735 } |
775 } |
736 |
776 |
737 EXPORT_C TInt RUsb::GetPersonalityProperty(TInt aPersonalityId, TUint32& aProperty) |
777 EXPORT_C TInt RUsb::GetPersonalityProperty(TInt aPersonalityId, TUint32& aProperty) |
738 { |
778 { |
739 OstTraceFunctionEntry0( RUSB_GETPERSONALITYPROPERTY_ENTRY ); |
779 LOG_LINE |
|
780 LOG_FUNC |
740 |
781 |
741 TPckg<TUint32> pkg(aProperty); |
782 TPckg<TUint32> pkg(aProperty); |
742 TInt ret = SendReceive(EUsbGetPersonalityProperty, TIpcArgs(aPersonalityId, &pkg)); |
783 TInt ret = SendReceive(EUsbGetPersonalityProperty, TIpcArgs(aPersonalityId, &pkg)); |
743 if (ret == KErrNone) |
784 if (ret == KErrNone) |
744 { |
785 { |
745 aProperty = static_cast<TUint32>(pkg()); |
786 aProperty = static_cast<TUint32>(pkg()); |
746 } |
787 } |
747 OstTraceFunctionExit0( RUSB_GETPERSONALITYPROPERTY_EXIT ); |
|
748 return ret; |
788 return ret; |
749 } |
789 } |
750 |
790 |