[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-smartcardddk
Subject:    Re: Manager doesn't seem to see the reader
From:       Walter Oney <waltoney () ONEYSOFT ! COM>
Date:       2002-04-09 9:37:27
[Download RAW message or body]


Stanley Key wrote:
> I'm developing an IFD handler for USB reader. I want to call the USB-device
> driver from my driver to check if any new readers were added. I'm doing
> this in another thread. For all readers that i create FDOs for in my
> DriverEntry the resource manager calls Create, DeviceControl and their
> callback functions. But all the readers, I create FDOs for in the second
> thread and call SmartcardInitialize passing their SmartcardExtensions and
> etc, don't seem to be available for the resource manager. It doesn't call
> Create, DeviceControl, CallBacks etc for them. Why? Are there any special
> functions that The Resource Manager calls after DriverEntry to register
> those readers created in DriverEntry or maybe i'm doing something wrong?

I think your design may be fundamentally flawed and that you have a few
misconceptions about how things work. I'll guess that you've trying to
write a driver for a USB reader. Here's the way that should work:

1. End user plugs in the reader.

2. System bus driver detects the reader, reads device descriptor and
forms device ID from VID/PID/bcdDevice.

3. The first time one of your readers gets attached, the setup program
runs automatically and looks for an INF file with a model statement
matching your VID/PID. I.e., one that uses USB\VID_xxxx&PID_xxxx as the
device id.

4. Plug and Play Manager (an OS component that has nothing to do with
the SmartCard resource manager) loads your driver and calls DriverEntry.

5. Your DriverEntry does *not* create any device objects, does not
attempt to communicate with the USB bus driver, or anything. It just
sets a few function pointers in the DRIVER_OBJECT and returns.

5. PnP Manager calls your AddDevice function. You create an FDO and
return. You still don't attempt to communicate with the USB bus, but you
do call SmartcardInitialize. In Win2K, you should register the SmartCard
interface GUID at this time. In Win98, you would call
SmartcardCreateLink instead. (So your driver has to distinguish between
the OS's at run time by calling IoIsWdmVersionAvailable.)

6. PnP Manager sends you an IRP_MJ_PNP, IRP_MN_START_DEVICE. You
configure your device. In Win2K, you enable your device interface.

7. At this point, the resource manager (a user-mode component) in Win2K
will learn about your reader and will open a handle. You'll start
getting IOCTL calls, which you'll delegate to SMCLIB, which will call
your callback routines. In Win98, a reboot is necessary because the
resource manager doesn't notice when new readers are attached.

--
Walter Oney
Consulting and Training
http://www.oneysoft.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic