2012-04-25 22:26:35 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2012-04-25 22:26:35 +04:00
|
|
|
* RemoteFX USB Redirection
|
|
|
|
*
|
|
|
|
* Copyright 2012 Atrust corp.
|
|
|
|
* Copyright 2012 Alfred Liu <alfred.liu@atruscorp.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <freerdp/utils/debug.h>
|
|
|
|
#include <freerdp/utils/msusb.h>
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
static MSUSB_PIPE_DESCRIPTOR* msusb_mspipe_new()
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
2012-10-23 19:55:41 +04:00
|
|
|
MSUSB_PIPE_DESCRIPTOR* MsPipe = (MSUSB_PIPE_DESCRIPTOR*) malloc(sizeof(MSUSB_PIPE_DESCRIPTOR));
|
2012-04-25 22:26:35 +04:00
|
|
|
memset(MsPipe, 0, sizeof(MSUSB_PIPE_DESCRIPTOR));
|
|
|
|
return MsPipe;
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
static void msusb_mspipes_free(MSUSB_PIPE_DESCRIPTOR** MsPipes, UINT32 NumberOfPipes)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
int pnum = 0;
|
2012-10-23 19:55:41 +04:00
|
|
|
|
2012-04-25 22:26:35 +04:00
|
|
|
if (MsPipes)
|
|
|
|
{
|
|
|
|
for (pnum = 0; pnum < NumberOfPipes && MsPipes[pnum]; pnum++)
|
|
|
|
{
|
|
|
|
zfree(MsPipes[pnum]);
|
|
|
|
}
|
|
|
|
zfree(MsPipes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
void msusb_mspipes_replace(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, MSUSB_PIPE_DESCRIPTOR** NewMsPipes, UINT32 NewNumberOfPipes)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
/* free orignal MsPipes */
|
|
|
|
msusb_mspipes_free(MsInterface->MsPipes, MsInterface->NumberOfPipes);
|
|
|
|
/* And replace it */
|
|
|
|
MsInterface->MsPipes = NewMsPipes;
|
|
|
|
MsInterface->NumberOfPipes = NewNumberOfPipes;
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
static MSUSB_PIPE_DESCRIPTOR** msusb_mspipes_read(BYTE* data, UINT32 data_size, UINT32 NumberOfPipes, int* offset)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
int pnum, move = 0;
|
2012-10-23 19:55:41 +04:00
|
|
|
MSUSB_PIPE_DESCRIPTOR** MsPipes;
|
2012-04-25 22:26:35 +04:00
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
MsPipes = (MSUSB_PIPE_DESCRIPTOR**) malloc(NumberOfPipes * sizeof(MSUSB_PIPE_DESCRIPTOR*));
|
2012-04-25 22:26:35 +04:00
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
for (pnum = 0; pnum < NumberOfPipes; pnum++)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
MSUSB_PIPE_DESCRIPTOR * MsPipe = msusb_mspipe_new();
|
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
data_read_UINT16(data + move, MsPipe->MaximumPacketSize);
|
2012-10-09 11:26:39 +04:00
|
|
|
data_read_UINT32(data + move + 4, MsPipe->MaximumTransferSize);
|
|
|
|
data_read_UINT32(data + move + 8, MsPipe->PipeFlags);
|
2012-04-25 22:26:35 +04:00
|
|
|
move += 12;
|
|
|
|
/* Already set to zero by memset
|
|
|
|
MsPipe->PipeHandle = 0;
|
|
|
|
MsPipe->bEndpointAddress = 0;
|
|
|
|
MsPipe->bInterval = 0;
|
|
|
|
MsPipe->PipeType = 0;
|
|
|
|
MsPipe->InitCompleted = 0;
|
|
|
|
*/
|
|
|
|
|
|
|
|
MsPipes[pnum] = MsPipe;
|
|
|
|
}
|
|
|
|
*offset += move;
|
|
|
|
|
|
|
|
return MsPipes;
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
static MSUSB_INTERFACE_DESCRIPTOR* msusb_msinterface_new()
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
2012-10-23 19:55:41 +04:00
|
|
|
MSUSB_INTERFACE_DESCRIPTOR* MsInterface = (MSUSB_INTERFACE_DESCRIPTOR*) malloc(sizeof(MSUSB_INTERFACE_DESCRIPTOR));
|
2012-04-25 22:26:35 +04:00
|
|
|
memset(MsInterface, 0, sizeof(MSUSB_INTERFACE_DESCRIPTOR));
|
|
|
|
return MsInterface;
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
static void msusb_msinterface_free(MSUSB_INTERFACE_DESCRIPTOR* MsInterface)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
if (MsInterface)
|
|
|
|
{
|
|
|
|
msusb_mspipes_free(MsInterface->MsPipes, MsInterface->NumberOfPipes);
|
|
|
|
MsInterface->MsPipes = NULL;
|
|
|
|
zfree(MsInterface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
static void msusb_msinterface_free_list(MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces, UINT32 NumInterfaces)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
int inum = 0;
|
|
|
|
|
|
|
|
if (MsInterfaces)
|
|
|
|
{
|
|
|
|
for (inum = 0; inum < NumInterfaces; inum++)
|
|
|
|
{
|
|
|
|
msusb_msinterface_free(MsInterfaces[inum]);
|
|
|
|
}
|
2012-10-23 19:55:41 +04:00
|
|
|
|
2012-04-25 22:26:35 +04:00
|
|
|
zfree(MsInterfaces);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
void msusb_msinterface_replace(MSUSB_CONFIG_DESCRIPTOR* MsConfig, BYTE InterfaceNumber, MSUSB_INTERFACE_DESCRIPTOR* NewMsInterface)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
msusb_msinterface_free(MsConfig->MsInterfaces[InterfaceNumber]);
|
|
|
|
MsConfig->MsInterfaces[InterfaceNumber] = NewMsInterface;
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
MSUSB_INTERFACE_DESCRIPTOR* msusb_msinterface_read(BYTE* data, UINT32 data_size, int* offset)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
2012-10-23 19:55:41 +04:00
|
|
|
MSUSB_INTERFACE_DESCRIPTOR* MsInterface;
|
2012-04-25 22:26:35 +04:00
|
|
|
|
|
|
|
MsInterface = msusb_msinterface_new();
|
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
data_read_UINT16(data, MsInterface->Length);
|
|
|
|
data_read_UINT16(data + 2, MsInterface->NumberOfPipesExpected);
|
|
|
|
data_read_BYTE(data + 4, MsInterface->InterfaceNumber);
|
|
|
|
data_read_BYTE(data + 5, MsInterface->AlternateSetting);
|
2012-10-09 11:26:39 +04:00
|
|
|
data_read_UINT32(data + 8, MsInterface->NumberOfPipes);
|
2012-04-25 22:26:35 +04:00
|
|
|
*offset += 12;
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
MsInterface->InterfaceHandle = 0;
|
|
|
|
MsInterface->bInterfaceClass = 0;
|
2012-04-25 22:26:35 +04:00
|
|
|
MsInterface->bInterfaceSubClass = 0;
|
|
|
|
MsInterface->bInterfaceProtocol = 0;
|
2012-10-23 19:55:41 +04:00
|
|
|
MsInterface->InitCompleted = 0;
|
|
|
|
MsInterface->MsPipes = NULL;
|
2012-04-25 22:26:35 +04:00
|
|
|
|
|
|
|
if (MsInterface->NumberOfPipes > 0)
|
|
|
|
{
|
|
|
|
MsInterface->MsPipes =
|
|
|
|
msusb_mspipes_read(data+(*offset), data_size-(*offset), MsInterface->NumberOfPipes, offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
return MsInterface;
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
int msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, BYTE* data, int* offset)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
MSUSB_PIPE_DESCRIPTOR ** MsPipes;
|
|
|
|
MSUSB_PIPE_DESCRIPTOR * MsPipe;
|
|
|
|
int pnum = 0, move = 0;
|
|
|
|
|
|
|
|
/* Length */
|
2012-10-09 11:01:37 +04:00
|
|
|
data_write_UINT16(data, MsInterface->Length);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* InterfaceNumber */
|
2012-10-09 11:01:37 +04:00
|
|
|
data_write_BYTE(data + 2, MsInterface->InterfaceNumber);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* AlternateSetting */
|
2012-10-09 11:01:37 +04:00
|
|
|
data_write_BYTE(data + 3, MsInterface->AlternateSetting);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* bInterfaceClass */
|
2012-10-09 11:01:37 +04:00
|
|
|
data_write_BYTE(data + 4, MsInterface->bInterfaceClass);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* bInterfaceSubClass */
|
2012-10-09 11:01:37 +04:00
|
|
|
data_write_BYTE(data + 5, MsInterface->bInterfaceSubClass);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* bInterfaceProtocol */
|
2012-10-09 11:01:37 +04:00
|
|
|
data_write_BYTE(data + 6, MsInterface->bInterfaceProtocol);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* Padding */
|
2012-10-09 11:01:37 +04:00
|
|
|
data_write_BYTE(data + 7, 0);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* InterfaceHandle */
|
2012-10-09 11:26:39 +04:00
|
|
|
data_write_UINT32(data + 8, MsInterface->InterfaceHandle);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* NumberOfPipes */
|
2012-10-09 11:26:39 +04:00
|
|
|
data_write_UINT32(data + 12, MsInterface->NumberOfPipes);
|
2012-04-25 22:26:35 +04:00
|
|
|
move += 16;
|
|
|
|
/* Pipes */
|
|
|
|
MsPipes = MsInterface->MsPipes;
|
|
|
|
for(pnum = 0; pnum < MsInterface->NumberOfPipes; pnum++)
|
|
|
|
{
|
|
|
|
MsPipe = MsPipes[pnum];
|
|
|
|
/* MaximumPacketSize */
|
2012-10-09 11:01:37 +04:00
|
|
|
data_write_UINT16(data + move, MsPipe->MaximumPacketSize);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* EndpointAddress */
|
2012-10-09 11:01:37 +04:00
|
|
|
data_write_BYTE(data + move + 2, MsPipe->bEndpointAddress);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* Interval */
|
2012-10-09 11:01:37 +04:00
|
|
|
data_write_BYTE(data + move + 3, MsPipe->bInterval);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* PipeType */
|
2012-10-09 11:26:39 +04:00
|
|
|
data_write_UINT32(data + move + 4, MsPipe->PipeType);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* PipeHandle */
|
2012-10-09 11:26:39 +04:00
|
|
|
data_write_UINT32(data + move + 8, MsPipe->PipeHandle);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* MaximumTransferSize */
|
2012-10-09 11:26:39 +04:00
|
|
|
data_write_UINT32(data + move + 12, MsPipe->MaximumTransferSize);
|
2012-04-25 22:26:35 +04:00
|
|
|
/* PipeFlags */
|
2012-10-09 11:26:39 +04:00
|
|
|
data_write_UINT32(data + move + 16, MsPipe->PipeFlags);
|
2012-04-25 22:26:35 +04:00
|
|
|
|
|
|
|
move += 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
*offset += move;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
static MSUSB_INTERFACE_DESCRIPTOR** msusb_msinterface_read_list(BYTE * data, UINT32 data_size, UINT32 NumInterfaces)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
int inum, offset = 0;
|
2012-10-23 19:55:41 +04:00
|
|
|
MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces;
|
2012-04-25 22:26:35 +04:00
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
MsInterfaces = (MSUSB_INTERFACE_DESCRIPTOR**) malloc(NumInterfaces * sizeof(MSUSB_INTERFACE_DESCRIPTOR*));
|
2012-04-25 22:26:35 +04:00
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
for (inum = 0; inum < NumInterfaces; inum++)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
MsInterfaces[inum] = msusb_msinterface_read(data + offset, data_size - offset, &offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
return MsInterfaces;
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
int msusb_msconfig_write(MSUSB_CONFIG_DESCRIPTOR* MsConfg, BYTE* data, int* offset)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
int inum = 0;
|
2012-10-23 19:55:41 +04:00
|
|
|
MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces;
|
|
|
|
MSUSB_INTERFACE_DESCRIPTOR* MsInterface;
|
2012-04-25 22:26:35 +04:00
|
|
|
|
|
|
|
/* ConfigurationHandle*/
|
2012-10-23 19:55:41 +04:00
|
|
|
data_write_UINT32(data + *offset, MsConfg->ConfigurationHandle);
|
|
|
|
|
2012-04-25 22:26:35 +04:00
|
|
|
/* NumInterfaces*/
|
2012-10-09 11:26:39 +04:00
|
|
|
data_write_UINT32(data + *offset + 4, MsConfg->NumInterfaces);
|
2012-04-25 22:26:35 +04:00
|
|
|
*offset += 8;
|
2012-10-23 19:55:41 +04:00
|
|
|
|
2012-04-25 22:26:35 +04:00
|
|
|
/* Interfaces */
|
2012-10-23 19:55:41 +04:00
|
|
|
|
2012-04-25 22:26:35 +04:00
|
|
|
MsInterfaces = MsConfg->MsInterfaces;
|
2012-10-23 19:55:41 +04:00
|
|
|
|
2012-04-25 22:26:35 +04:00
|
|
|
for(inum = 0; inum < MsConfg->NumInterfaces; inum++)
|
|
|
|
{
|
|
|
|
MsInterface = MsInterfaces[inum];
|
|
|
|
msusb_msinterface_write(MsInterface, data + (*offset), offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
MSUSB_CONFIG_DESCRIPTOR* msusb_msconfig_new()
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
2012-10-23 19:55:41 +04:00
|
|
|
MSUSB_CONFIG_DESCRIPTOR* MsConfig = NULL;
|
|
|
|
MsConfig = (MSUSB_CONFIG_DESCRIPTOR*) malloc(sizeof(MSUSB_CONFIG_DESCRIPTOR));
|
2012-04-25 22:26:35 +04:00
|
|
|
memset(MsConfig, 0, sizeof(MSUSB_CONFIG_DESCRIPTOR));
|
|
|
|
|
|
|
|
return MsConfig;
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
void msusb_msconfig_free(MSUSB_CONFIG_DESCRIPTOR* MsConfig)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
if (MsConfig)
|
|
|
|
{
|
|
|
|
msusb_msinterface_free_list(MsConfig->MsInterfaces, MsConfig->NumInterfaces);
|
|
|
|
MsConfig->MsInterfaces = NULL;
|
|
|
|
zfree(MsConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
MSUSB_CONFIG_DESCRIPTOR* msusb_msconfig_read(BYTE* data, UINT32 data_size, UINT32 NumInterfaces)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
int i, offset = 0;
|
2012-10-23 19:55:41 +04:00
|
|
|
UINT16 lenInterface;
|
|
|
|
MSUSB_CONFIG_DESCRIPTOR* MsConfig;
|
|
|
|
BYTE lenConfiguration, typeConfiguration;
|
2012-04-25 22:26:35 +04:00
|
|
|
|
|
|
|
MsConfig = msusb_msconfig_new();
|
|
|
|
|
|
|
|
for(i = 0; i < NumInterfaces; i++)
|
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
data_read_UINT16(data + offset, lenInterface);
|
2012-04-25 22:26:35 +04:00
|
|
|
offset += lenInterface;
|
|
|
|
}
|
2012-10-23 19:55:41 +04:00
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
data_read_BYTE(data + offset, lenConfiguration);
|
|
|
|
data_read_BYTE(data + offset + 1, typeConfiguration);
|
2012-10-23 19:55:41 +04:00
|
|
|
|
2012-04-25 22:26:35 +04:00
|
|
|
if (lenConfiguration != 0x9 || typeConfiguration != 0x2)
|
|
|
|
{
|
2013-01-14 14:47:24 +04:00
|
|
|
DEBUG_MSG("%s: len and type must be 0x9 and 0x2 , but it is 0x%x and 0x%x",
|
2012-04-25 22:26:35 +04:00
|
|
|
lenConfiguration, typeConfiguration);
|
|
|
|
}
|
2012-10-23 19:55:41 +04:00
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
data_read_UINT16(data + offset + 2, MsConfig->wTotalLength);
|
|
|
|
data_read_BYTE(data + offset + 5, MsConfig->bConfigurationValue);
|
2012-10-23 19:55:41 +04:00
|
|
|
|
|
|
|
MsConfig->NumInterfaces = NumInterfaces;
|
2012-04-25 22:26:35 +04:00
|
|
|
MsConfig->ConfigurationHandle = 0;
|
2012-10-23 19:55:41 +04:00
|
|
|
MsConfig->InitCompleted = 0;
|
|
|
|
MsConfig->MsOutSize = 0;
|
|
|
|
MsConfig->MsInterfaces = NULL;
|
2012-04-25 22:26:35 +04:00
|
|
|
offset = 0;
|
|
|
|
|
|
|
|
if (NumInterfaces > 0)
|
|
|
|
{
|
2012-10-23 19:55:41 +04:00
|
|
|
MsConfig->MsInterfaces = msusb_msinterface_read_list(data, data_size, NumInterfaces);
|
2012-04-25 22:26:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return MsConfig;
|
|
|
|
}
|
|
|
|
|
2012-10-23 19:55:41 +04:00
|
|
|
void msusb_msconfig_dump(MSUSB_CONFIG_DESCRIPTOR* MsConfig)
|
2012-04-25 22:26:35 +04:00
|
|
|
{
|
|
|
|
MSUSB_INTERFACE_DESCRIPTOR ** MsInterfaces;
|
|
|
|
MSUSB_INTERFACE_DESCRIPTOR * MsInterface;
|
|
|
|
MSUSB_PIPE_DESCRIPTOR ** MsPipes;
|
|
|
|
MSUSB_PIPE_DESCRIPTOR * MsPipe;
|
|
|
|
int inum = 0, pnum = 0;
|
|
|
|
|
|
|
|
printf("=================MsConfig:========================\n");
|
|
|
|
printf("wTotalLength:%d\n", MsConfig->wTotalLength);
|
|
|
|
printf("bConfigurationValue:%d\n", MsConfig->bConfigurationValue);
|
|
|
|
printf("ConfigurationHandle:0x%x\n", MsConfig->ConfigurationHandle);
|
|
|
|
printf("InitCompleted:%d\n", MsConfig->InitCompleted);
|
|
|
|
printf("MsOutSize:%d\n", MsConfig->MsOutSize);
|
|
|
|
printf("NumInterfaces:%d\n\n", MsConfig->NumInterfaces);
|
|
|
|
MsInterfaces = MsConfig->MsInterfaces;
|
|
|
|
for(inum = 0; inum < MsConfig->NumInterfaces; inum++)
|
|
|
|
{
|
|
|
|
MsInterface = MsInterfaces[inum];
|
|
|
|
printf(" Interfase: %d\n", MsInterface->InterfaceNumber);
|
|
|
|
printf(" Length: %d\n", MsInterface->Length);
|
|
|
|
printf(" NumberOfPipesExpected: %d\n", MsInterface->NumberOfPipesExpected);
|
|
|
|
printf(" AlternateSetting: %d\n", MsInterface->AlternateSetting);
|
|
|
|
printf(" NumberOfPipes: %d\n", MsInterface->NumberOfPipes);
|
|
|
|
printf(" InterfaceHandle: 0x%x\n", MsInterface->InterfaceHandle);
|
|
|
|
printf(" bInterfaceClass: 0x%x\n", MsInterface->bInterfaceClass);
|
|
|
|
printf(" bInterfaceSubClass: 0x%x\n", MsInterface->bInterfaceSubClass);
|
|
|
|
printf(" bInterfaceProtocol: 0x%x\n", MsInterface->bInterfaceProtocol);
|
|
|
|
printf(" InitCompleted: %d\n\n", MsInterface->InitCompleted);
|
|
|
|
MsPipes = MsInterface->MsPipes;
|
|
|
|
for (pnum = 0; pnum < MsInterface->NumberOfPipes; pnum++)
|
|
|
|
{
|
|
|
|
MsPipe = MsPipes[pnum];
|
|
|
|
printf(" Pipe: %d\n", pnum);
|
|
|
|
printf(" MaximumPacketSize: 0x%x\n", MsPipe->MaximumPacketSize);
|
|
|
|
printf(" MaximumTransferSize: 0x%x\n", MsPipe->MaximumTransferSize);
|
|
|
|
printf(" PipeFlags: 0x%x\n", MsPipe->PipeFlags);
|
|
|
|
printf(" PipeHandle: 0x%x\n", MsPipe->PipeHandle);
|
|
|
|
printf(" bEndpointAddress: 0x%x\n", MsPipe->bEndpointAddress);
|
|
|
|
printf(" bInterval: %d\n", MsPipe->bInterval);
|
|
|
|
printf(" PipeType: 0x%x\n", MsPipe->PipeType);
|
|
|
|
printf(" InitCompleted: %d\n\n", MsPipe->InitCompleted);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("==================================================\n");
|
|
|
|
}
|