From: john on
Hi There,

Is any one out there know under what situation an application will not be
able to receive WM_DEVICECHANGE?

I used an OmniVision Web cam demo board with driver. And I wrote an
application which is supposed to receive the WM_DEVICECHANGE message, but it
did not receive the message.

The RegisterDeviceNotificaiton has been called, like below:

DEV_BROADCAST_DEVICEINTERFACE filterData;
ZeroMemory(&filterData, sizeof(DEV_BROADCAST_DEVICEINTERFACE));
filterData.dbcc_reserved = 0;
filterData.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
filterData.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
filterData.dbcc_classguid = AM_KSCATEGORY_CAPTURE;
ghDevNotify = RegisterDeviceNotification(ghwnd, &filterData,
DEVICE_NOTIFY_WINDOW_HANDLE);

What bother me is, if I use another Web cam (UVC or DirectShow compliant),
it works!
But if I use OmniVision Web cam board, it does not work!
Could it be the OminVision driver problem?

Any help will be highly appreciated.


From: Eliyas Yakub [MSFT] on
I don't have access to the WDK. Is AM_KSCATEGORY_CAPTURE microsoft defined
interface guid? It's possible that OmniVision driver is not using the same
guid.

-Eliyas


"john" <johnchen6000(a)yahoo.com.tw> wrote in message
news:uaovmTcWIHA.6044(a)TK2MSFTNGP05.phx.gbl...
> Hi There,
>
> Is any one out there know under what situation an application will not be
> able to receive WM_DEVICECHANGE?
>
> I used an OmniVision Web cam demo board with driver. And I wrote an
> application which is supposed to receive the WM_DEVICECHANGE message, but
> it did not receive the message.
>
> The RegisterDeviceNotificaiton has been called, like below:
>
> DEV_BROADCAST_DEVICEINTERFACE filterData;
> ZeroMemory(&filterData, sizeof(DEV_BROADCAST_DEVICEINTERFACE));
> filterData.dbcc_reserved = 0;
> filterData.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
> filterData.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
> filterData.dbcc_classguid = AM_KSCATEGORY_CAPTURE;
> ghDevNotify = RegisterDeviceNotification(ghwnd, &filterData,
> DEVICE_NOTIFY_WINDOW_HANDLE);
>
> What bother me is, if I use another Web cam (UVC or DirectShow compliant),
> it works!
> But if I use OmniVision Web cam board, it does not work!
> Could it be the OminVision driver problem?
>
> Any help will be highly appreciated.
>
From: john on
Hi Eliyas,

Many thanks for your response.
Yes, AM_KSCATEGORY_CAPTURE is defined in ksuuids.h.
And the OmniVision driver installation file OVUSB2.INF adds something to the
registry as below:

[OVT.USBDCam2800.NT.Interfaces]
AddInterface=%KSCATEGORY_CAPTURE%,GLOBAL,OVT.USBDCam2800.Interface
AddInterface=%KSCATEGORY_VIDEO%,GLOBAL,OVT.USBDCam2800.Interface

[OVT.USBDCam2800.Interface]
AddReg=OVT.USBDCam2800.Intf.AddReg

[OVT.USBDCam2800.Intf.AddReg]
HKR,,CLSID,,%ProxyVCap.CLSID%
HKR,,FriendlyName,,%USB\VID_05A9&PID_2800.DeviceDesc%
HKR,,ExtensionDLL,,%Ovt.ExtensionDLL%
....
....
[Strings]
ProxyVCap.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
KSCATEGORY_CAPTURE="{65E8773D-8F56-11D0-A3B9-00A0C9223196}"
KSCATEGORY_VIDEO="{6994ad05-93ef-11D0-A3cc-00A0C9223196}"


If you look at KSUUIDS.H, the AM_KSCATEGORY_CAPTURE is defined as below:

// 65E8773D-8F56-11D0-A3B9-00A0C9223196
OUR_GUID_ENTRY(AM_KSCATEGORY_CAPTURE,
0x65E8773DL, 0x8F56, 0x11D0, 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96)

whose guid is exactly the same as KSCATEGORY_CAPTURE in OmniVision driver
installation file OVUSB2.INF.

What I am wondering is this, does OmniVision driver need to call
IoRegisterDeviceInterface to register this AM_KSCATEGORY_CAPTURE, something
like the codes below ?

status = IoRegisterDeviceInterface (
PhysicalDeviceObject,
(LPGUID) &AM_KSCATEGORY_CAPTURE,
NULL,
&fdoData->InterfaceName);

If it does, then I think that's the reason why my application can not
receive WM_DEVICECHANGE .
Is the call "IoRegisterDeviceInterface" needed in the driver?
Appreciated!


"Eliyas Yakub [MSFT]" <eliyasy(a)online.microsoft.com>
???????:DE5690F5-7207-4953-B347-90561FC157A5(a)microsoft.com...
>I don't have access to the WDK. Is AM_KSCATEGORY_CAPTURE microsoft defined
>interface guid? It's possible that OmniVision driver is not using the same
>guid.
>
> -Eliyas
>
>
> "john" <johnchen6000(a)yahoo.com.tw> wrote in message
> news:uaovmTcWIHA.6044(a)TK2MSFTNGP05.phx.gbl...
>> Hi There,
>>
>> Is any one out there know under what situation an application will not be
>> able to receive WM_DEVICECHANGE?
>>
>> I used an OmniVision Web cam demo board with driver. And I wrote an
>> application which is supposed to receive the WM_DEVICECHANGE message, but
>> it did not receive the message.
>>
>> The RegisterDeviceNotificaiton has been called, like below:
>>
>> DEV_BROADCAST_DEVICEINTERFACE filterData;
>> ZeroMemory(&filterData, sizeof(DEV_BROADCAST_DEVICEINTERFACE));
>> filterData.dbcc_reserved = 0;
>> filterData.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
>> filterData.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
>> filterData.dbcc_classguid = AM_KSCATEGORY_CAPTURE;
>> ghDevNotify = RegisterDeviceNotification(ghwnd, &filterData,
>> DEVICE_NOTIFY_WINDOW_HANDLE);
>>
>> What bother me is, if I use another Web cam (UVC or DirectShow
>> compliant), it works!
>> But if I use OmniVision Web cam board, it does not work!
>> Could it be the OminVision driver problem?
>>
>> Any help will be highly appreciated.
>>


