RUsbInterface Class Reference

class RUsbInterface : public RBusLogicalChannel

Functions which act on a specific interface on a remote device.

Inherits from

Public Member Functions
RUsbInterface ()
void CancelEP0Transfer ()
void CancelPermitSuspend ()
void CancelWaitForResume ()
IMPORT_C void Close ()
TInt EnumerateEndpointsOnInterface ( TInt )
void Ep0Transfer (TUsbTransferRequestDetails &, const TDesC8 &, TDes8 &, TRequestStatus &)
TInt GetAlternateInterfaceCount ()
TInt GetAlternateInterfaceDescriptor ( TInt , TUsbInterfaceDescriptor &)
TInt GetBusId ( TUsbBusId &)
TInt GetDeviceSpeed ( TDeviceSpeed &)
TInt GetEndpointDescriptor ( TInt , TInt , TUsbEndpointDescriptor &)
TInt GetHcdPageSize ( TInt &)
TInt GetInterfaceDescriptor (TUsbInterfaceDescriptor &)
TInt GetStringDescriptor ( TDes8 &, TUint8 , TUint16 )
IMPORT_C TInt InitialiseTransferDescriptors ()
NONSHARABLE_CLASS (TUsbTransferRequestDetails)
NONSHARABLE_CLASS (TChunkRequestDetails)
NONSHARABLE_CLASS (TTransferMemoryDetails)
const TDesC & Name ()
IMPORT_C TInt Open ( TUint32 , TOwnerType )
TInt OpenPipeForEndpoint ( RUsbPipe &, TInt , TBool )
TInt PermitRemoteWakeup ( TBool )
void PermitSuspendAndWaitForResume ( TRequestStatus &)
IMPORT_C TInt RegisterTransferDescriptor (RUsbTransferDescriptor &)
IMPORT_C void ResetTransferDescriptors ()
TInt SelectAlternateInterface ( TInt )
TVersion VersionRequired ()
Private Member Functions
TInt AllocateSharedChunk ( RChunk &, TInt , TInt &)
TInt GetEndpointDescriptor ( TInt , TInt , TUsbEndpointDescriptor *&)
TInt RegisterTransferDescriptor (RUsbTransferDescriptor &, TUsbBusId )
Inherited Functions
RBusLogicalChannel::DoCancel(TUint)
RBusLogicalChannel::DoControl(TInt)
RBusLogicalChannel::DoControl(TInt,TAny *)
RBusLogicalChannel::DoControl(TInt,TAny *,TAny *)
RBusLogicalChannel::DoCreate(const TDesC &,const TVersion &,TInt,const TDesC *,const TDesC8 *,TOwnerType,TBool)
RBusLogicalChannel::DoRequest(TInt,TRequestStatus &)
RBusLogicalChannel::DoRequest(TInt,TRequestStatus &,TAny *)
RBusLogicalChannel::DoRequest(TInt,TRequestStatus &,TAny *,TAny *)
RBusLogicalChannel::DoSvControl(TInt)
RBusLogicalChannel::DoSvControl(TInt,TAny *)
RBusLogicalChannel::DoSvControl(TInt,TAny *,TAny *)
RBusLogicalChannel::Open(RMessagePtr2,TInt,TOwnerType)
RBusLogicalChannel::Open(TInt,TOwnerType)
RHandleBase::Attributes()const
RHandleBase::BTraceId()const
RHandleBase::DoExtendedClose()
RHandleBase::Duplicate(const RThread &,TOwnerType)
RHandleBase::FullName()const
RHandleBase::FullName(TDes &)const
RHandleBase::Handle()const
RHandleBase::HandleInfo(THandleInfo *)
RHandleBase::Name()const
RHandleBase::NotifyDestruction(TRequestStatus &)
RHandleBase::Open(const TFindHandleBase &,TOwnerType)
RHandleBase::OpenByName(const TDesC &,TOwnerType,TInt)
RHandleBase::RHandleBase()
RHandleBase::RHandleBase(TInt)
RHandleBase::SetHandle(TInt)
RHandleBase::SetHandleNC(TInt)
RHandleBase::SetReturnedHandle(TInt)
RHandleBase::SetReturnedHandle(TInt,RHandleBase &)
Public Member Enumerations
enum TDeviceSpeed { ELowSpeed , EFullSpeed , EHighSpeed }
enum TUsbInterfaceCancel { ECancelSuspend  = 0x00000001, ECancelWaitForResume  = 0x00000002, ECancelEp0Transfer  = 0x00000004 }
enum TUsbInterfaceControl {
EOpenPipe , EPermitRemoteWakeup , EGetInterfaceDescriptorSize , EGetInterfaceDescriptor , EGetStringDescriptor , ESelectAlternateInterface , EAllocChunk , EGetDeviceSpeed , EGetBusId , EHcdPageSize , EGetSizeAndAlignment
}
enum TUsbInterfaceRequest { ESuspend , EEp0Transfer }
Inherited Enumerations
RHandleBase:TAttributes
Private Attributes
TInt iAlternateSetting
TUsbInterfaceDescriptor * iHeadInterfaceDescriptor
HBufC8 * iInterfaceDescriptorData
RUsbTransferStrategy * iTransferStrategy
Inherited Attributes
RHandleBase::iHandle

