Fwd: Getting PNP Monitor Address through code

Hi,

I am trying to implement a a user mode implementation which can read
the PNP Monitors enumerated under Monitors in Device Manager through
code. Is there any user mode API that i can
call to get this info?

Your help here is much appreciated.

Thanks
Vishla

Hi,

I am trying to implement a a user mode implementation which can read
the PNP Monitors enumerated under Monitors in Device Manager through
code. Is there any user mode API that i can
call to get this info?

Your help here is much appreciated.

Thanks
Vishal

You can use EnumDisplayMonitors to get the handle to each of the monitor and
use GetMonitorInfo for each handle to get more details.

-Maddy

On Wed, Feb 3, 2010 at 2:43 PM, Vishal Sharma wrote:

> Hi,
>
> I am trying to implement a a user mode implementation which can read
> the PNP Monitors enumerated under Monitors in Device Manager through
> code. Is there any user mode API that i can
> call to get this info?
>
> Your help here is much appreciated.
>
> Thanks
> Vishal
>
> —
> 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
>

Thanks Maddy for your reply.

GetMonitorInfo does not contain address information which I am looking
for. Actually the address for each PnP monitor is actually ACPI UID
which OS gets by evaluating _ADR method.

I am looking to get this address( which ACPI UID) which GetMonitorInfo
doesn’t contains. Could you/anybody else suggest any other method?

Thanks
Vishal

On Wed, Feb 3, 2010 at 3:40 PM, Madhusudan Narayan
wrote:
> You can use EnumDisplayMonitors to get the handle to each of the monitor and
> use GetMonitorInfo for each handle to get more details.
>
>
> -Maddy
>
> On Wed, Feb 3, 2010 at 2:43 PM, Vishal Sharma wrote:
>>
>> Hi,
>>
>> I am trying to implement a a user mode implementation which can read
>> the PNP Monitors enumerated under Monitors in Device Manager through
>> code. Is there any user mode API that i can
>> call to get this info?
>>
>> Your help here is much appreciated.
>>
>> Thanks
>> Vishal
>>
>> —
>> 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
>
> — 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

Can anybody clarify on my initial query?

On Wed, Feb 3, 2010 at 4:22 PM, Vishal Sharma wrote:
> Thanks Maddy for your reply.
>
> GetMonitorInfo does not contain address information which I am looking
> for. Actually the address for each PnP monitor is actually ACPI UID
> which OS gets by evaluating _ADR method.
>
> I am looking to get this address( which ACPI UID) which GetMonitorInfo
> doesn’t contains. Could you/anybody else suggest any other method?
>
> Thanks
> Vishal
>
> On Wed, Feb 3, 2010 at 3:40 PM, Madhusudan Narayan
> wrote:
>> You can use EnumDisplayMonitors to get the handle to each of the monitor and
>> use GetMonitorInfo for each handle to get more details.
>>
>>
>> -Maddy
>>
>> On Wed, Feb 3, 2010 at 2:43 PM, Vishal Sharma wrote:
>>>
>>> Hi,
>>>
>>> I am trying to implement a a user mode implementation which can read
>>> the PNP Monitors enumerated under Monitors in Device Manager through
>>> code. Is there any user mode API that i can
>>> call to get this info?
>>>
>>> Your help here is much appreciated.
>>>
>>> Thanks
>>> Vishal
>>>
>>> —
>>> 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
>>
>> — 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
>

There are different subtly incompatile ways:

-1-
The SetupAPI version, that is the same as devcon.exe listclass Monitor

-2-
EnumDisplayDevices( EDD_GET_DEVICE_INTERFACE_NAME )

-3-
QueryDisplayConfig(QDC_ALL_PATHS)

The fact that you expect some of the information returned above to be correlatable to the ACPI ID is not generally there. It might be there for LCDs attached to laptops, but, not for all monitors. Actually, it is more likely to not be available in ACPI form than it is.

The next question would be: what are you going to use that information for ?
Getting the EDID ?
Getting physical resolution informaiton ?
Powering off the device outside of the user and OS control ?

Thanks Ivan for your reply!!

I am trying to get the ACPI ID for all the enumerated PnP monitors.

On Vista and Win7 OS:

Go to Device Manager > Monitors > Generic PnP Monitor

Double click on any of the available PnP Monitors to see the “Generic
PnP Monitor Properties”.

Chose “Address” in the property field

The corresponding value is the ACPI ID of that particular PnP Monitor
which OS retrieves from BIOS by evaluating _ADR method.

Problem Statement: I want to retrieve this value through program. Is
there any specific APIs available?

Pl let me know

Vishal

On Thu, Feb 4, 2010 at 4:37 AM, wrote:
> There are different subtly incompatile ways:
>
> -1-
> The SetupAPI version, that is the same as devcon.exe listclass Monitor
>
> -2-
> EnumDisplayDevices( EDD_GET_DEVICE_INTERFACE_NAME )
>
> -3-
> QueryDisplayConfig(QDC_ALL_PATHS)
>
> The fact that you expect some of the information returned above to be correlatable to the ACPI ID is not generally there. It might be there for LCDs attached to laptops, but, not for all monitors. Actually, it is more likely to not be available in ACPI form than it is.
>
> The next question would be: what are you going to use that information for ?
> Getting the EDID ?
> Getting physical resolution informaiton ?
> Powering off the device outside of the user and OS control ?
>
> —
> 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
>

SetupApi is the only way to the the Address value

SetupDiGetDeviceInstanceId +
SetupDiGetDeviceRegistryProperty(SPDRP_ADDRESS)

should get you there.

However, I would not assume that that value has anything to do with ACPI.
For example, in my machine with 3 monitors,
it looks like the VidPn-Target Id reported by the miniport(s) to
DxgKrnl.sys.
And, even this piece of information is purely configuration incidental.


This posting is provided “AS IS” with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Did you look at the WMI data? For example, open a PowerShell window and
type:

gwmi Win32_DesktopMonitor

or

gwmi Win32_PNPEntity

You might look though the different WMI classes and see if the data you want
is there. All WMI data can be accessed programmatically.

Jan

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-399171-
xxxxx@lists.osr.com] On Behalf Of Vishal Sharma
Sent: Wednesday, February 03, 2010 2:52 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Getting PNP Monitor Address through code

Thanks Maddy for your reply.

GetMonitorInfo does not contain address information which I am looking
for. Actually the address for each PnP monitor is actually ACPI UID
which OS gets by evaluating _ADR method.

I am looking to get this address( which ACPI UID) which GetMonitorInfo
doesn’t contains. Could you/anybody else suggest any other method?

Thanks
Vishal

On Wed, Feb 3, 2010 at 3:40 PM, Madhusudan Narayan
wrote:
> > You can use EnumDisplayMonitors to get the handle to each of the
> monitor and
> > use GetMonitorInfo for each handle to get more details.
> >
> >
> > -Maddy
> >
> > On Wed, Feb 3, 2010 at 2:43 PM, Vishal Sharma
> wrote:
> >>
> >> Hi,
> >>
> >> I am trying to implement a a user mode implementation which can read
> >> the PNP Monitors enumerated under Monitors in Device Manager through
> >> code. Is there any user mode API that i can
> >> call to get this info?
> >>
> >> Your help here is much appreciated.
> >>
> >> Thanks
> >> Vishal
> >>
> >> —
> >> 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
> >
> > — 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
>
> —
> 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

>The corresponding value is the ACPI ID of that particular PnP Monitor

which OS retrieves from BIOS by evaluating _ADR method.

Not so, this is so only on laptops.

Separate, attached monitor of the desktop is not known to BIOS at all, and has no ACPI ID at all.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Yes you are right. this was applicable to only notebooks and also my
request is for notebooks only.

On Thu, Feb 4, 2010 at 4:20 PM, Maxim S. Shatskih
wrote:
>>The corresponding value is the ACPI ID of that particular PnP Monitor
>>which OS retrieves from BIOS by evaluating _ADR method.
>
> Not so, this is so only on laptops.
>
> Separate, attached monitor of the desktop is not known to BIOS at all, and has no ACPI ID at all.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> 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
>