From: Mark Roddy on
On Jan 25, 4:45 am, "john" <johnchen6...(a)yahoo.com.tw> wrote:
> Hi Eliyas,
>
> Many thanks for your response.
> Yes, AM_KSCATEGORY_CAPTURE is defined in ksuuids.h.
> And the OmniVision driver installation file OVUSB2.INF adds something to the
> registry as below:
>
> [OVT.USBDCam2800.NT.Interfaces]
> AddInterface=%KSCATEGORY_CAPTURE%,GLOBAL,OVT.USBDCam2800.Interface
> AddInterface=%KSCATEGORY_VIDEO%,GLOBAL,OVT.USBDCam2800.Interface
>
> [OVT.USBDCam2800.Interface]
> AddReg=OVT.USBDCam2800.Intf.AddReg
>
> [OVT.USBDCam2800.Intf.AddReg]
> HKR,,CLSID,,%ProxyVCap.CLSID%
> HKR,,FriendlyName,,%USB\VID_05A9&PID_2800.DeviceDesc%
> HKR,,ExtensionDLL,,%Ovt.ExtensionDLL%
> ...
> ...
> [Strings]
> ProxyVCap.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
> KSCATEGORY_CAPTURE="{65E8773D-8F56-11D0-A3B9-00A0C9223196}"
> KSCATEGORY_VIDEO="{6994ad05-93ef-11D0-A3cc-00A0C9223196}"
>
> If you look at KSUUIDS.H, the AM_KSCATEGORY_CAPTURE is defined as below:
>
> // 65E8773D-8F56-11D0-A3B9-00A0C9223196
> OUR_GUID_ENTRY(AM_KSCATEGORY_CAPTURE,
> 0x65E8773DL, 0x8F56, 0x11D0, 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96)
>
> whose guid is exactly the same as KSCATEGORY_CAPTURE in OmniVision driver
> installation file OVUSB2.INF.
>
> What I am wondering is this, does OmniVision driver need to call
> IoRegisterDeviceInterface to register this AM_KSCATEGORY_CAPTURE, something
> like the codes below ?
>
> status = IoRegisterDeviceInterface (
>                 PhysicalDeviceObject,
>                 (LPGUID) &AM_KSCATEGORY_CAPTURE,
>                 NULL,
>                 &fdoData->InterfaceName);
>
> If it does, then I think that's the reason why my application can not
> receive WM_DEVICECHANGE .
> Is the call "IoRegisterDeviceInterface" needed in the driver?
> Appreciated!
>
> "Eliyas Yakub [MSFT]" <eliy...(a)online.microsoft.com>
> ???????:DE5690F5-7207-4953-B347-90561FC15...(a)microsoft.com...
>
>
>
> >I don't have access to the WDK. Is AM_KSCATEGORY_CAPTURE microsoft defined
> >interface guid? It's possible that OmniVision driver is not using the same
> >guid.
>
> > -Eliyas
>
> > "john" <johnchen6...(a)yahoo.com.tw> wrote in message
> >news:uaovmTcWIHA.6044(a)TK2MSFTNGP05.phx.gbl...
> >> Hi There,
>
> >> Is any one out there know under what situation an application will not be
> >> able to receive WM_DEVICECHANGE?
>
> >> I used an OmniVision Web cam demo board with driver. And I wrote an
> >> application which is supposed to receive the WM_DEVICECHANGE message, but
> >> it did not receive the message.
>
> >> The RegisterDeviceNotificaiton has been called, like below:
>
> >>    DEV_BROADCAST_DEVICEINTERFACE filterData;
> >>    ZeroMemory(&filterData, sizeof(DEV_BROADCAST_DEVICEINTERFACE));
> >>    filterData.dbcc_reserved = 0;
> >>    filterData.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
> >>    filterData.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
> >>    filterData.dbcc_classguid = AM_KSCATEGORY_CAPTURE;
> >>    ghDevNotify = RegisterDeviceNotification(ghwnd, &filterData,
> >> DEVICE_NOTIFY_WINDOW_HANDLE);
>
> >> What bother me is, if I use another Web cam (UVC or DirectShow
> >> compliant), it works!
> >> But if I use OmniVision Web cam board, it does not work!
> >> Could it be the OminVision driver problem?
>
> >> Any help will be highly appreciated.- Hide quoted text -
>
> - Show quoted text -

Yes the driver has to register the same interface your application is
registered to receive notifications on. You can register for multiple
interfaces, or for all itnerfaces and then filter the event for the
interfaces you care about.
From: john on
Hi Mark,

Thanks a lot.
This is all I want to know.
This proves my doubt is correct.
I guess OmniVison's driver must have forgotten to register the
AM_KSCATEGORY_CAPTURE interface, causing my application unable to receive
WM_DEVICECHANGE.
Now, another question comes up to my mind, i.e., is there any way to get
around?
I mean, under this condition, is there any way for my application to be able
to receive WM_DEVICECHANGE?
You're highly appreciated.


"Mark Roddy" <markr(a)hollistech.com>
???????:5f73aeeb-ca23-4c17-a83f-19a0cee6f91e(a)i72g2000hsd.googlegroups.com...
On Jan 25, 4:45 am, "john" <johnchen6...(a)yahoo.com.tw> wrote:
> Hi Eliyas,
>
> Many thanks for your response.
> Yes, AM_KSCATEGORY_CAPTURE is defined in ksuuids.h.
> And the OmniVision driver installation file OVUSB2.INF adds something to
> the
> registry as below:
>
> [OVT.USBDCam2800.NT.Interfaces]
> AddInterface=%KSCATEGORY_CAPTURE%,GLOBAL,OVT.USBDCam2800.Interface
> AddInterface=%KSCATEGORY_VIDEO%,GLOBAL,OVT.USBDCam2800.Interface
>
> [OVT.USBDCam2800.Interface]
> AddReg=OVT.USBDCam2800.Intf.AddReg
>
> [OVT.USBDCam2800.Intf.AddReg]
> HKR,,CLSID,,%ProxyVCap.CLSID%
> HKR,,FriendlyName,,%USB\VID_05A9&PID_2800.DeviceDesc%
> HKR,,ExtensionDLL,,%Ovt.ExtensionDLL%
> ...
> ...
> [Strings]
> ProxyVCap.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
> KSCATEGORY_CAPTURE="{65E8773D-8F56-11D0-A3B9-00A0C9223196}"
> KSCATEGORY_VIDEO="{6994ad05-93ef-11D0-A3cc-00A0C9223196}"
>
> If you look at KSUUIDS.H, the AM_KSCATEGORY_CAPTURE is defined as below:
>
> // 65E8773D-8F56-11D0-A3B9-00A0C9223196
> OUR_GUID_ENTRY(AM_KSCATEGORY_CAPTURE,
> 0x65E8773DL, 0x8F56, 0x11D0, 0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31,
> 0x96)
>
> whose guid is exactly the same as KSCATEGORY_CAPTURE in OmniVision driver
> installation file OVUSB2.INF.
>
> What I am wondering is this, does OmniVision driver need to call
> IoRegisterDeviceInterface to register this AM_KSCATEGORY_CAPTURE,
> something
> like the codes below ?
>
> status = IoRegisterDeviceInterface (
> PhysicalDeviceObject,
> (LPGUID) &AM_KSCATEGORY_CAPTURE,
> NULL,
> &fdoData->InterfaceName);
>
> If it does, then I think that's the reason why my application can not
> receive WM_DEVICECHANGE .
> Is the call "IoRegisterDeviceInterface" needed in the driver?
> Appreciated!
>
> "Eliyas Yakub [MSFT]" <eliy...(a)online.microsoft.com>
> ???????:DE5690F5-7207-4953-B347-90561FC15...(a)microsoft.com...
>
>
>
> >I don't have access to the WDK. Is AM_KSCATEGORY_CAPTURE microsoft
> >defined
> >interface guid? It's possible that OmniVision driver is not using the
> >same
> >guid.
>
> > -Eliyas
>
> > "john" <johnchen6...(a)yahoo.com.tw> wrote in message
> >news:uaovmTcWIHA.6044(a)TK2MSFTNGP05.phx.gbl...
> >> Hi There,
>
> >> Is any one out there know under what situation an application will not
> >> be
> >> able to receive WM_DEVICECHANGE?
>
> >> I used an OmniVision Web cam demo board with driver. And I wrote an
> >> application which is supposed to receive the WM_DEVICECHANGE message,
> >> but
> >> it did not receive the message.
>
> >> The RegisterDeviceNotificaiton has been called, like below:
>
> >> DEV_BROADCAST_DEVICEINTERFACE filterData;
> >> ZeroMemory(&filterData, sizeof(DEV_BROADCAST_DEVICEINTERFACE));
> >> filterData.dbcc_reserved = 0;
> >> filterData.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
> >> filterData.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
> >> filterData.dbcc_classguid = AM_KSCATEGORY_CAPTURE;
> >> ghDevNotify = RegisterDeviceNotification(ghwnd, &filterData,
> >> DEVICE_NOTIFY_WINDOW_HANDLE);
>
> >> What bother me is, if I use another Web cam (UVC or DirectShow
> >> compliant), it works!
> >> But if I use OmniVision Web cam board, it does not work!
> >> Could it be the OminVision driver problem?
>
> >> Any help will be highly appreciated.- Hide quoted text -
>
> - Show quoted text -

Yes the driver has to register the same interface your application is
registered to receive notifications on. You can register for multiple
interfaces, or for all itnerfaces and then filter the event for the
interfaces you care about.