[ros-diffs] [cgutman] 55339: [USBHUB] - Missed a fix from last commit - Wait for the device status change work item to complete - The USB stack is now properly constructed for USB booting

cgutman at svn.reactos.org cgutman at svn.reactos.org
Mon Jan 30 22:45:16 UTC 2012


Author: cgutman
Date: Mon Jan 30 22:45:16 2012
New Revision: 55339

URL: http://svn.reactos.org/svn/reactos?rev=55339&view=rev
Log:
[USBHUB]
- Missed a fix from last commit
- Wait for the device status change work item to complete
- The USB stack is now properly constructed for USB booting

Modified:
    branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c
    branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.h

Modified: branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c
URL: http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c?rev=55339&r1=55338&r2=55339&view=diff
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c [iso-8859-1] Mon Jan 30 22:45:16 2012
@@ -260,8 +260,6 @@
     PORT_STATUS_CHANGE PortStatus;
     LONG PortId;
 
-    static LONG failsafe = 0;
-
     DPRINT1("Entered DeviceStatusChangeThread, Context %x\n", Context);
 
     WorkItemData = (PWORK_ITEM_DATA)Context;
@@ -408,20 +406,7 @@
         }
     }
 
-    //
-    // FIXME: Still in testing
-    //
-    failsafe++;
-    if (failsafe > 100)
-    {
-        DPRINT1("SCE completed over 100 times but no action has been taken to clear the Change of any ports.\n");
-        //
-        // Return and dont send any more SCE Requests
-        //
-        return;
-    }
-
-    ExFreePool(WorkItemData);
+    KeSetEvent(&WorkItemData->Event, IO_NO_INCREMENT, FALSE);
 
     //
     // Send another SCE Request
@@ -460,6 +445,7 @@
         return STATUS_INSUFFICIENT_RESOURCES;
     }
     WorkItemData->Context = RealDeviceObject;
+    KeInitializeEvent(&WorkItemData->Event, NotificationEvent, FALSE);
     DPRINT1("Initialize work item\n");
     ExInitializeWorkItem(&WorkItemData->WorkItem, DeviceStatusChangeThread, (PVOID)WorkItemData);
 
@@ -467,6 +453,16 @@
     // Queue the work item to handle initializing the device
     //
     ExQueueWorkItem(&WorkItemData->WorkItem, DelayedWorkQueue);
+
+    //
+    // Wait for the work item
+    //
+    KeWaitForSingleObject(&WorkItemData->Event,
+                          Executive,
+                          KernelMode,
+                          FALSE,
+                          NULL);
+    ExFreePool(WorkItemData);
 
     //
     // Return more processing required so the IO Manger doesn’t try to mess with IRP just freed
@@ -1823,6 +1819,11 @@
             }
             else
             {
+                //
+                // Send the first SCE Request
+                //
+                QueryStatusChangeEndpoint(DeviceObject);
+
                 //
                 // reset ports
                 //
@@ -1848,11 +1849,6 @@
                         }
                     }
                 }
-
-                //
-                // Send the first SCE Request
-                //
-                QueryStatusChangeEndpoint(DeviceObject);
             }
 
             ExFreePool(Urb);

Modified: branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.h
URL: http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.h?rev=55339&r1=55338&r2=55339&view=diff
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.h [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.h [iso-8859-1] Mon Jan 30 22:45:16 2012
@@ -44,6 +44,7 @@
 typedef struct _WORK_ITEM_DATA
 {
     WORK_QUEUE_ITEM WorkItem;
+    KEVENT Event;
     PVOID Context;
 } WORK_ITEM_DATA, *PWORK_ITEM_DATA;
 




More information about the Ros-diffs mailing list