mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
[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:
parent
78f3a69807
commit
ba8cbe2e17
2 changed files with 40 additions and 24 deletions
|
@ -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
|
||||
//
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue