Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to open a pipe ?

2 views
Skip to first unread message

Colin

unread,
Jun 17, 2004, 4:35:16 AM6/17/04
to
I have a device with a usb interface, I have the driver supplied by
the manufacturer, the specification detailing packet formats, and a
GUID value. The spec states that ReadFile and WriteFile should be used
to read/write the pipe - no problem for me as I have used these fns
with threading for serial port comms for years.
I have just one (simple ?) problem - how do I obtain a HANDLE for the
pipe ?

vanathy

unread,
Jun 21, 2004, 4:29:31 AM6/21/04
to
Colin <co...@microscum.com> wrote in message news:<sgl2d0hpi6pu1gpcv...@4ax.com>...

Hi,

I understand, you are trying to access the device from an usermode
Application. In that case, You must call CreateFile to open a handle
to the device. Do not worry about pipes, internally the driver will
take care of it (Routes the write to the OUT pipe and Read to the IN
pipe).

Rgds
Vanathy

Colin

unread,
Jun 21, 2004, 4:48:26 PM6/21/04
to
van...@hotmail.com (vanathy) wrote:

My problem is the CreateFile call, what do I put in parameter 1 - the
filename ?
Cheers,
Colin.


vanathy

unread,
Jun 22, 2004, 1:31:42 AM6/22/04
to
Hi,

THIS IS AN EXCERPT FROM MSDN & it EXPLAINS USING THE GUID TO OBTAIN A
HANDLE FOR THE DEVICE,
---------------------------------------------------------------------
Device drivers provide a uniform and extensible way for applications
and the system to interact with them programmatically, known as a
device interface. Drivers expose, register, and enable device
interfaces. A driver can expose zero, one, or more than one interface
for a particular device. A device interface is represented by a GUID.


Each device interface is a member of a device interface class. A
device interface class is a group of device interfaces with the same
functionality. For example, all the joysticks on a system could be
members of the joystick device interface class. A device interface
class is identified by a class GUID.

When an application must communicate with a device, it searches for a
device that exports the required interface. To perform the search, use
the following steps.

Call the SetupDiGetClassDevs or SetupDiGetClassDevsEx function to
obtain a list of all devices in a specified device class. This list is
known as a device information set.
Call the SetupDiEnumDeviceInterfaces function to enumerate all devices
of the specified class that export the interface.
To communicate with the device, call the
SetupDiGetDeviceInterfaceDetail function. This function returns device
information in an SP_DEVICE_INTERFACE_DETAIL_DATA structure. The
DevicePath member provides the symbolic link name, which can be used
in the CreateFile function to access the device.


Regards
Vanathy


Colin <co...@microscum.com> wrote in message news:<n7ied059fj88lsosu...@4ax.com>...

Colin

unread,
Jun 23, 2004, 2:11:16 PM6/23/04
to
Thanks for the info - just what I needed. It appears that MSVC++5.0
has an earlier version of setupapi.lib and setupapi.h, and does not
contain all the functions listed, so I am trying to buy version 6.0 at
present. Not too many sources left though.
I also ordered the DDK from $MS but it is out of stock.
Colin.
0 new messages