Re: WinCE USB



CreateFile( deviceName, ... );

Paul T.

"Bator" <bks@xxxxxx> wrote in message
news:1177666395.202390.182480@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Apr 26, 5:53 pm, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
no instrument no spam DOT com> wrote:
If you have a serial device, there's no *reason* to make any of those
calls.
Why are you trying to do that? If it's a serial device, do a CreateFile(
_T( "COM1:" ), ... ), etc. and talk to the serial port.

Paul T.

"Bator" <b...@xxxxxx> wrote in message

news:1177576139.255307.79040@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



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- Hide quoted text -

- Show quoted text -

Hi Paul,

thank you for your answers.

I have got some files from the company which has written the driver.
Now it is no problem to get a HANDLE to the driver and to talk with
the device.

Although thank you for helping me!!




.



Relevant Pages

  • Re: USB Testing
    ... As for using CreateFile() from XP, I used the device ID for the USB ... WCEUSBSH driver to load. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: USB Testing
    ... I have no idea if the port is displayed in a GUI or is in the ... Trying to do a CreateFile in XP...As I said above, ... As for using CreateFilefrom XP, I used the device ID for the USB ... WCEUSBSH driver to load. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: CreateFile performance
    ... If many applications are calling driver, ... context need a separate handle or duplicate handle for CreateFile. ... CreateFile() for each process context. ... more than one packet from driver to user mode. ...
    (microsoft.public.development.device.drivers)
  • Re: About the settings in CreateFile
    ... sharing modes really apply to file systems, ... But I still have confusion in sharing mode of CreateFile. ... If the dispatch routine for IRP_MJ_CREATE in my driver always returns ... > called in the driver there is no IOCTL present here. ...
    (microsoft.public.development.device.drivers)
  • Re: WinCE USB
    ... do a CreateFile( ... If it's a storage card driver, ... If it's a network USB device, it should provide an IP to ... SetupDiEnumDeviceInterfaces() ...
    (microsoft.public.windowsce.platbuilder)

Loading