From: Sam Zehr Sam on
Hi.

I am trying to communicate directly with a USB webcam. (I know there are
easier ways to run a webcam, but I have my reasons :)

I am enumerating the USB devices, and getting the path with
SetupDiGetDeviceInterfaceDetail

I am able to get a valid handle to a thumb drive and USB keyboard with my
code, and the mouse returns ERROR_GEN_FAILURE, which is becuase the system
locks it, if I understand correctly.

Both the webcam and my gamepad return ERROR_FILE_NOT_FOUND from CreateFile.

The DevicePath seems to be correct, becuase I can get a handle to some
devices, and I seem to have the right device, because
SetupDiGetDeviceRegistryProperty is returning correct values.

What would cause CreateFile to not get a valid handle on some USB devices?

Thanks
Sam
From: Doron Holan [MSFT] on
the way the device is connected does not effect how it allows handles to be
created. are you using a different device interface guid for each?

--
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.


"Sam Zehr" <Sam Zehr(a)discussions.microsoft.com> wrote in message
news:E38A0A46-9E6F-4ED5-9205-E41461E20D96(a)microsoft.com...
> Hi.
>
> I am trying to communicate directly with a USB webcam. (I know there are
> easier ways to run a webcam, but I have my reasons :)
>
> I am enumerating the USB devices, and getting the path with
> SetupDiGetDeviceInterfaceDetail
>
> I am able to get a valid handle to a thumb drive and USB keyboard with my
> code, and the mouse returns ERROR_GEN_FAILURE, which is becuase the system
> locks it, if I understand correctly.
>
> Both the webcam and my gamepad return ERROR_FILE_NOT_FOUND from
> CreateFile.
>
> The DevicePath seems to be correct, becuase I can get a handle to some
> devices, and I seem to have the right device, because
> SetupDiGetDeviceRegistryProperty is returning correct values.
>
> What would cause CreateFile to not get a valid handle on some USB devices?
>
> Thanks
> Sam

From: samzehr on
Thanks for the reply. Sorry about the Google reply, but the ms website
post button wouldn't work for me.

I am using the same GUID to enumerate all my devices
static GUID GUID_DEVINTERFACE_USB_DEVICE =
{ 0xA5DCBF10L, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9,
0x51, 0xED } };

The DevicePath returned for my Logitech QuickCam Chat is
"\\?
\usb#vid_046d&pid_092e#6&3469dd70&0&4#{a5dcbf10-6530-11d2-901f-00c04fb951ed}"

The Vid and Pid check out from USBView

The PhysicalDeviceObjectName my code returns is
"\Device\USBPDO-5"

That shows up in WinObj in GLOBAL??, but actually there are four
USBPDO-5 listed

This code will return a valid HANDLE for some devices, but not the
webcam.

Thanks, Sam

On Apr 10, 11:13 pm, "Doron Holan [MSFT]"
<dor...(a)online.microsoft.com> wrote:
> the way the device is connected does not effect how it allows handles to be
> created.  are you using a different device interface guid for each?
>
> --
> "Sam Zehr" <Sam Z...(a)discussions.microsoft.com> wrote in messagenews:E38A0A46-9E6F-4ED5-9205-E41461E20D96(a)microsoft.com...
> > I am trying to communicate directly with a USB webcam. (I know there are
> > easier ways to run a webcam, but I have my reasons :)
>
> > I am enumerating the USB devices, and getting the path with
> > SetupDiGetDeviceInterfaceDetail
>
> > I am able to get a valid handle to a thumb drive and USB keyboard with my
> > code, and the mouse returns ERROR_GEN_FAILURE, which is becuase the system
> > locks it, if I understand correctly.
>
> > Both the webcam and my gamepad return ERROR_FILE_NOT_FOUND from
> > CreateFile.
>
> > The DevicePath seems to be correct, becuase I can get a handle to some
> > devices, and I seem to have the right device, because
> > SetupDiGetDeviceRegistryProperty is returning correct values.
>
> > What would cause CreateFile to not get a valid handle on some USB devices?
>
> > Thanks,Sam
From: Doron Holan [MSFT] on
this is a generic device itnerface to enumerate instances of usb device, it
is not used to open handles and talk to devices. you need to use device or
class specific GUIDs to commnicate with a device

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.


<samzehr(a)comcast.net> wrote in message
news:dfadf7a3-597c-4f5b-892b-829d81160e00(a)8g2000hsu.googlegroups.com...
Thanks for the reply. Sorry about the Google reply, but the ms website
post button wouldn't work for me.

I am using the same GUID to enumerate all my devices
static GUID GUID_DEVINTERFACE_USB_DEVICE =
{ 0xA5DCBF10L, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9,
0x51, 0xED } };

The DevicePath returned for my Logitech QuickCam Chat is
"\\?
\usb#vid_046d&pid_092e#6&3469dd70&0&4#{a5dcbf10-6530-11d2-901f-00c04fb951ed}"

The Vid and Pid check out from USBView

The PhysicalDeviceObjectName my code returns is
"\Device\USBPDO-5"

That shows up in WinObj in GLOBAL??, but actually there are four
USBPDO-5 listed

This code will return a valid HANDLE for some devices, but not the
webcam.

Thanks, Sam

On Apr 10, 11:13 pm, "Doron Holan [MSFT]"
<dor...(a)online.microsoft.com> wrote:
> the way the device is connected does not effect how it allows handles to
> be
> created. are you using a different device interface guid for each?
>
> --
> "Sam Zehr" <Sam Z...(a)discussions.microsoft.com> wrote in
> messagenews:E38A0A46-9E6F-4ED5-9205-E41461E20D96(a)microsoft.com...
> > I am trying to communicate directly with a USB webcam. (I know there are
> > easier ways to run a webcam, but I have my reasons :)
>
> > I am enumerating the USB devices, and getting the path with
> > SetupDiGetDeviceInterfaceDetail
>
> > I am able to get a valid handle to a thumb drive and USB keyboard with
> > my
> > code, and the mouse returns ERROR_GEN_FAILURE, which is becuase the
> > system
> > locks it, if I understand correctly.
>
> > Both the webcam and my gamepad return ERROR_FILE_NOT_FOUND from
> > CreateFile.
>
> > The DevicePath seems to be correct, becuase I can get a handle to some
> > devices, and I seem to have the right device, because
> > SetupDiGetDeviceRegistryProperty is returning correct values.
>
> > What would cause CreateFile to not get a valid handle on some USB
> > devices?
>
> > Thanks,Sam