DMDLL_USBGetConfigurationDescriptor

해당하는 USB장치에 대한 컨피규레이션 디스크립터(Configuration Descriptor)를 구한다


Description

int DMDLL_USBGetConfigurationDescriptor( 
    IN DMHANDLE MasterHandle,
    IN UCHAR    Index,
    IN int      Length,
    OUT PUSB_CONFIGURATION_DESCRIPTOR *ppDesciptor
)

Parameters

MasterHandle
    작업중이던 디바이스 핸들, DMDLL_OpenDeviceForInterfaceDeviceStack( PipeNumber = -1 )함수를 통해서 얻은 핸들(Master)이어야 한다
Index
    Configuration Descriptor의 인덱스를 명시한다. 보통은 0 값을 사용한다
Length
    구하고자 하는 디스크립터의 길이(바이트)
ppDescriptor
    DMCORE가 제공하는 메모리의 주소가 담겨진다.
    개발자는 이후에 더이상 이 메모리가 사용될 필요가 없을때는 반드시 해당하는 메모리를 해제해야 한다(DMDLL_USBReleaseResources)

Return Values

return  int
    작업이 성공할 경우 DMSTAT_SUCCESS 리턴

Changelog


Examples

int nRet = 0;
int Length = 0;
PUSB_CONFIGURATION_DESCRIPTOR pConfigurationDescriptor = 0;

nRet = DMDLL_USBGetConfigurationDescriptor(MasterHandle, 0, sizeof(USB_CONFIGURATION_DESCRIPTOR), &pConfigurationDescriptor ); // 표준 Configuration Descriptor를 읽는다

if( nRet == DMSTAT_SUCCESS ){
    // 전체 Configuration Descriptor의 크기를 확인한다
    Length = pConfigurationDescriptor->wTotalLength; 

    DMDLL_USBReleaseResources( pConfigurationDescriptor );

    // 전체 Configuration Descriptor를 읽는다
    nRet = DMDLL_USBGetConfigurationDescriptor(MasterHandle, 0, Length, &pConfigurationDescriptor); 
}

results matching ""

    No results matching ""