Re: WinCE USB



On Apr 24, 6:04 pm, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
no instrument no spam DOT com> wrote:
Generally, you don't talk to USB devices directly *at all*. They have a
driver. It must present some sort of interface. Use *that* interface, not
any USB calls at all. If it's a storage card driver, it should produce a
new folder in the filesystem and you'd use the CreateFile, ReadFile,
WriteFile APIs. If it's a network USB device, it should provide an IP to
the device and you'd use WinSock or FTP or HTTP APIs to work with it. If
it's a serial device, it should create a new COM port and you'd use the
CreateFile, SetCommTimeouts, etc. APIs to communicate with it.

Paul T.

"Stefan Burkhart" <b...@xxxxxx> wrote in message

news:1177403167.372289.258210@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



Hello,

I'm a student from Germany so my english isn't very well. sorry.

I have a WinCE 5.0 Platform. (created with Platformbuilder 5.0) and
should make an application with Visual Studio 2005 which should send
commands to an USB-Device, connected to the WinCE Platform.
The WinCE driver for the device already had been written by an other
company.

I'm new with USB and WinCE but I found the following functions

SetupDiGetClassDevs()
SetupDiEnumDeviceInterfaces()
SetupDiGetDeviceInterfacedetail()

I think with this functions I can get a String -> "FDO" (Functional
Device Object).
And this string I need for the the function CreateFile() to get a
Handle to the USB-device.

Is that rigth? Or is it the wrong way?

If it is the rigth way I have a problem with the needed libraries:
The platformbuilder created a setupapi.lib
(after I build in the IEEE 1394 Modul) but there is no (matching)
setupapi.h?

(On "C:\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\1394\INC" I can find a
setupapi.h but it seems to be the wrong? (Linker error))

I would be deeply greateful if somebody could help me
thanks.

Stefan- Hide quoted text -

- Show quoted text -

Hi Paul,

thanks for your answer. I think I have serial device. Because I still
cannnot use the funktions

SetupDiGetClassDevs()
SetupDiEnumDeviceInterfaces()
SetupDiGetDeviceInterfacedetail()

so I looked in the registry of the WinCe device under HKLM/Drivers/
Active and found my device:

__________________________
(Default) (value not set)
Hnd 305264
Name DAB1:
Key Drivers\USB\ClientDriver\DAB_CLASS
ClientInfo 304048
__________________________

I use:
----------------------------------------------
LPTSTR portName = TEXT("DAB1:");
HANDLE USB;
USB = CreateFile(portName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, // no security
OPEN_EXISTING, // pipe created by ccClient NamedPipe .
FILE_FLAG_OVERLAPPED, // default attributes.
NULL);

// if fail opening the port, return FALSE
if ( USB == INVALID_HANDLE_VALUE )
{
AfxMessageBox(L"Unable to open USB port",
MB_ICONSTOP);
DWORD error = GetLastError();

CString s;
s.Format(L"Error: %d", error);
AfxMessageBox(s);

}
else
............
-----------------------------------------
to get an HANDLE to the driver.
Thats rigth?

But how can I go on now?
(I have no documentation of the driver. Only a documentation of the
WinXP driver for the device)

Thank a lot

Stefan

.



Relevant Pages