伪造 RS232 串口
我正在开发一个项目,其中有许多硬件传感器通过 RS232 串行端口连接到部署机器。
但是......我正在一台没有物理 RS232 串口的机器上进行开发,但我想制作一个可以连接并输出数据的假串口,目的是伪造来自硬件传感器的输入。
有谁知道在 Windows XP 上创建假串行端口并控制它的方法吗?
I'm developing a project that has a number of hardware sensors connecting to the deployment machine through RS232 serial ports.
But ... I'm developing on a machine without an physical RS232 serial ports, but I would like to make fake serial ports that I can connect to and output data from with the aim of faking input from hardware sensors.
Does anyone know of a way to create a fake serial port and control it on Windows XP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
如果您正在为 Windows 进行开发,com0com 项目可能就是您正在寻找的。
它提供了通过 nullmodem 连接进行链接的虚拟 COM 端口对。然后,您可以使用您最喜欢的终端应用程序或任何您喜欢的应用程序将数据发送到一个 COM 端口并从另一个端口接收数据。
编辑:
正如 Thomas 指出的,该项目缺乏签名驱动程序,这在某些 Windows 版本(例如 Windows 7 x64)上尤其有问题。
有几个非官方的 com0com 版本确实包含签名的驱动程序。例如,可以从此处下载最新版本 (3.0.0.0)。
If you are developing for Windows, the com0com project might be, what you are looking for.
It provides pairs of virtual COM ports that are linked via a nullmodem connetion. You can then use your favorite terminal application or whatever you like to send data to one COM port and recieve from the other one.
EDIT:
As Thomas pointed out the project lacks of a signed driver, which is especially problematic on certain Windows version (e.g. Windows 7 x64).
There are a couple of unofficial com0com versions around that do contain a signed driver. One recent verion (3.0.0.0) can be downloaded e.g. from here.
一个不错的选择是 Eterlogic 的虚拟串行端口模拟器 (VSPE)
它提供了一个用于创建内核模式虚拟端口设备的 API,即连接器、映射器、分离器等。这是一家小公司,但仍在不断扩展和维护其产品列表。 (2023 年初指出)
另一个非常好的选择是 Eltima。该产品在其虚拟产品的各个方面都如广告中所宣传的那样,并且包括良好的技术支持。产品选项包括桌面应用程序以及带有 API 的软件开发套件。该公司仍然活跃并不断发展,产品类别不断扩大。 (2023 年初指出)
这两种产品都不是开源或免费的。然而,正如其他帖子所指出的,还有其他选择。以下是各种串行实用程序的列表:
com0com(当前)
com0com - 带有签名驱动程序(旧版本)
com0com 与签名驱动程序的另一个地方 (皮特的博客)
战术软件
白蚁
AGG 软件串口模拟器
Kermit(已过时,但仍可下载)
HW 组 - HWVSP3
HHD 软件(免费版)
如果您发现过时的链接,请评论我。 (链接于 2023 年初验证。)
One good option is Virtual Serial Port Emulator (VSPE) from Eterlogic
It provides an API for creating kernel mode virtual comport devices, i.e. connectors, mappers, splitters etc. This is a small company but continues to expand and maintain their product list. (noted early 2023)
Another very good option is Eltima. This product worked as advertised in all aspects of its virtual comport offering, and included good technical support. Product options include both desktop applications, as well as software development kits with APIs. This company remains active and growing, with expanding product categories. (noted early 2023)
Neither of these two products are open source, or free. However, as other posts here have pointed out, there are other options. Here is a list of various serial utilities:
com0com (current)
com0com - With Signed Driver (old version)
Yet another place for com0com with Signed Driver (Pete's Blog)
Tactical Software
Termite
AGG Software Serial Port Emulators
Kermit (obsolete, but still downloadable)
HW Group - HWVSP3
HHD Software (free edition)
Please comment me if you find a stale link. (Links verified early 2023.)
我在 Windows 7 x64 上使用 com0com - 带签名驱动程序来模拟 COM3 和 COM4 。
然后我使用 COM 数据端口模拟器 从 COM4 接收数据。
然后我使用正在开发的应用程序(c#)打开 COM3 并将数据发送到 COM3。
通过 COM3 发送的数据由 COM4 接收,并由“COM 数据端口模拟器”显示,该模拟器还可以发回响应(非自动)。
因此,通过这两个出色的程序,我成功地模拟了串行 RS-232 通信。
希望有帮助。
这两个程序都是免费的!!!!
I use com0com - With Signed Driver, on windows 7 x64 to emulate COM3 AND COM4 as a pair.
Then i use COM Dataport Emulator to recieve from COM4.
Then i open COM3 with the app im developping (c#) and send data to COM3.
The data sent thru COM3 is received by COM4 and shown by 'COM Dataport Emulator' who can also send back a response (not automated).
So with this 2 great programs i managed to emulate Serial RS-232 comunication.
Hope it helps.
Both programs are free!!!!!
总是有硬件路线。购买两个 USB 转串口转换器,并通过 NULL 调制解调器连接它们。
专业提示:
1) 每次设备睡眠或重新启动后,Windows 可能会向适配器分配新的 COM 端口。
2) USB转串口芯片的市场领导者是Prolific和FTDI。两家公司都在与假冒产品作斗争,并且可能会在未来的官方 Windows 驱动程序中被屏蔽。不过,Linux 驱动程序与克隆版本配合得很好。
There's always the hardware route. Purchase two USB to serial converters, and connect them via a NULL modem.
Pro tips:
1) Windows may assign new COM ports to the adapters after every device sleep or reboot.
2) The market leaders in chips for USB to serial are Prolific and FTDI. Both companies are battling knockoffs, and may be blocked in future official Windows drivers. The Linux drivers however work fine with the clones.
另一种选择,即使OP没有要求它:
存在USB转串口适配器。
根据适配器的类型,您可能还需要一根零调制解调器电缆。
它们在 Linux 下非常容易使用,如果您安装了可用的驱动程序,它们也可以在 Windows 下工作。
这样您就可以直接使用传感器,而不必尝试模拟数据。
这样你甚至可以避免构建一个贫血的系统。
(由于您的模拟数据输入并未涵盖所有情况,导致您的系统很脆弱。)
使用真实的东西通常会更好。
Another alternative, even though the OP did not ask for it:
There exist usb-to-serial adapters.
Depending on the type of adapter, you may also need a nullmodem cable, too.
They are extremely easy to use under linux, work under windows, too, if you have got working drivers installed.
That way you can work directly with the sensors, and you do not have to try and emulate data.
That way you are maybe even save from building an anemic system.
(Due to your emulated data inputs not covering all cases, leading you to a brittle system.)
Its often better to work with the real stuff.
我发现免费虚拟串行端口非常适合我的非商业用例。对于其他用例来说,它不是免费的。话虽如此,即使在基于 arm64 的 Windows 11 上,它也运行得非常好。
I found Free Virtual Serial Ports to work well for my non-commercial use-case. It isn't free for other use-cases. Having said that - it worked really well, even on an arm64 based Windows 11.
我使用 eltima 为我的 modbus 应用程序调试工作制作虚拟串行端口。在开发阶段无需连接硬件即可检查串口程序,确实是一个非常好的应用。
i used eltima make virtual serial port for my modbus application debug work. it is really very good application at development stage to check serial port program without connecting hardware.