Are you sure you sending it at passive?
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Tuesday, September 15, 2009 11:01 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] IOCTL_INTERNAL_USB_CYCLE_PORT has no effect on Windows 7
The PDO is enumerated by usb root hub, here is the snapshot of DeviceTree (thanks to osronline for providing the great tool for Windows 7)
PDO \Device\NTPNP_PCI0033 - [PCI\VEN_15AD&DEV_0770&USBSYS_077015AD&REV_00]
±-FDO Attached: (unnamed) - \Driver\ACPI
±-FDO \Device\USBFDO-1
±-PDO \Device\USBPDO-1 - [USB\ROOT_HUB20] <— Driver is \Driver\usbehci
±-FDO Attached: (unnamed) - \Driver\usbfilter <— This is my usb filter device object
±-PDO \Device\USBPDO-3 - [USB\VID_090C&PID_1000] <==== DeviceObject 0x86243030
±-FDO \Device\00000067
±-PDO \Device\00000068 - [USBSTOR\Disk\Ven_Kingston&Pod_DataTraceler_2.0&Rev_1100]
±-FDO \Device\Harddisk1\DR1
±-FDO Attached: (unnamed) - \Driver\partmgr
and devobj and drvobj output follows
0: kd> !devobj 0x86243030
Device object (86243030) is for:
USBPDO-3 \Driver\usbhub DriverObject 863c1bb8
Current Irp 00000000 RefCount 0 Type 00000022 Flags 00003040
Dacl 88a56c00 DevExt 862430e8 DevObjExt 86243948 DevNode 86452b00
ExtensionFlags (0x00000800)
Unknown flags 0x00000800
AttachedDevice (Upper) 86a6e748 \Driver\USBSTOR
Device queue is not busy.
0: kd> !devnode 0x86452b00
DevNode 0x86452b00 for PDO 0x86243030
Parent 0x85f90ab0 Sibling 0000000000 Child 0x86977108
InstancePath is “USB\VID_090C&PID_1000\AA04012700007522”
ServiceName is “USBSTOR”
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[09] = DeviceNodeEnumerateCompletion (0x30d)
StateHistory[08] = DeviceNodeEnumeratePending (0x30c)
StateHistory[07] = DeviceNodeStarted (0x308)
StateHistory[06] = DeviceNodeStartPostWork (0x307)
StateHistory[05] = DeviceNodeStartCompletion (0x306)
StateHistory[04] = DeviceNodeStartPending (0x305)
StateHistory[03] = DeviceNodeResourcesAssigned (0x304)
StateHistory[02] = DeviceNodeDriversAdded (0x303)
StateHistory[01] = DeviceNodeInitialized (0x302)
StateHistory[00] = DeviceNodeUninitialized (0x301)
StateHistory[19] = Unknown State (0x0)
StateHistory[18] = Unknown State (0x0)
StateHistory[17] = Unknown State (0x0)
StateHistory[16] = Unknown State (0x0)
StateHistory[15] = Unknown State (0x0)
StateHistory[14] = Unknown State (0x0)
StateHistory[13] = Unknown State (0x0)
StateHistory[12] = Unknown State (0x0)
StateHistory[11] = Unknown State (0x0)
StateHistory[10] = Unknown State (0x0)
Flags (0x6c000130) DNF_ENUMERATED, DNF_IDS_QUERIED,
DNF_NO_RESOURCE_REQUIRED, DNF_NO_LOWER_DEVICE_FILTERS,
DNF_NO_LOWER_CLASS_FILTERS, DNF_NO_UPPER_DEVICE_FILTERS,
DNF_NO_UPPER_CLASS_FILTERS
CapabilityFlags (0x00000750) Removable, UniqueID,
RawDeviceOK, SurpriseRemovalOK,
WakeFromD0
0: kd> !drvobj 0x863c1bb8
Driver object (863c1bb8) is for:
\Driver\usbhub
Driver Extension List: (id , addr)
Device Object list:
8692c028 85267030 86243030 86887030
85f8a028 86413028
My code is
NTSTATUS FDO_CycleUsbPort(PDEVICE_OBJECT DeviceObject) // usb port PDO
{
NTSTATUS status;
KEVENT Event;
IO_STATUS_BLOCK iostatus;
PIRP Irp;
PIO_STACK_LOCATION stack;
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_CYCLE_PORT, DeviceObject, NULL, 0, NULL, 0, TRUE, &Event, &iostatus);
KdPrint((“FDO_CycleUsbPort: IoBuildDeviceIoControlRequest, Irp %X \n”, Irp));
stack = IoGetNextIrpStackLocation(Irp);
stack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
stack->Parameters.DeviceIoControl.IoControlCode = IOCTL_INTERNAL_USB_CYCLE_PORT;
KdPrint((“FDO_CycleUsbPort: IoCallDriver(IOCTL_INTERNAL_USB_CYCLE_PORT, DeviceObject 0x%p)\n”, DeviceObject));
status = IoCallDriver(DeviceObject, Irp);
if ( status == STATUS_PENDING )
{
KdPrint((“FDO_CycleUsbPort: wait IoCallDriver complete …\n”));
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
status = iostatus.Status;
}
KdPrint((“FDO_CycleUsbPort: IoCallDriver return status 0x%x, iostatus.Status 0x%x\n”, status, iostatus.Status));
if (!NT_SUCCESS(status))
{
DbgPrint(“FDO_CycleUsbPort: Error %X trying to reset device\n”, status);
}
KdPrint((“FDO_CycleUsbPort: Leave, status 0x%x\n”, status));
return status;
}
and the output is
Connected to Windows 7 7600 x86 compatible target at (Wed Sep 16 13:10:43.671 2009 (GMT+8)), ptr64 FALSE
Kernel Debugger connection established.
Symbol search path is: srv*DownstreamStore*http://msdl.microsoft.com/download/symbols
Executable search path is:
Windows 7 Kernel Version 7600 MP (1 procs) Free x86 compatible
Built by: 7600.16385.x86fre.win7_rtm.090713-1255
…
FDO_ChangeBusRelations: FDO_CycleUsbPort(usbDevice->DeviceObject 0x86243030)
FDO_CycleUsbPort: IoBuildDeviceIoControlRequest, Irp 86C4BD98
FDO_CycleUsbPort: IoCallDriver(IOCTL_INTERNAL_USB_CYCLE_PORT, DeviceObject 0x86243030)
FDO_CycleUsbPort: IoCallDriver return status 0x0, iostatus.Status 0x0
FDO_CycleUsbPort: Leave, status 0x0
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer