Using virtual com port on windows mobile

白昼怎懂夜的黑 提交于 2019-12-08 10:42:06

问题


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 hardware 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.


回答1:


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



来源:https://stackoverflow.com/questions/6193822/using-virtual-com-port-on-windows-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!