在 Windows Mobile 上使用虚拟 com 端口

发布于 2024-11-10 11:08:35 字数 287 浏览 1 评论 0原文

我有一台运行 Windows CE 5.0 的 Windows Mobile 设备。 我现在想将硬件连接到 USB 端口,并通过将其配置为虚拟 com 端口并向其写入/读取字节来与硬件进行通信。

我是否必须为 Windows Mobile 设备编写虚拟 com 驱动程序?请注意,硬件设备只是发送/接收字节的设备。

我可以简单地使用.net框架的SerialPort类吗?

将设备连接到 USB 后,我如何知道设备所连接的 COM 端口? windows mobile 有设备管理器吗?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

话少情深 2024-11-17 11:08:35

Windows Mobile != Windows CE 5.0,因此首先您需要验证您的硬件实际运行的是什么。其次,您必须验证“USB 端口”是什么。 USB 有两种“模式”——主机模式和客户端模式——它们在物理上和软件上都不同。如果您通过该端口将设备连接到 PC,那么它就是客户端端口,并且无法接受外围设备。

现在,如果它是 CE 5.0 设备并且如果它是 USB 主机端口,那么我们将深入了解 USB 设备类型和操作系统驱动程序。它是什么样的设备?它是否已经充当串行设备(例如,它具有 FTDI 或 Prolific 芯片组)?如果是这样,只需安装正确的 CE 驱动程序即可。如果没有,那么您需要编写一个主机设备驱动程序以允许 USB 系统与该特定设备进行通信。该驱动程序如何工作取决于硬件。

至于端口名称是什么,这取决于主机驱动程序的注册表设置。通常,它将从第一个可用端口启动(即,如果您的硬件已经有“COM1:”,那么它将从“COM2:”启动),但这很容易被覆盖,因此请在注册表中进行验证。

编辑

有关驱动程序实现的示例,请参阅 PC 上的以下位置(假设您已安装 Platform Builder - 我认为自 3.0 起的任何版本):

< code>%WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\USB\CLASS\USBSER 用于基本 USB 主机 串行类驱动程序示例
%WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\USBFN\CLASS\SERIAL 用于基本 USB 功能 串行驱动程序示例

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文