Constructor & Destructor Documentation

RUsbInterface()

RUsbInterface ( ) [inline]

Member Functions Documentation

AllocateSharedChunk(RChunk &, TInt, TInt &)

TInt AllocateSharedChunk ( RChunk & aChunk,
TInt aSize,
TInt & aOffset
) [private, inline]

Parameters

RChunk & aChunk
TInt aSize
TInt & aOffset

CancelEP0Transfer()

void CancelEP0Transfer ( ) [inline]

Cancel an Endpoint 0 transfer.

CancelPermitSuspend()

void CancelPermitSuspend ( ) [inline]

Cancel the outstanding permission to suspend.

CancelWaitForResume()

void CancelWaitForResume ( ) [inline]

Cancel the outstanding PermitSuspendAndWaitForResume request with KErrCancel

Close()

IMPORT_C void Close ( )

EnumerateEndpointsOnInterface(TInt)

TInt EnumerateEndpointsOnInterface ( TInt aAlternateInterface ) [inline]

Count the endpoints on an alternate interface.

Parameters

TInt aAlternateInterface The alternate interface to count endpoints on.

Ep0Transfer(TUsbTransferRequestDetails &, const TDesC8 &, TDes8 &, TRequestStatus &)

void Ep0Transfer ( TUsbTransferRequestDetails & aDetails,
const TDesC8 & aSend,
TDes8 & aRecv,
TRequestStatus & aRequest
) [inline]

Performs an Endpoint 0 transfer.

Parameters

TUsbTransferRequestDetails & aDetails
const TDesC8 & aSend
TDes8 & aRecv
TRequestStatus & aRequest

GetAlternateInterfaceCount()

TInt GetAlternateInterfaceCount ( ) [inline]

GetAlternateInterfaceDescriptor(TInt, TUsbInterfaceDescriptor &)

TInt GetAlternateInterfaceDescriptor ( TInt aAlternateInterface,
TUsbInterfaceDescriptor & aDescriptor
) [inline]

Find and return the section of the USB Configuration Descriptor under the supplied alternate interface.

Note: the supplied TUsbInterfaceDescriptor is owned by the caller, but any descriptor objects linked to it remain the property of the RUsbInterface object. Memory leaks will result if the head pointer is not cleaned up, but the pointed to objects should not be destroyed.

Parameters

TInt aAlternateInterface The alternate interface number to return the descriptor for. [in]
TUsbInterfaceDescriptor & aDescriptor The supplied TUsbInterfaceDescriptor object will be populated from the data retrieved from the device. Note that the caller owns the head of the list, but not any children or peers. [out]

GetBusId(TUsbBusId &)

TInt GetBusId ( TUsbBusId & aBusId ) [inline]

