Index: drivers/hid/hidclass/fdo.c =================================================================== --- drivers/hid/hidclass/fdo.c (revision 70555) +++ drivers/hid/hidclass/fdo.c (working copy) @@ -10,7 +10,7 @@ #include "precomp.h" -#define NDEBUG +//#define NDEBUG #include NTSTATUS Index: drivers/hid/hidclass/pdo.c =================================================================== --- drivers/hid/hidclass/pdo.c (revision 70555) +++ drivers/hid/hidclass/pdo.c (working copy) @@ -12,7 +12,7 @@ #include -#define NDEBUG +//#define NDEBUG #include PHIDP_COLLECTION_DESC Index: drivers/hid/hidparse/hidparse.c =================================================================== --- drivers/hid/hidparse/hidparse.c (revision 70555) +++ drivers/hid/hidparse/hidparse.c (working copy) @@ -10,7 +10,7 @@ #include "hidparse.h" -#define NDEBUG +//#define NDEBUG #include PVOID Index: drivers/hid/hidusb/hidusb.h =================================================================== --- drivers/hid/hidusb/hidusb.h (revision 70555) +++ drivers/hid/hidusb/hidusb.h (working copy) @@ -2,7 +2,7 @@ #define _HIDPI_ #define _HIDPI_NO_FUNCTION_MACROS_ -#define NDEBUG +//#define NDEBUG #include #include #include Index: drivers/hid/mouhid/mouhid.h =================================================================== --- drivers/hid/mouhid/mouhid.h (revision 70555) +++ drivers/hid/mouhid/mouhid.h (working copy) @@ -5,7 +5,7 @@ #include #include #include -#define NDEBUG +//#define NDEBUG #include #include #include Index: drivers/usb/usbd/usbd.c =================================================================== --- drivers/usb/usbd/usbd.c (revision 70555) +++ drivers/usb/usbd/usbd.c (working copy) @@ -33,7 +33,7 @@ */ #define _USBD_ -#define NDEBUG +//#define NDEBUG #include #include #include Index: drivers/usb/usbhub/fdo.c =================================================================== --- drivers/usb/usbhub/fdo.c (revision 70555) +++ drivers/usb/usbhub/fdo.c (working copy) @@ -12,7 +12,7 @@ #include -#define NDEBUG +//#define NDEBUG #include NTSTATUS @@ -1325,7 +1325,7 @@ &DeviceInfoSize); - //DumpFullConfigurationDescriptor(UsbChildExtension->FullConfigDesc); + DumpFullConfigurationDescriptor(UsbChildExtension->FullConfigDesc); // // Construct all the strings that will describe the device to PNP Index: drivers/usb/usbhub/pdo.c =================================================================== --- drivers/usb/usbhub/pdo.c (revision 70555) +++ drivers/usb/usbhub/pdo.c (working copy) @@ -13,7 +13,7 @@ #include -#define NDEBUG +//#define NDEBUG #include #define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003) Index: drivers/usb/usbohci/hardware.cpp =================================================================== --- drivers/usb/usbohci/hardware.cpp (revision 70555) +++ drivers/usb/usbohci/hardware.cpp (working copy) @@ -10,7 +10,7 @@ #include "usbohci.h" -#define NDEBUG +//#define NDEBUG #include typedef VOID __stdcall HD_INIT_CALLBACK(IN PVOID CallBackContext); @@ -475,6 +475,7 @@ // check context // Control = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_CONTROL_OFFSET)); + DPRINT("Controller First State %x\n", Control); //Save this NewControl = Control & OHCI_REMOTE_WAKEUP_CONNECTED; @@ -484,13 +485,29 @@ // // change ownership // + if ( READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_INTERRUPT_ENABLE_OFFSET)) == 0) + { + //HcInterruptEnable.MIE == 0 + WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_CONTROL_OFFSET), 0); + DPRINT("Controller HcInterruptEnable.MIE == 0\n"); + goto Label1; + } + + //HcInterruptEnable.MIE (MasterInterruptEnable) set + WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_INTERRUPT_ENABLE_OFFSET), OHCI_MASTER_INTERRUPT_ENABLE); + + //HcCommandStatus.OwnershipChangeRequest set WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_COMMAND_STATUS_OFFSET), OHCI_OWNERSHIP_CHANGE_REQUEST); - for(Index = 0; Index < 100; Index++) + + //HcInterruptDisable.RHSC - Disable interrupt generation due to Root Hub Status Change. + WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_INTERRUPT_DISABLE_OFFSET), OHCI_ROOT_HUB_STATUS_CHANGE); + + for (Index = 0; Index < 1000000; Index++) { // // wait a bit // - KeStallExecutionProcessor(100); + KeStallExecutionProcessor(50); // // check control @@ -498,9 +515,14 @@ Control = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_CONTROL_OFFSET)); if (!(Control & OHCI_INTERRUPT_ROUTING)) { - // - // acquired ownership - // + DPRINT("Controller acquired ownership\n"); + + //HcInterruptStatus clear + WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_INTERRUPT_STATUS_OFFSET), 0xFFFFFFFF); + + //HcInterruptDisable.MIE - Disable interrupt generation. + WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_INTERRUPT_DISABLE_OFFSET), OHCI_MASTER_INTERRUPT_ENABLE); + break; } } @@ -518,6 +540,8 @@ } } +Label1: + // // read contents of control register // Index: lib/drivers/libusb/hcd_controller.cpp =================================================================== --- lib/drivers/libusb/hcd_controller.cpp (revision 70555) +++ lib/drivers/libusb/hcd_controller.cpp (working copy) @@ -10,7 +10,7 @@ #include "libusb.h" -#define NDEBUG +//#define NDEBUG #include class CHCDController : public IHCDController, @@ -415,12 +415,19 @@ // start the hardware // Status = m_Hardware->PnpStart(RawResourceList, TranslatedResourceList); + + if (NT_SUCCESS(Status)) + { + // + // enable symbolic link + // + Status = SetSymbolicLink(TRUE); + } } - - // - // enable symbolic link - // - Status = SetSymbolicLink(TRUE); + else + { + Status = STATUS_UNSUCCESSFUL; + } } DPRINT("[%s] HandlePnp IRP_MN_START FDO: Status %x\n", m_USBType ,Status); Index: lib/drivers/libusb/hub_controller.cpp =================================================================== --- lib/drivers/libusb/hub_controller.cpp (revision 70555) +++ lib/drivers/libusb/hub_controller.cpp (working copy) @@ -10,7 +10,7 @@ #include "libusb.h" -#define NDEBUG +//#define NDEBUG #include VOID NTAPI StatusChangeEndpointCallBack( Index: lib/drivers/libusb/usb_device.cpp =================================================================== --- lib/drivers/libusb/usb_device.cpp (revision 70555) +++ lib/drivers/libusb/usb_device.cpp (working copy) @@ -10,7 +10,7 @@ #include "libusb.h" -#define NDEBUG +//#define NDEBUG #include class CUSBDevice : public IUSBDevice