RE: [SPAM] - Re: stream class driver symbolic link for video capture. - Bayesian Filter detected spa

This information about doing the createfile using the portname is there
in the 2600.1106 DDK under still image devices section. Look for this
topic to get this info : Accessing Kernel-Mode Drivers for Still Image
Devices.
I will copy paste the info to the end of this e-mail also. It talks
about a minidriver being able to talk to it’s driver using IOCTLs
converted to URBs.
I am not writing a minidriver, but implying that it will work with
applications also.

The reason I am still researching into this is because Directshow did
not ship with a certain service pack of win2000. The only option to get
video in 2000 seems to be using VFW which is horribly inefficient and
takes up 90% of the CPU on some camera models. To get around this
situation I am wondering if I can get video data in some other way. I am
wondering if I can get video data by opening a handle to the video class
driver and sending it the
IOCTL_SEND_USB_REQUEST as described by the DDK.

Following is the info from the DDK.

USB Driver
The kernel-mode still image driver for USB buses supports a single
control endpoint, along with multiple interrupt, bulk IN, and bulk OUT
endpoints. The control and interrupt endpoints are accessible using I/O
control codes and DeviceIoControl. The bulk endpoints are accessible
using ReadFile and WriteFile.

Before calling DeviceIoControl, ReadFile, or WriteFile, you must call
CreateFile (all described in the Platform SDK documentation) to obtain a
device handle. For devices that support no more than one of each
endpoint type (control, interrupt, bulk IN, bulk OUT), a single call to
CreateFile opens transfer pipes to each endpoint.

For devices that support multiple interrupt or bulk endpoints, a single
call to CreateFile opens transfer pipes to the highest-numbered endpoint
of each type. If you want to use a different endpoint, you must do the
following:

Call DeviceIoControl, specifying an I/O control code of
IOCTL_GET_PIPE_CONFIGURATION, to determine a port’s endpoint index
numbers (that is, indexes into the returned USBSCAN_PIPE_INFORMATION
structure array). Note that these index numbers are not the endpoint
numbers described in the Universal Serial Bus Specification.
Append a backslash and the endpoint’s index number to the port name
returned by IStiDeviceControl::GetMyDevicePortName when calling
CreateFile.

For example, suppose a device (with a port name of “usbscan0”) has two
endpoints of each type (interrupt, bulk IN, bulk OUT), with index
numbers as follows:

Index Type Endpoint#
0 Interrupt 0x01
1 Bulk IN 0x82
2 Bulk IN 0x83
3 Bulk OUT 0x04
4 Bulk OUT 0x05
5 Interrupt 0x06

If you call CreateFile with a port name of “usbscan0”, the function
opens transfer pipes to endpoints with index values of 2, 4, and 5, as
well as the control endpoint.

If you call CreateFile with a port name of “usbscan0\1”, the function
opens transfer pipes to endpoints with index values of 1, 4, and 5, as
well as the control endpoint.

For this device, if you want to use interrupt endpoint 0, bulk IN
endpoint 1, and bulk OUT endpoint 3, call CreateFile three times,
specifying port names of “usbscan0\0”, “usbscan0\1”, and “usbscan0\3”.
This creates three device handles. Whenever a subsequent call to
DeviceIoControl, ReadFile, or WriteFile is made, the device handle
associated with the desired pipe should be specified.

Because only one control endpoint is supported, specifying any I/O
control code that uses the control pipe causes the driver to use the
proper endpoint, regardless of which endpoint (if any) was specified to
CreateFile.

For descriptions of all I/O control codes, see USB Still Image I/O
Control Codes.

The kernel-mode USB driver does not implement a package or message
protocol. Read operations do not require any particular packet
alignment, but better performance can be achieved if read requests are
aligned to maximum packet size boundaries. The maximum packet size can
be obtained using the IOCTL_GET_CHANNEL_ALIGN_RQST I/O control code.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Tuesday, June 07, 2005 12:01 PM
To: Windows System Software Devs Interest List
Subject: [SPAM] - Re: [ntdev] stream class driver symbolic link for
video capture. - Bayesian Filter detected spam

Amitabh Mathrawala wrote:

I went ahead and tried to use STI to capture video by getting the
symbolic link (port name) of the underlying driver using
IStillImage::GetDeviceInfo.
According to the DDK I can use the port name inside the
STI_DEVICE_INFORMATION structure returned by IStillImage::GetDeviceInfo
to create a handle to the device and then send IOCTLs to the device get
raw video data.

Where does it say that? I couldn’t find it, and I don’t believe it
anyway.

In my case, the port name that I am getting is “AUTO”
and that does not work with CreateFile (I tried “\.\AUTO”, “AUTO”,
“AUTO\0”).
Does anyone know what the port name of “AUTO” mean ? Does it mean that
I
cannot open a handle to the device using createfile ?

The port name only meaningful on certain types of busses, to distinguish

devices that might otherwise be confused. Every STI driver I’ve ever
done has declared itself as “AUTO”. If you want a handle you can open
with CreateFile, you will have to use the SetupDi routines to scan the
video device class.

Even with that, though, I don’t know how you are going to fetch video
data.

A followup question that I have is, is there any way I can capture
video
data from my USB webcam without using directx, wia, or twain ? I don’t
mind writing a kernel mode driver (filter) if there is documented or
semi-documented way of doing it.

Why on earth would you be willing to go to the effort and danger of
writing a kernel driver, but discard the DirectShow approach?
DirectShow is a lot less trouble than a kernel driver. Web cameras are
streaming devices. There are protocols to follow to get them fired up
to the point where you can get frames. DirectShow and kernel streaming
understand that protocol, so you don’t have to.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@viack.com
To unsubscribe send a blank email to xxxxx@lists.osr.com