串行端口重定向或拆分 [英] Serial Port Redirection or Splitting

查看:184
本文介绍了串行端口重定向或拆分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在找一本书,或怎么办串行端口重定向或端口分裂一个code样品。我写了很多的COM端口的应用程序和想写一个监视器应用程序,让我看的应用和设备之间的串行端口。

I am looking for a book and or a code sample of how to do serial port redirection or port splitting. I write a lot of com port applications and want to write a monitor application that will allow me to watch the serial port between the application and the device.

所以,我希望能够到串行端口重定向到另一个端口,所以我可以监控数据端口之间流动。

So I want to be able to redirect the serial port to another port so I can monitor the data flowing between ports.

我在某些情况下,这必须在内核级别来完成明白。 (在USB的情况下)

I understand in some cases this must be accomplished at the kernel level. (in USB cases)

我已经写了使用system.IO.Ports C#中的监视器应用程序。如果我有打电话给一个C ++ / C组件,它是好的。

I have written the monitor application using system.IO.Ports in C#. If I have to call a C++/C assembly that is fine.

感谢

推荐答案

您可能会发现的 PortMon 通过标记Russinovich是在你的工作有帮助的,虽然它不提供源$ C ​​$ C。它会记录相关的端口的所有系统调用,并拥有丰富的过滤功能,以该日志保持在可管理的大小。

You might find that PortMon by Mark Russinovich is helpful in your work, although it isn't provided with source code. It will log all system calls related to a port, and has extensive filtering capabilities to keep that log to a manageable size.

编辑: PortMon的工作原理是注射的内核模式设备驱动程序在系统运行时。该驱动程序挂钩,它希望通过插入过滤器驱动程序进栈到监控端口。该过滤器驱动程序报告通过它传递给应用程序的所有的IRP。这是不以任何拉伸来实现一个简单的野兽,它真的不能在用户模式下完成。

PortMon works by injecting a kernel mode device driver into the system when it runs. That driver hooks the ports that it wants to monitor by inserting a filter driver into the stack. That filter driver reports all IRPs that pass through it to the application. This is not an easy beast to implement by any stretch, and it really can't be done in user mode.

Windows DDK中确实有样品code为端口过滤器驱动程序,但它是一个大量的工作,从样品到一些有用的东西。

The Windows DDK does have sample code for a port filter driver, but it is a lot of work to go from the sample to something useful.

这可能会制定出一个纯用户模式的解决方案是使用两个额外的串行端口窃听电线。一对USB转串口适配器和一个位布线会做你的需要。然后,它仅仅是一个编程的小事,以监测和关联发送和接收线路。单芯片解决方案可以基于从FTDI 的 FT2232H设备,其中有一个可用的评估模块。添加一对夫妇的RS232电平转换器和一些D型连接器,你已经有了USB串行窃听者,看起来像两个COM端口到Windows。

A pure user mode solution that might work out is to use two additional serial ports to eavesdrop on the wire. A pair of USB to serial adapters and a bit of wiring will do what you need. Then it is only a "small matter of programming" to monitor and correlate the send and receive lines. A single chip solution could be based on the FT2232H device from FTDI, which has an available evaluation module. Add a couple of RS232 level translators and some D connectors and you've got a serial eavesdropper on USB that looks like two COM ports to Windows.

另一个盒子的方法外,是许多逻辑分析仪和混合信号示波器可以做串行协议解码,往往作为任意成分。廉价的USB +软件解决方案的一个来源是 Saelig 。我从他们那里买过芯片和模块自己,但没有任何直接的经验与任何尽管认为我应该有我的包一个具有上网本以及他们销售的基于USB的逻辑分析仪...

Another outside the box approach is that many logic analyzers and mixed signal oscilloscopes can do serial protocol decoding, often as an optional component. One source of inexpensive USB+software solutions is Saelig. I've bought chips and modules from them myself, but don't have any direct experience with any of the USB-based logic analyzers they sell despite thinking that I should have one in my bag along with the Netbook...

这篇关于串行端口重定向或拆分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