获取串口连接的设备名称 [英] Get the device name connected to the serial port

查看:19
本文介绍了获取串口连接的设备名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索如何获取串口连接的素材的设备名称.

I search how to get the device name of the material connected to the serial port.

我有两种不同类型的材料可以连接在上面.

I've two different types of material that can connect on it.

第一个:打印机(只接收数据不发回)第二个:余额(只发送数据,不接收)

First one : a printer (only receives data and send nothing back) Second one : a balance (only send data and receives nothing)

如何区分这两种材料?

谢谢.

推荐答案

没有通用的识别串口(UART RS232)设备的方法.

There is no univeral way of identifying serial port (UART RS232) devices.

除非设备有特殊的命令,您可以发送到设备并让它响应识别信息,否则您无能为力.

Unless the devices have special commands that you can send to the device and have it respond with identifying information there is not much you can do.

通常依赖于串行端口的应用程序将有一个标准设置屏幕,用户将使用该屏幕来配置设备所连接的串行端口、波特率、奇偶校验位、停止位和数据位等端口配置.如果可以在同一个端口上切换多个设备,则操作员将负责在与设备通信之前为目标设备选择正确的配置.

Typically application that rely on the serial port will have a standard setting screen that the user would use to configure the serial port the device is connected to, port configuration for things like baud rate, parity bits, stop bits and data bits. If mutiple devices can be switched on the same port, the operator would then be responsible for selecting the correct configuration for the target device before communicating with the device.

这是 USB 等新技术的优势,其中设备标识内置于标准中.

This is the advantage of newer technologies like USB etc. where device identification is built into the standard.

这篇关于获取串口连接的设备名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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