Hello Everyone,

I am trying to return a error value from PnPAddDevice routine of my PCI
Device driver for the system to not load the driver for that particular
device. I am trying with STATUS_NOT_SUPPORTED.

I see that the AddDevice keeps getting called.

The background for this trial is as follows:

My driver is a PnP Driver and there is a legacy driver available for the
same PCI device with different functionality.

The system has 10 similar PCI devices and I want to load my driver only on
two of them. I am using the PCI three-tuples BUS-DEVICE-FUNCTION for
choosing my devices.

But, for automatic installation we have to use the PCI VendorID and Device
ID which is same for all the 10 PCI devices. If I try automatic
installation, the system tries to load my driver for all the 10 PCI devices.

So, I check for specific BUS-DEVICE-FUNCTION in my AddDevice and return
STATUS_NOT_SUPPORTED. I expect the system to ignore my driver and allow the
legacy driver to use the device. But, it does not seem to happen and my
AddDevice keeps getting called.

Is there any specific STATUS_* value I have to return from AddDevice to
achieve what I want? Please let me know the value or point me to the place
where I can get it from.

Thanks in advance for the big help from all of you

Best Regards,

Raj

RE: PnPAddDevice Return Value by pavel_a

pavel_a
Tue Feb 07 10:21:33 CST 2006

Using SetupDi (or devcon.exe) you can assign to every instance it's own
driver.

Regards,
--PA

"G.N.Raj" wrote:
> Hello Everyone,
>
> I am trying to return a error value from PnPAddDevice routine of my PCI
> Device driver for the system to not load the driver for that particular
> device. I am trying with STATUS_NOT_SUPPORTED.
>
> I see that the AddDevice keeps getting called.
>
> The background for this trial is as follows:
>
> My driver is a PnP Driver and there is a legacy driver available for the
> same PCI device with different functionality.
>
> The system has 10 similar PCI devices and I want to load my driver only on
> two of them. I am using the PCI three-tuples BUS-DEVICE-FUNCTION for
> choosing my devices.
>
> But, for automatic installation we have to use the PCI VendorID and Device
> ID which is same for all the 10 PCI devices. If I try automatic
> installation, the system tries to load my driver for all the 10 PCI devices.
>
> So, I check for specific BUS-DEVICE-FUNCTION in my AddDevice and return
> STATUS_NOT_SUPPORTED. I expect the system to ignore my driver and allow the
> legacy driver to use the device. But, it does not seem to happen and my
> AddDevice keeps getting called.
>
> Is there any specific STATUS_* value I have to return from AddDevice to
> achieve what I want? Please let me know the value or point me to the place
> where I can get it from.
>
> Thanks in advance for the big help from all of you
>
> Best Regards,
>
> Raj
>

Re: PnPAddDevice Return Value by G

G
Tue Feb 07 20:47:38 CST 2006

I tried that Pavel.

But for that I have to give one of the Hardware IDs and in my case there is
no uniqueness in any of the hardware IDs reported by the devcon.exe's hwids
command.

Please let me know if there is any other way to get that.

Regards,

Raj

"Pavel A." <pavel_a@NOwritemeNO.com> wrote in message
news:7FF47FEE-BC15-45AA-9980-E8755AC81CCE@microsoft.com...
> Using SetupDi (or devcon.exe) you can assign to every instance it's own
> driver.
>
> Regards,
> --PA
>
> "G.N.Raj" wrote:
>> Hello Everyone,
>>
>> I am trying to return a error value from PnPAddDevice routine of my PCI
>> Device driver for the system to not load the driver for that particular
>> device. I am trying with STATUS_NOT_SUPPORTED.
>>
>> I see that the AddDevice keeps getting called.
>>
>> The background for this trial is as follows:
>>
>> My driver is a PnP Driver and there is a legacy driver available for the
>> same PCI device with different functionality.
>>
>> The system has 10 similar PCI devices and I want to load my driver only
>> on
>> two of them. I am using the PCI three-tuples BUS-DEVICE-FUNCTION for
>> choosing my devices.
>>
>> But, for automatic installation we have to use the PCI VendorID and
>> Device
>> ID which is same for all the 10 PCI devices. If I try automatic
>> installation, the system tries to load my driver for all the 10 PCI
>> devices.
>>
>> So, I check for specific BUS-DEVICE-FUNCTION in my AddDevice and return
>> STATUS_NOT_SUPPORTED. I expect the system to ignore my driver and allow
>> the
>> legacy driver to use the device. But, it does not seem to happen and my
>> AddDevice keeps getting called.
>>
>> Is there any specific STATUS_* value I have to return from AddDevice to
>> achieve what I want? Please let me know the value or point me to the
>> place
>> where I can get it from.
>>
>> Thanks in advance for the big help from all of you
>>
>> Best Regards,
>>
>> Raj
>>



