2

I am using the exact same code as this to handle video device loss. I am testing my app with a Logitech C920 webcam.

When the webcam is plugged into a USB2 port on Windows 7 the code works as expected and it detects a camera unplug.

However, the same code fails when the camera is connected to a USB3 port under Windows 10.

The problem is that the value of pDi->dbcc_name only partially matches that of g_pwszSymbolicLink.

I highlight the difference below.

L"\\?\USB#VID_046D&PID_082D&MI_00#7&E9B492F&0&0000#{E5323777-F976-4F5B-9B55-B94699C46E44}\GLOBAL"

L"\\?\USB#VID_046D&PID_082D&MI_00#7&E9B492F&0&0000#{65E8773D-8F56-11D0-A3B9-00A0C9223196}\GLOBAL"

Anyone know why this is? Should the code be corrected to ignore this part of the string?

JPh
  • 536
  • 3
  • 20
  • The first one is KSCATEGORY_VIDEO_CAMERA, the second is KSCATEGORY_CAPTURE. That makes a difference to your code. Might have something to do with the increased bandwidth available on USB3. – Hans Passant Feb 28 '19 at 14:49
  • Well spotted, registering for notification of KSCATEGORY_CAMERA in addition to KSCATEGORY_CAPTURE resolves the problem on Win10. I wonder if this is an omission in MS' doc or something I do not understand yet. Not related to USB3, I tested USB3 on Win7 in the meantime and got no behavior change. – JPh Feb 28 '19 at 17:33
  • If I am not mistaken, according to Microsoft sample code you are supposed to register for KSCATEGORY_CAPTURE notifications anyway (because those are composite devices), not KSCATEGORY_VIDEO_CAMERA. – Igor Levicki Feb 07 '22 at 10:47

0 Answers0