diff --git a/drivers/usb/usbohci/hub_controller.cpp b/drivers/usb/usbohci/hub_controller.cpp index 02e96cba674..c89cf5afd5d 100644 --- a/drivers/usb/usbohci/hub_controller.cpp +++ b/drivers/usb/usbohci/hub_controller.cpp @@ -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 // diff --git a/drivers/usb/usbohci/usb_device.cpp b/drivers/usb/usbohci/usb_device.cpp index 67936699cc0..0c1cf9c17cf 100644 --- a/drivers/usb/usbohci/usb_device.cpp +++ b/drivers/usb/usbohci/usb_device.cpp @@ -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