- Question Regarding Handling a Device Power-Up Request
- Posted by Neo on March 27th, 2007
Hi,
I am Writing a Driver for USB 2.0 Device and i have the following
queries,
Query 1 :
In the following link from microsoft,
http://msdn2.microsoft.com/en-us/library/ms798276.aspx
It is mentioned as follows,
When the bus driver receives the IRP, it should first check to ensure
the device is still present and has not been removed or replaced while
asleep. If the device is no longer present, the bus driver should call
IoInvalidateDeviceRelations on the parent device to notify the Plug
and Play manager that the device has disappeared. In this situation,
the bus driver can fail the device power-up IRP.
Now my question is how do i check whether my device is present or
removed, is there any calls for the same ???
and Query 2 :
When i do unplug my USB Device, i am not getting
IRP_MN_SURPRISE_REMOVAL successfully but i am not getting
IRP_MN_REMOVE_DEVICE can i know under what circumstances the driver
will not get IRP_MN_REMOVE_DEVICE after getting
IRP_MN_SURPRISE_REMOVAL and this is not the case always only under
circumstances, like if i put my device under 2 level hub then i face
this difficulty as otherwise i get properly the IRPs.
Thanks and Regards,
Neo
- Posted by Calvin Guan on March 27th, 2007
"Neo" <rksandilya@gmail.com> wrote in message
news:1174981643.282204.84530@r56g2000hsd.googlegro ups.com...
You don't worry about this if you are not a bus driver that enumerates PDOs.
How to check the existence of child devices depends on the underlying bus
technology. For instance, PCI.sys would perform a bus scan by issuing CfgR
cycles to possible bus#/Dev#/func# to see if it's claimed.
If you are writing a new pnp driver, consider WDF or KMDF whatever it was
called now. With KMDF, you can focus more on your device technologies and
let Microsoft handle the dirty laundry.
--
Calvin Guan (expiring DDK MVP)
Sr. Staff Engineer
NetXtreme NTX Miniport
Broadcom Corporation
Connecting Everything(r)
- Posted by Neo on March 28th, 2007
Hi Calvin Guan,
Thank you for the replying.
the problem here is i am a bus driver tooo.
and i am almost done the driver except few issues with Power
management and i cannot suddenly shift to KMDF, so is there any other
solution for this or otherwise do i need to rework all my driver to
KMDF ???
plz let me know your suggestion.
Thanks and Regards,
Neo