Author: janderwald
Date: Wed Feb 1 02:36:53 2012
New Revision: 55360
URL:
http://svn.reactos.org/svn/reactos?rev=55360&view=rev
Log:
[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
Modified:
branches/usb-bringup-trunk/drivers/usb/usbohci/hub_controller.cpp
branches/usb-bringup-trunk/drivers/usb/usbohci/usb_device.cpp
Modified: branches/usb-bringup-trunk/drivers/usb/usbohci/hub_controller.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbohci/hub_controller.cpp [iso-8859-1]
(original)
+++ branches/usb-bringup-trunk/drivers/usb/usbohci/hub_controller.cpp [iso-8859-1] Wed Feb
1 02:36:53 2012
@@ -1660,11 +1660,20 @@
//
// 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,23 +1738,22 @@
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
Modified: branches/usb-bringup-trunk/drivers/usb/usbohci/usb_device.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbohci/usb_device.cpp [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbohci/usb_device.cpp [iso-8859-1] Wed Feb 1
02:36:53 2012
@@ -858,27 +858,35 @@
OUT PVOID Buffer)
{
NTSTATUS Status;
- PMDL Mdl;
-
- //
- // allocate mdl
- //
- Mdl = IoAllocateMdl(Buffer, BufferLength, FALSE, FALSE, 0);
-
- //
- // HACK HACK HACK: assume the buffer is build from non paged pool
- //
- MmBuildMdlForNonPagedPool(Mdl);
+ PMDL Mdl = NULL;
+
+ 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);
+ }
//
// commit setup packet
//
Status = CommitSetupPacket(SetupPacket, 0, BufferLength, Mdl);
- //
- // free mdl
- //
- IoFreeMdl(Mdl);
+ if (Mdl != NULL)
+ {
+ //
+ // free mdl
+ //
+ IoFreeMdl(Mdl);
+ }
//
// done