Returns an identifier that is unique for the bus that the device that provides this interface is on.

Parameters

TUsbBusId & aBusId On success provides an identifier that is unique for the bus this interface is on.

GetDeviceSpeed(TDeviceSpeed &)

TInt GetDeviceSpeed ( TDeviceSpeed & aDeviceSpeed ) [inline]

Returns the speed the remote device is connected at.

Parameters

TDeviceSpeed & aDeviceSpeed On sucess an enumeration value describing the current speed of the remote device.

GetEndpointDescriptor(TInt, TInt, TUsbEndpointDescriptor &)

TInt GetEndpointDescriptor ( TInt aAlternateInterface,
TInt aEndpoint,
TUsbEndpointDescriptor & aDescriptor
) [inline]

Find and return the section of the USB Configuration Descriptor under the supplied endpoint.

Note: the supplied TUsbEndpointDescriptor is owned by the caller, but any descriptor objects linked to it remain the property of the RUsbInterface object. Memory leaks will result if the head pointer is not cleaned up, but the pointed to objects should not be destroyed.

Parameters

TInt aAlternateInterface The alternate interface number to return the descriptor for. [in]
TInt aEndpoint The endpoint number to return the descriptor for. [in]
TUsbEndpointDescriptor & aDescriptor The supplied TUsbEndpointDescriptor object will be populated from the data retrieved from the device. Note that the caller owns the head of the list, but not any children or peers. [out]

GetEndpointDescriptor(TInt, TInt, TUsbEndpointDescriptor *&)

TInt GetEndpointDescriptor ( TInt aAlternateInterface,
TInt aEndpoint,
TUsbEndpointDescriptor *& aDescriptor
) [private, inline]

Parameters

TInt aAlternateInterface
TInt aEndpoint
TUsbEndpointDescriptor *& aDescriptor

GetHcdPageSize(TInt &)

TInt GetHcdPageSize ( TInt & aHcdPageSize ) [inline]

Returns the size of pages used by the HCD.

Parameters

TInt & aHcdPageSize on success provides the HCD's page size.

GetInterfaceDescriptor(TUsbInterfaceDescriptor &)

TInt GetInterfaceDescriptor ( TUsbInterfaceDescriptor & aDescriptor ) [inline]

Return the section of the USB Configuration Descriptor under this interface, including any alternate interfaces.

Note: the supplied TUsbInterfaceDescriptor is owned by the caller, but any descriptor objects linked to it remain the property of the RUsbInterface object. Memory leaks will result if the head pointer is not cleaned up, but the pointed to objects should not be destroyed.

Parameters

TUsbInterfaceDescriptor & aDescriptor The supplied TUsbInterfaceDescriptor object will be populated from the data retrieved from the device. Note that the caller owns the head of the list, but not any children or peers.

GetStringDescriptor(TDes8 &, TUint8, TUint16)

TInt GetStringDescriptor ( TDes8 & aStringDescriptor,
TUint8 aIndex,
TUint16 aLangId
) [inline]

Parameters

TDes8 & aStringDescriptor
TUint8 aIndex
TUint16 aLangId

InitialiseTransferDescriptors()

IMPORT_C TInt InitialiseTransferDescriptors ( )

NONSHARABLE_CLASS(TUsbTransferRequestDetails)

NONSHARABLE_CLASS ( TUsbTransferRequestDetails ) [inline]

Parameters

TUsbTransferRequestDetails

NONSHARABLE_CLASS(TChunkRequestDetails)

NONSHARABLE_CLASS ( TChunkRequestDetails ) [inline]

Parameters

TChunkRequestDetails

NONSHARABLE_CLASS(TTransferMemoryDetails)

NONSHARABLE_CLASS ( TTransferMemoryDetails ) [inline]

Parameters

TTransferMemoryDetails

Name()

const TDesC & Name ( ) [static, inline]

The driver's name

Open(TUint32, TOwnerType)

IMPORT_C TInt Open ( TUint32 aToken,
TOwnerType aType = EOwnerProcess
)

Parameters

TUint32 aToken
TOwnerType aType = EOwnerProcess

OpenPipeForEndpoint(RUsbPipe &, TInt, TBool)

TInt OpenPipeForEndpoint ( RUsbPipe & aPipe,
TInt aEndpoint,
TBool aUseDMA
) [inline]

Establish a pipe between host and device. The RUsbPipe object returned is ready for use.

SelectAlternateInterface

Parameters

RUsbPipe & aPipe The pipe to connect to the remote endpoint. [out]
TInt aEndpoint The endpoint on the remote device to connect to. [in]
TBool aUseDMA In future implementations where DMA is supported this flag indicates DMA must be used. The Open attempt will fail if DMA cannot be offered on the pipe. [in]

PermitRemoteWakeup(TBool)

TInt PermitRemoteWakeup ( TBool aPermitted ) [inline]

Request or clear the interface's remote wakeup flag. If any interface on the device has this flag set, suspending the device will cause it to have remote wakeup capability enabled. This function may only be called when the interface is active -- the device will not be woken to change the status if it is currently suspended. Note that clearing this flag will not prevent a device from using remote wakeup -- this will happen only if all interfaces on the device do not require it. By default the device will not have remote wakeup enabled.

Parameters

TBool aPermitted ETrue if remote wakeup should be permitted, EFalse if this interface does not require it.

PermitSuspendAndWaitForResume(TRequestStatus &)

void PermitSuspendAndWaitForResume ( TRequestStatus & aResumeSignal ) [inline]

Signals to the hub driver that this interface is idle and may be suspended. As suspend operates at the device level, this will only trigger a removal of bus activity if all interfaces associated with the device are marked as suspended.

Parameters

TRequestStatus & aResumeSignal The TRequestStatus that will be completed when the interface is resumed.

RegisterTransferDescriptor(RUsbTransferDescriptor &)

IMPORT_C TInt RegisterTransferDescriptor ( RUsbTransferDescriptor & aTransfer )

Parameters

RUsbTransferDescriptor & aTransfer

RegisterTransferDescriptor(RUsbTransferDescriptor &, TUsbBusId)

TInt RegisterTransferDescriptor ( RUsbTransferDescriptor & aTransfer,
TUsbBusId aBusId
) [private]

Parameters

RUsbTransferDescriptor & aTransfer
TUsbBusId aBusId

ResetTransferDescriptors()

IMPORT_C void ResetTransferDescriptors ( )

SelectAlternateInterface(TInt)

TInt SelectAlternateInterface ( TInt aAlternateInterface ) [inline]

Select the specified alternate interface.

Asserts that all open pipes have been closed.

Parameters

TInt aAlternateInterface The alternate interface to select.

VersionRequired()

TVersion VersionRequired ( ) [static, inline]

The driver's version

Member Enumerations Documentation

Enum TDeviceSpeed

Enumerators

ELowSpeed
EFullSpeed
EHighSpeed

Enum TUsbInterfaceCancel

Enumerators

ECancelSuspend = 0x00000001
ECancelWaitForResume = 0x00000002
ECancelEp0Transfer = 0x00000004

Enum TUsbInterfaceControl

Enumerators

EOpenPipe
EPermitRemoteWakeup
EGetInterfaceDescriptorSize
EGetInterfaceDescriptor
EGetStringDescriptor
ESelectAlternateInterface
EAllocChunk
EGetDeviceSpeed
EGetBusId
EHcdPageSize
EGetSizeAndAlignment

Enum TUsbInterfaceRequest

Enumerators

ESuspend
EEp0Transfer

Member Data Documentation

TInt iAlternateSetting

TInt iAlternateSetting [private]

TUsbInterfaceDescriptor * iHeadInterfaceDescriptor

TUsbInterfaceDescriptor * iHeadInterfaceDescriptor [private]

HBufC8 * iInterfaceDescriptorData

HBufC8 * iInterfaceDescriptorData [private]

RUsbTransferStrategy * iTransferStrategy

RUsbTransferStrategy * iTransferStrategy [private]