[USBOHCI]

- Fix bugs in HandleClassEndpoint, HandleClassInterface which always set direction device to host instead of relying to the transfer flags provided
- Allow setup packets w/o a data stage

svn path=/branches/usb-bringup-trunk/; revision=55360
This commit is contained in:
Johannes Anderwald 2012-02-01 02:36:53 +00:00
parent 78f3a69807
commit ba8cbe2e17
2 changed files with 40 additions and 24 deletions

View file

@ -1660,12 +1660,21 @@ CHubController::HandleClassEndpoint(
//
// initialize setup packet
//
CtrlSetup.bmRequestType.B = 0xa2; //FIXME: Const.
CtrlSetup.bmRequestType.B = 0x22; //FIXME: Const.
CtrlSetup.bRequest = Urb->UrbControlVendorClassRequest.Request;
CtrlSetup.wValue.W = Urb->UrbControlVendorClassRequest.Value;
CtrlSetup.wIndex.W = Urb->UrbControlVendorClassRequest.Index;
CtrlSetup.wLength = Urb->UrbControlVendorClassRequest.TransferBufferLength;
if (Urb->UrbControlVendorClassRequest.TransferFlags & USBD_TRANSFER_DIRECTION_IN)
{
//
// data direction is device to host
//
CtrlSetup.bmRequestType.B |= 0x80;
}
//
// issue request
//
@ -1729,24 +1738,23 @@ CHubController::HandleClassInterface(
DPRINT1("Value %x\n", Urb->UrbControlVendorClassRequest.Value);
DPRINT1("Index %x\n", Urb->UrbControlVendorClassRequest.Index);
if (Urb->UrbControlVendorClassRequest.TransferBufferLength == 0)
{
//
// FIXME: support requests w/o data stage
//;
ASSERT(FALSE);
return STATUS_SUCCESS;
}
//
// initialize setup packet
//
CtrlSetup.bmRequestType.B = 0xa1;
CtrlSetup.bmRequestType.B = 0x21;
CtrlSetup.bRequest = Urb->UrbControlVendorClassRequest.Request;
CtrlSetup.wValue.W = Urb->UrbControlVendorClassRequest.Value;
CtrlSetup.wIndex.W = Urb->UrbControlVendorClassRequest.Index;
CtrlSetup.wLength = Urb->UrbControlVendorClassRequest.TransferBufferLength;
if (Urb->UrbControlVendorClassRequest.TransferFlags & USBD_TRANSFER_DIRECTION_IN)
{
//
// data direction is device to host
//
CtrlSetup.bmRequestType.B |= 0x80;
}
//
// issue request
//

View file

@ -858,27 +858,35 @@ CUSBDevice::SubmitSetupPacket(
OUT PVOID Buffer)
{
NTSTATUS Status;
PMDL Mdl;
PMDL Mdl = NULL;
//
// allocate mdl
//
Mdl = IoAllocateMdl(Buffer, BufferLength, FALSE, FALSE, 0);
if (BufferLength)
{
//
// allocate mdl
//
Mdl = IoAllocateMdl(Buffer, BufferLength, FALSE, FALSE, 0);
if (!Mdl)
return STATUS_INSUFFICIENT_RESOURCES;
//
// HACK HACK HACK: assume the buffer is build from non paged pool
//
MmBuildMdlForNonPagedPool(Mdl);
//
// HACK HACK HACK: assume the buffer is build from non paged pool
//
MmBuildMdlForNonPagedPool(Mdl);
}
//
// commit setup packet
//
Status = CommitSetupPacket(SetupPacket, 0, BufferLength, Mdl);
//
// free mdl
//
IoFreeMdl(Mdl);
if (Mdl != NULL)
{
//
// free mdl
//
IoFreeMdl(Mdl);
}
//
// done