Re: PnPAddDevice Return Value by Pavel

Pavel
Tue Feb 07 21:06:04 CST 2006

Instance ID is not same as hardware ID. Instance IDs are unique.

--PA


"G.N.Raj" <gnraj@hotmail.com> wrote in message news:OVfLHnFLGHA.1288@TK2MSFTNGP09.phx.gbl...
>I tried that Pavel.
>
> But for that I have to give one of the Hardware IDs and in my case there is no uniqueness in any of the hardware IDs reported
> by the devcon.exe's hwids command.
>
> Please let me know if there is any other way to get that.
>
> Regards,
>
> Raj
>
> "Pavel A." <pavel_a@NOwritemeNO.com> wrote in message news:7FF47FEE-BC15-45AA-9980-E8755AC81CCE@microsoft.com...
>> Using SetupDi (or devcon.exe) you can assign to every instance it's own
>> driver.
>>
>> Regards,
>> --PA
>>
>> "G.N.Raj" wrote:
>>> Hello Everyone,
>>>
>>> I am trying to return a error value from PnPAddDevice routine of my PCI
>>> Device driver for the system to not load the driver for that particular
>>> device. I am trying with STATUS_NOT_SUPPORTED.
>>>
>>> I see that the AddDevice keeps getting called.
>>>
>>> The background for this trial is as follows:
>>>
>>> My driver is a PnP Driver and there is a legacy driver available for the
>>> same PCI device with different functionality.
>>>
>>> The system has 10 similar PCI devices and I want to load my driver only on
>>> two of them. I am using the PCI three-tuples BUS-DEVICE-FUNCTION for
>>> choosing my devices.
>>>
>>> But, for automatic installation we have to use the PCI VendorID and Device
>>> ID which is same for all the 10 PCI devices. If I try automatic
>>> installation, the system tries to load my driver for all the 10 PCI devices.
>>>
>>> So, I check for specific BUS-DEVICE-FUNCTION in my AddDevice and return
>>> STATUS_NOT_SUPPORTED. I expect the system to ignore my driver and allow the
>>> legacy driver to use the device. But, it does not seem to happen and my
>>> AddDevice keeps getting called.
>>>
>>> Is there any specific STATUS_* value I have to return from AddDevice to
>>> achieve what I want? Please let me know the value or point me to the place
>>> where I can get it from.
>>>
>>> Thanks in advance for the big help from all of you
>>>
>>> Best Regards,
>>>
>>> Raj
>>>
>
>



Re: PnPAddDevice Return Value by G

G
Tue Feb 07 22:01:56 CST 2006

I tried all the IDs reported by hwids command of the devcon and used them as
input for installing driver. But didn't get much out of it.

I will see if I need to write my own application using the SetupDi.

Is there any other way as I asked in the AddDevice returning a value?

--Raj

"Pavel A." <pavel_a@NOwritemeNO.com> wrote in message
news:ekAC7yFLGHA.3396@TK2MSFTNGP10.phx.gbl...
> Instance ID is not same as hardware ID. Instance IDs are unique.
>
> --PA
>
>
> "G.N.Raj" <gnraj@hotmail.com> wrote in message
> news:OVfLHnFLGHA.1288@TK2MSFTNGP09.phx.gbl...
>>I tried that Pavel.
>>
>> But for that I have to give one of the Hardware IDs and in my case there
>> is no uniqueness in any of the hardware IDs reported by the devcon.exe's
>> hwids command.
>>
>> Please let me know if there is any other way to get that.
>>
>> Regards,
>>
>> Raj
>>
>> "Pavel A." <pavel_a@NOwritemeNO.com> wrote in message
>> news:7FF47FEE-BC15-45AA-9980-E8755AC81CCE@microsoft.com...
>>> Using SetupDi (or devcon.exe) you can assign to every instance it's
>>> own
>>> driver.
>>>
>>> Regards,
>>> --PA
>>>
>>> "G.N.Raj" wrote:
>>>> Hello Everyone,
>>>>
>>>> I am trying to return a error value from PnPAddDevice routine of my PCI
>>>> Device driver for the system to not load the driver for that particular
>>>> device. I am trying with STATUS_NOT_SUPPORTED.
>>>>
>>>> I see that the AddDevice keeps getting called.
>>>>
>>>> The background for this trial is as follows:
>>>>
>>>> My driver is a PnP Driver and there is a legacy driver available for
>>>> the
>>>> same PCI device with different functionality.
>>>>
>>>> The system has 10 similar PCI devices and I want to load my driver only
>>>> on
>>>> two of them. I am using the PCI three-tuples BUS-DEVICE-FUNCTION for
>>>> choosing my devices.
>>>>
>>>> But, for automatic installation we have to use the PCI VendorID and
>>>> Device
>>>> ID which is same for all the 10 PCI devices. If I try automatic
>>>> installation, the system tries to load my driver for all the 10 PCI
>>>> devices.
>>>>
>>>> So, I check for specific BUS-DEVICE-FUNCTION in my AddDevice and return
>>>> STATUS_NOT_SUPPORTED. I expect the system to ignore my driver and allow
>>>> the
>>>> legacy driver to use the device. But, it does not seem to happen and my
>>>> AddDevice keeps getting called.
>>>>
>>>> Is there any specific STATUS_* value I have to return from AddDevice to
>>>> achieve what I want? Please let me know the value or point me to the
>>>> place
>>>> where I can get it from.
>>>>
>>>> Thanks in advance for the big help from all of you
>>>>
>>>> Best Regards,
>>>>
>>>> Raj
>>>>
>>
>>
>
>



Re: PnPAddDevice Return Value by Doron

Doron
Tue Feb 07 23:59:59 CST 2006

are you sure AddDevice is being called for the same device each time? is
the PDO value passed in the same? if you are marked as the service for the
device, returning !NT_SUCCESS will fail the device stack being built (if you
are a filter, the error is ignored).

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"G.N.Raj" <gnraj@hotmail.com> wrote in message
news:u9fDrQGLGHA.1028@TK2MSFTNGP11.phx.gbl...
>I tried all the IDs reported by hwids command of the devcon and used them
>as input for installing driver. But didn't get much out of it.
>
> I will see if I need to write my own application using the SetupDi.
>
> Is there any other way as I asked in the AddDevice returning a value?
>
> --Raj
>
> "Pavel A." <pavel_a@NOwritemeNO.com> wrote in message
> news:ekAC7yFLGHA.3396@TK2MSFTNGP10.phx.gbl...
>> Instance ID is not same as hardware ID. Instance IDs are unique.
>>
>> --PA
>>
>>
>> "G.N.Raj" <gnraj@hotmail.com> wrote in message
>> news:OVfLHnFLGHA.1288@TK2MSFTNGP09.phx.gbl...
>>>I tried that Pavel.
>>>
>>> But for that I have to give one of the Hardware IDs and in my case there
>>> is no uniqueness in any of the hardware IDs reported by the devcon.exe's
>>> hwids command.
>>>
>>> Please let me know if there is any other way to get that.
>>>
>>> Regards,
>>>
>>> Raj
>>>
>>> "Pavel A." <pavel_a@NOwritemeNO.com> wrote in message
>>> news:7FF47FEE-BC15-45AA-9980-E8755AC81CCE@microsoft.com...
>>>> Using SetupDi (or devcon.exe) you can assign to every instance it's
>>>> own
>>>> driver.
>>>>
>>>> Regards,
>>>> --PA
>>>>
>>>> "G.N.Raj" wrote:
>>>>> Hello Everyone,
>>>>>
>>>>> I am trying to return a error value from PnPAddDevice routine of my
>>>>> PCI
>>>>> Device driver for the system to not load the driver for that
>>>>> particular
>>>>> device. I am trying with STATUS_NOT_SUPPORTED.
>>>>>
>>>>> I see that the AddDevice keeps getting called.
>>>>>
>>>>> The background for this trial is as follows:
>>>>>
>>>>> My driver is a PnP Driver and there is a legacy driver available for
>>>>> the
>>>>> same PCI device with different functionality.
>>>>>
>>>>> The system has 10 similar PCI devices and I want to load my driver
>>>>> only on
>>>>> two of them. I am using the PCI three-tuples BUS-DEVICE-FUNCTION for
>>>>> choosing my devices.
>>>>>
>>>>> But, for automatic installation we have to use the PCI VendorID and
>>>>> Device
>>>>> ID which is same for all the 10 PCI devices. If I try automatic
>>>>> installation, the system tries to load my driver for all the 10 PCI
>>>>> devices.
>>>>>
>>>>> So, I check for specific BUS-DEVICE-FUNCTION in my AddDevice and
>>>>> return
>>>>> STATUS_NOT_SUPPORTED. I expect the system to ignore my driver and
>>>>> allow the
>>>>> legacy driver to use the device. But, it does not seem to happen and
>>>>> my
>>>>> AddDevice keeps getting called.
>>>>>
>>>>> Is there any specific STATUS_* value I have to return from AddDevice
>>>>> to
>>>>> achieve what I want? Please let me know the value or point me to the
>>>>> place
>>>>> where I can get it from.
>>>>>
>>>>> Thanks in advance for the big help from all of you
>>>>>
>>>>> Best Regards,
>>>>>
>>>>> Raj
>>>>>
>>>
>>>
>>
>>
>
>



Re: PnPAddDevice Return Value by G

G
Wed Feb 08 03:13:15 CST 2006

Yes. I know that I am getting a AddDevice again for the same device. But, I
haven't checked the PDO. I checked by having only two devices of the type in
the system and returning SUCCESS for the first device and
STATUS_NOT_SUPPORTED for the other.

And, I am loading as a driver for the device on top of PCI.sys as a PNP
driver and I hope this means it is a service for the device. Is there a way
to verify this?

--Raj

"Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
news:ea$0mTHLGHA.2604@TK2MSFTNGP09.phx.gbl...
> are you sure AddDevice is being called for the same device each time? is
> the PDO value passed in the same? if you are marked as the service for
> the device, returning !NT_SUCCESS will fail the device stack being built
> (if you are a filter, the error is ignored).
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> "G.N.Raj" <gnraj@hotmail.com> wrote in message
> news:u9fDrQGLGHA.1028@TK2MSFTNGP11.phx.gbl...
>>I tried all the IDs reported by hwids command of the devcon and used them
>>as input for installing driver. But didn't get much out of it.
>>
>> I will see if I need to write my own application using the SetupDi.
>>
>> Is there any other way as I asked in the AddDevice returning a value?
>>
>> --Raj
>>
>> "Pavel A." <pavel_a@NOwritemeNO.com> wrote in message
>> news:ekAC7yFLGHA.3396@TK2MSFTNGP10.phx.gbl...
>>> Instance ID is not same as hardware ID. Instance IDs are unique.
>>>
>>> --PA
>>>
>>>
>>> "G.N.Raj" <gnraj@hotmail.com> wrote in message
>>> news:OVfLHnFLGHA.1288@TK2MSFTNGP09.phx.gbl...
>>>>I tried that Pavel.
>>>>
>>>> But for that I have to give one of the Hardware IDs and in my case
>>>> there is no uniqueness in any of the hardware IDs reported by the
>>>> devcon.exe's hwids command.
>>>>
>>>> Please let me know if there is any other way to get that.
>>>>
>>>> Regards,
>>>>
>>>> Raj
>>>>
>>>> "Pavel A." <pavel_a@NOwritemeNO.com> wrote in message
>>>> news:7FF47FEE-BC15-45AA-9980-E8755AC81CCE@microsoft.com...
>>>>> Using SetupDi (or devcon.exe) you can assign to every instance it's
>>>>> own
>>>>> driver.
>>>>>
>>>>> Regards,
>>>>> --PA
>>>>>
>>>>> "G.N.Raj" wrote:
>>>>>> Hello Everyone,
>>>>>>
>>>>>> I am trying to return a error value from PnPAddDevice routine of my
>>>>>> PCI
>>>>>> Device driver for the system to not load the driver for that
>>>>>> particular
>>>>>> device. I am trying with STATUS_NOT_SUPPORTED.
>>>>>>
>>>>>> I see that the AddDevice keeps getting called.
>>>>>>
>>>>>> The background for this trial is as follows:
>>>>>>
>>>>>> My driver is a PnP Driver and there is a legacy driver available for
>>>>>> the
>>>>>> same PCI device with different functionality.
>>>>>>
>>>>>> The system has 10 similar PCI devices and I want to load my driver
>>>>>> only on
>>>>>> two of them. I am using the PCI three-tuples BUS-DEVICE-FUNCTION for
>>>>>> choosing my devices.
>>>>>>
>>>>>> But, for automatic installation we have to use the PCI VendorID and
>>>>>> Device
>>>>>> ID which is same for all the 10 PCI devices. If I try automatic
>>>>>> installation, the system tries to load my driver for all the 10 PCI
>>>>>> devices.
>>>>>>
>>>>>> So, I check for specific BUS-DEVICE-FUNCTION in my AddDevice and
>>>>>> return
>>>>>> STATUS_NOT_SUPPORTED. I expect the system to ignore my driver and
>>>>>> allow the
>>>>>> legacy driver to use the device. But, it does not seem to happen and
>>>>>> my
>>>>>> AddDevice keeps getting called.
>>>>>>
>>>>>> Is there any specific STATUS_* value I have to return from AddDevice
>>>>>> to
>>>>>> achieve what I want? Please let me know the value or point me to the
>>>>>> place
>>>>>> where I can get it from.
>>>>>>
>>>>>> Thanks in advance for the big help from all of you
>>>>>>
>>>>>> Best Regards,
>>>>>>
>>>>>> Raj
>>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: PnPAddDevice Return Value by Eliyas

Eliyas
Wed Feb 08 09:40:46 CST 2006

Does the AddDevice called in an infinite loop or the system give-up after
few attempts? I have seen such a behavior where if you fail AddDevice it
would get called few times (6 or 7).

-Eliyas



Re: PnPAddDevice Return Value by G

G
Wed Feb 08 10:09:03 CST 2006

Yes Eliyas,

We are seeing the system giveup after some attempts.

But, I am not sure if the system would allow a legacy driver load on that
device using "net start <driver>". I think it would not allow. I haven't
tried it.

--Raj

"Eliyas Yakub [MSFT]" <eliyasy@online.microsoft.com> wrote in message
news:OZTsEYMLGHA.3424@TK2MSFTNGP12.phx.gbl...
> Does the AddDevice called in an infinite loop or the system give-up after
> few attempts? I have seen such a behavior where if you fail AddDevice it
> would get called few times (6 or 7).
>
> -Eliyas
>
>



Re: PnPAddDevice Return Value by Eliyas

Eliyas
Wed Feb 08 10:39:44 CST 2006

I don't know the exact reason for the retry but my guess is that it does to
workaround around some deadlock scenarios. We recently ran into another
issue where if you fail DriverEntry in a boot-driver loaded during safe-boot
mode, the system will try to reload the driver in an infinite loop.

> But, I am not sure if the system would allow a legacy driver load on that
> device using "net start <driver>". I think it would not allow. I haven't
> tried it.

It would. All you need to make sure is that your legacy driver reports the
resource usage (IoReportResourceUsage) before using them. Why do you have a
legacy driver in this day and age. Now that KMDF is out, you should be able
to easily port over and make it pnp.

-Eliyas



Re: PnPAddDevice Return Value by G

G
Wed Feb 08 10:59:54 CST 2006

Thanks Eliyas.

We can try that out.

I have the PnP driver and the legacy driver is from a different vendor who
has not yet migrated to PnP. And we have to co-exist.

--Raj

"Eliyas Yakub [MSFT]" <eliyasy@online.microsoft.com> wrote in message
news:uYtlB5MLGHA.2124@TK2MSFTNGP14.phx.gbl...
>I don't know the exact reason for the retry but my guess is that it does to
>workaround around some deadlock scenarios. We recently ran into another
>issue where if you fail DriverEntry in a boot-driver loaded during
>safe-boot mode, the system will try to reload the driver in an infinite
>loop.
>
>> But, I am not sure if the system would allow a legacy driver load on that
>> device using "net start <driver>". I think it would not allow. I haven't
>> tried it.
>
> It would. All you need to make sure is that your legacy driver reports the
> resource usage (IoReportResourceUsage) before using them. Why do you have
> a legacy driver in this day and age. Now that KMDF is out, you should be
> able to easily port over and make it pnp.
>
> -Eliyas
>