Need help with writing usb device driver

I am currently working on a driver for a usb device. The driver is set up
to use resource manager functions to read and write to the device. My
problem is, I do not know how to notify another process that a device is
ready for use or that a device is no longer available for use. Normally, a
process that talks to the device attempts to locate the device only when it
needs to use it. If the device is not present, an error code is returned.
An attempt could be tried later. Normally, there is some user interface
involved such that this is not a self-recurring loop. For my case, I need
to have a process run/perform a certain function automatically when a usb
device is inserted. How can I do this without constantly polling for the

Please help. Thank you in advance.