Author: vmikayelyan
Date: Fri Aug 19 16:22:18 2016
New Revision: 72379
URL: http://svn.reactos.org/svn/reactos?rev=72379&view=rev
Log:
usb: hub: FDO: Fix CreateUsbChildDeviceObject()
There were code dublication on copy device interface, also after
copying interface, we should call InterfaceReference() routine of
interface, to prevent interface provider deleiton.
I have moved RtlCopyMemory() and InterfaceReference() to the end
of this function to siplify cleanup part, because otherwise we should
call InterfaceDereference() in cleanup part.
The changing of interface context seems wrong for me, let me give just
one example. When we are changing only buscontext, then when upper
layer calls interfaceDereference(), which is "thinking" that works with
it's buscontext, and tries to work with it using it's buscontext
pointer. So changing of buscontext is completely wrong.
Modified:
branches/GSoC_2016/USB/drivers/usb/usbhub/fdo.c
Modified: branches/GSoC_2016/USB/drivers/usb/usbhub/fdo.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/USB/drivers/usb/usbhu…
==============================================================================
--- branches/GSoC_2016/USB/drivers/usb/usbhub/fdo.c [iso-8859-1] (original)
+++ branches/GSoC_2016/USB/drivers/usb/usbhub/fdo.c [iso-8859-1] Fri Aug 19 16:22:18 2016
@@ -1232,10 +1232,6 @@
UsbChildExtension->ParentDeviceObject = UsbHubDeviceObject;
UsbChildExtension->PortNumber = PortId;
- // copy device interface
- RtlCopyMemory(&UsbChildExtension->DeviceInterface, &HubDeviceExtension->DeviceInterface, sizeof(USB_BUS_INTERFACE_USBDI_V2));
-
-
//
// Create the UsbDeviceObject
//
@@ -1249,12 +1245,6 @@
DPRINT1("USBHUB: CreateUsbDevice failed with status %x\n", Status);
goto Cleanup;
}
-
- // copy device interface
- RtlCopyMemory(&UsbChildExtension->DeviceInterface, &HubDeviceExtension->DeviceInterface, sizeof(USB_BUS_INTERFACE_USBDI_V2));
-
- // FIXME replace buscontext
- UsbChildExtension->DeviceInterface.BusContext = UsbChildExtension->UsbDeviceHandle;
//
// Initialize UsbDevice
@@ -1344,6 +1334,10 @@
DPRINT1("Failed to create strings needed to describe device to PNP.\n");
goto Cleanup;
}
+
+ // copy device interface
+ RtlCopyMemory(&UsbChildExtension->DeviceInterface, &HubDeviceExtension->UsbDInterface, sizeof(USB_BUS_INTERFACE_USBDI_V2));
+ UsbChildExtension->DeviceInterface.InterfaceReference(UsbChildExtension->DeviceInterface.BusContext);
UsbChildExtension->IsRemovePending = FALSE;
Author: vmikayelyan
Date: Fri Aug 19 16:20:32 2016
New Revision: 72378
URL: http://svn.reactos.org/svn/reactos?rev=72378&view=rev
Log:
usb: libusb: hub_controller: Fix PnP handler
In some cases our driver was changing IRP status in places where it
shouldn't.
Modified:
branches/GSoC_2016/USB/sdk/lib/drivers/libusb/hub_controller.cpp
Modified: branches/GSoC_2016/USB/sdk/lib/drivers/libusb/hub_controller.cpp
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/USB/sdk/lib/drivers/l…
==============================================================================
--- branches/GSoC_2016/USB/sdk/lib/drivers/libusb/hub_controller.cpp [iso-8859-1] (original)
+++ branches/GSoC_2016/USB/sdk/lib/drivers/libusb/hub_controller.cpp [iso-8859-1] Fri Aug 19 16:20:32 2016
@@ -568,7 +568,8 @@
break;
}
}
- Status = STATUS_SUCCESS;
+ // Here we should leave Status as is.
+ Status = Irp->IoStatus.Status;
break;
}
case IRP_MN_QUERY_CAPABILITIES:
@@ -611,6 +612,14 @@
// handle device interface requests
//
Status = HandleQueryInterface(IoStack);
+
+ //
+ // If a bus driver does not export the requested interface, it
+ // should leave Status as is.
+ //
+ if (Status == STATUS_NOT_SUPPORTED)
+ Status = Irp->IoStatus.Status;
+
break;
}
case IRP_MN_REMOVE_DEVICE:
Author: vmikayelyan
Date: Fri Aug 19 15:50:18 2016
New Revision: 72373
URL: http://svn.reactos.org/svn/reactos?rev=72373&view=rev
Log:
usb: hub: PDO: Fix in IRP_MN_QUERY_DEVICE_RELATIONS
Here we shouldn't modify information field of IRP, because for example
in case of bus relations IRP must reach the stack's PDO collecting on
its way all relations.
This was the one of the causes of MS's usbccgp fail. usbccgp was not
able to report to PnP manager about it's child devices.
There is also another issues in usbuhci, which prevents usbccgp from
normal operation.
[THIS PATCH SHULD NOT BE MERGED WITH TRUNK UNTIL UHCI BUGS ARE NOT FIXED]
Modified:
branches/GSoC_2016/USB/drivers/usb/usbhub/pdo.c
Modified: branches/GSoC_2016/USB/drivers/usb/usbhub/pdo.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/USB/drivers/usb/usbhu…
==============================================================================
--- branches/GSoC_2016/USB/drivers/usb/usbhub/pdo.c [iso-8859-1] (original)
+++ branches/GSoC_2016/USB/drivers/usb/usbhub/pdo.c [iso-8859-1] Fri Aug 19 15:50:18 2016
@@ -711,6 +711,7 @@
{
/* not supported */
Status = Irp->IoStatus.Status;
+ Information = Irp->IoStatus.Information;
break;
}