开发者

Using virtual com port on windows mobile

开发者 https://www.devze.com 2023-03-10 00:54 出处:网络
I have a windows mobile device which is running windows CE 5.0. I want to now connect a hardware to the USB port and communicate with the hard开发者_如何学运维ware by configuring it as a virutal com

I have a windows mobile device which is running windows CE 5.0. I want to now connect a hardware to the USB port and communicate with the hard开发者_如何学运维ware by configuring it as a virutal com port and writing/reading bytes to/from it.

Do i have to write a virual com driver for the windows mobile device? Please note that the hardware device that is just a device which sends/receives bytes..

Can i simply use the SerialPort class of .net framework?

How will i know the COM port to which the device is connected once i connect it to the USB ? is there a device manager in windows mobile?

Thanks.


Windows Mobile != Windows CE 5.0, so first you need to verify what your hardware is actually running. Second, you have to verify what the "USB port" is. USB has two "modes" - Host and CLient - and they are different both physically and in software. If it's the port that you hoos the device to the PC through, then it's a client port and is not going to be able to accept a peripheral.

Now if it's a CE 5.0 device and if it's a USB Host port then we get down to the USB device type and the OS drivers. What kind of device is it? Does it act as a serial device already (e.g. it has an FTDI or Prolific chipset in it)? If so, just install the right CE driver and you're set. If it doesn't, then you need to write a host device driver to allow the USB system to communicate with this particular device. How that driver will work depends on the hardware.

AS to what the port name will be, that's up to the host driver's registry settings. Typically it will start at the first available port (i.e. if your hardware already has "COM1:", then it will start at "COM2:"), but that's easily overridden, so verify in the registry.

EDIT

For examples of the driver implementations see the following locations on your PC (this assumes you've got Platform Builder - I think any version since about 3.0 - installed):

%WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\USB\CLASS\USBSER for a basic USB host serial class driver example
%WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\USBFN\CLASS\SERIAL for a basic USB function serial driver example

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号