[USBHUB]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Thu, 25 Oct 2012 15:36:09 +0000 (15:36 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Thu, 25 Oct 2012 15:36:09 +0000 (15:36 +0000)
- Partly implement IOCTL_USB_GET_NODE_CONNECTION_NAME
- Complete power irps

svn path=/trunk/; revision=57616

reactos/drivers/usb/usbhub/fdo.c
reactos/drivers/usb/usbhub/usbhub.c

index 05cb20e..ff56169 100644 (file)
@@ -2062,6 +2062,7 @@ USBHUB_FdoHandleDeviceControl(
     PUSB_NODE_CONNECTION_INFORMATION NodeConnectionInfo;
     PHUB_CHILDDEVICE_EXTENSION ChildDeviceExtension;
     PUSB_NODE_CONNECTION_DRIVERKEY_NAME NodeKey;
+    PUSB_NODE_CONNECTION_NAME ConnectionName;
     ULONG Index, Length;
 
     // get stack location
@@ -2141,7 +2142,6 @@ USBHUB_FdoHandleDeviceControl(
                 }
                 break;
             }
-
             // done
             Irp->IoStatus.Information = sizeof(USB_NODE_INFORMATION);
             Status = STATUS_SUCCESS;
@@ -2188,7 +2188,7 @@ USBHUB_FdoHandleDeviceControl(
                 if (Length + sizeof(USB_NODE_CONNECTION_DRIVERKEY_NAME) > IoStack->Parameters.DeviceIoControl.OutputBufferLength)
                 {
                     // terminate node key name
-                    NodeKey->DriverKeyName[0] = 0;
+                    NodeKey->DriverKeyName[0] = UNICODE_NULL;
                     Irp->IoStatus.Information = sizeof(USB_NODE_CONNECTION_DRIVERKEY_NAME);
                 }
                 else
@@ -2203,6 +2203,25 @@ USBHUB_FdoHandleDeviceControl(
             }
         }
     }
+    else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_USB_GET_NODE_CONNECTION_NAME)
+    {
+        if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(USB_NODE_CONNECTION_NAME))
+        {
+            // buffer too small
+            Status = STATUS_BUFFER_TOO_SMALL;
+        }
+        else
+        {
+            // FIXME support hubs
+            ConnectionName = (PUSB_NODE_CONNECTION_NAME)Irp->AssociatedIrp.SystemBuffer;
+            ConnectionName->ActualLength = 0;
+            ConnectionName->NodeName[0] = UNICODE_NULL;
+
+            // done
+            Irp->IoStatus.Information = sizeof(USB_NODE_CONNECTION_NAME);
+            Status = STATUS_SUCCESS;
+        }
+    }
     else
     {
         DPRINT1("UNIMPLEMENTED FdoHandleDeviceControl IoCtl %x InputBufferLength %x OutputBufferLength %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode, 
index 5e14a97..f34c4e4 100644 (file)
@@ -184,8 +184,39 @@ USBHUB_DispatchPower(
     PDEVICE_OBJECT DeviceObject,
     PIRP Irp)
 {
+    PIO_STACK_LOCATION IoStack;
+
+    IoStack = IoGetCurrentIrpStackLocation(Irp);
+    DPRINT1("Power Function %x\n", IoStack->MinorFunction);
+
+    if (IoStack->MinorFunction == IRP_MN_SET_POWER)
+    {
+        PoStartNextPowerIrp(Irp);
+        Irp->IoStatus.Status = STATUS_SUCCESS;
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        return STATUS_SUCCESS;
+
+    }
+    else if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
+    {
+        PoStartNextPowerIrp(Irp);
+        Irp->IoStatus.Status = STATUS_SUCCESS;
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        return STATUS_SUCCESS;
+
+    }
+    else if (IoStack->MinorFunction == IRP_MN_WAIT_WAKE)
+    {
+        PoStartNextPowerIrp(Irp);
+        Irp->IoStatus.Status = STATUS_SUCCESS;
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        return STATUS_SUCCESS;
+    }
+
+    PoStartNextPowerIrp(Irp);
+    Irp->IoStatus.Status = STATUS_SUCCESS;
     IoCompleteRequest(Irp, IO_NO_INCREMENT);
-    return STATUS_NOT_SUPPORTED;
+    return STATUS_SUCCESS;
 }
 
 VOID