WO2017193898A1 - 一种基于Linux或Unix内核操作系统的串口映射方法及装置 - Google Patents

一种基于Linux或Unix内核操作系统的串口映射方法及装置 Download PDF

Info

Publication number
WO2017193898A1
WO2017193898A1 PCT/CN2017/083531 CN2017083531W WO2017193898A1 WO 2017193898 A1 WO2017193898 A1 WO 2017193898A1 CN 2017083531 W CN2017083531 W CN 2017083531W WO 2017193898 A1 WO2017193898 A1 WO 2017193898A1
Authority
WO
WIPO (PCT)
Prior art keywords
serial port
list
pointer
logical
physical
Prior art date
Application number
PCT/CN2017/083531
Other languages
English (en)
French (fr)
Inventor
熊飞
吴胜楠
陈明宇
张雲瑞
罗忠明
梁建明
Original Assignee
广州广电运通金融电子股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州广电运通金融电子股份有限公司 filed Critical 广州广电运通金融电子股份有限公司
Publication of WO2017193898A1 publication Critical patent/WO2017193898A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • G06F13/102Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus

Definitions

  • the invention relates to the field of serial port identification, in particular to a serial port mapping method and device based on a Linux or Unix kernel operating system.
  • Linux system is a multi-user, multi-tasking, multi-threaded and multi-CPU operating system based on POSIX and UNIX. It can run major UNIX tools, applications and network protocols, inheriting Unix's network-centric design ideas. Is a stable multi-user network operating system. When accessing an external device in a Linux system, communication through the serial port is required. However, the sequence of the logical serial port under the Linux system may be inconsistent with the order of the physical serial port of the panel, resulting in failure to communicate normally.
  • the existing solution is mainly to use manual matching.
  • one method is to fixedly connect a hardware device to a physical serial port on a panel, and then exhaustively identify each serial port according to the characteristics of the communication device specific to the hardware device in the application software; another method is in the application software. Fixedly opening the port link of a serial port and manually switching each physical serial port to find the corresponding physical serial port.
  • the manual matching method is prone to inefficiency and high error rate due to the need for human participation, and additional cost is required due to the need for fixed hardware devices and specific identification assistance software.
  • the object of the present invention is to provide a serial port mapping method, device and terminal, which can realize automatic mapping between a physical serial port and a logical serial port.
  • the invention provides a serial port mapping method, which comprises the following steps:
  • BIOS basic input/output system
  • the mapped serial port is obtained according to the serial port mapping file and the physical serial port currently accessed by the external device, and communicates with the external device according to a program corresponding to the logical serial port.
  • the obtaining, by the basic input/output system, the first serial port list is: obtaining a first serial port list from the basic input output system by calling an interrupt instruction at the user layer; the serial port information includes a transceiver type, an interrupt number, and a port. address.
  • the physical serial port of the first serial port list and the logical serial port in the second serial port list are matched according to the serial port information, and the serial port mapping file of the first serial port list and the second serial port list is generated. Specifically, including:
  • mapping between the physical serial port and the logical serial port is recorded, and it is determined whether the physical serial port currently pointed by the first pointer is located at the end of the list of the first serial port list;
  • the serial port mapping file of the first serial port list and the second serial port list is generated according to all the recorded mapping relationships.
  • the determining whether the physical serial port matches the logical serial port according to the serial port information of the physical serial port that the first pointer is currently pointing to and the serial port information of the logical serial port that the second pointer is currently pointing to include:
  • the method further comprises:
  • the invention also provides a serial port mapping device based on a Linux or Unix kernel operating system, comprising:
  • a first list obtaining unit configured to acquire a first serial port list from the basic input/output system; wherein the first serial port The list stores serial port information of at least one physical serial port of the panel;
  • a second list obtaining unit configured to obtain a second serial port list from an operating system based on a Linux or Unix kernel; wherein the second serial port list stores serial port information of at least one logical serial port of the operating system;
  • the matching unit is configured to match the physical serial port of the first serial port list and the logical serial port in the second serial port list according to the serial port information, and generate a serial port mapping file of the first serial port list and the second serial port list.
  • the operating system obtains the mapped logical serial port according to the serial port mapping file and the physical serial port currently accessed by the external device, and according to the program corresponding to the logical serial port, when the operating system detects the access of the external device.
  • the external device communicates.
  • the first list obtaining unit is specifically configured to obtain a first serial port list from the basic input/output system by calling an interrupt instruction at the user layer;
  • the serial port information includes a transceiver type, an interrupt number, and a port address.
  • the matching unit specifically includes a first pointer module, a second pointer module, a serial port matching module, a pointer processing module, a mapping relationship recording module, and a mapping file generating module, where:
  • the first pointer module is configured to obtain serial port information of a physical serial port currently pointed by the first pointer configured for the first serial port list;
  • the second pointer module is configured to obtain serial port information of a logical serial port currently pointed by the second pointer configured for the second serial port list;
  • the serial port matching module is configured to determine, according to the serial port information of the physical serial port that the first pointer is currently pointing to, and the serial port information of the logical serial port that the second pointer is currently pointing to, whether the physical serial port matches the logical serial port; If not, notify the pointer processing module, and if yes, notify the mapping relationship record module;
  • the pointer processing module is configured to control the second pointer to move to the logical serial port currently located after determining that the logical serial port currently pointed by the second pointer is not located at the end of the list of the second serial port list Next logical serial port;
  • the mapping relationship recording module is configured to record a mapping relationship between the physical serial port and the logical serial port, and determine whether a physical serial port currently pointed by the first pointer is located at the end of the list of the first serial port list; if not, And notifying the pointer processing module, and if yes, notifying the mapping file generating module;
  • the pointer processing module is further configured to control the first pointer to move to a next physical serial port located after the physical serial port currently pointed, and delete the second pointer currently pointed in the second serial port list. After the logical serial port, the second pointer is controlled to point to the first logical serial port in the second serial port list;
  • the mapping file generating module is configured to generate a serial port mapping file of the first serial port list and the second serial port list according to the mapping relationship recorded by the mapping relationship recording module.
  • the serial port matching module specifically includes:
  • a first hash value calculation submodule configured according to the hash algorithm and a serial port of the physical serial port currently pointed by the first pointer The information generates a first hash value
  • a second hash value calculation submodule configured to generate a second hash value according to the hash algorithm and the serial port information of the logical serial port currently pointed by the second pointer;
  • the hash value matching submodule is configured to determine, according to the first hash value and the second hash value, whether the physical serial port matches the logical serial port.
  • the pointer processing module is further configured to: when determining that the logical serial port currently pointed by the second pointer is located at the end of the list of the second serial port list, controlling the first pointer to move to the current pointing The next physical serial port after the physical serial port, and controls the second pointer to point to the first logical serial port in the second serial port list.
  • the method and device for serial port mapping based on Linux or Unix kernel operating system provided by the invention, the physical serial port in the first serial port list obtained from the basic input/output system and the logical serial port in the second serial list obtained from the operating system Automatic matching is performed to automatically generate a serial port mapping file describing the mapping relationship between the physical serial port and the logical serial port without human intervention, thereby improving the efficiency and accuracy of the identification matching.
  • Automatic matching is performed to automatically generate a serial port mapping file describing the mapping relationship between the physical serial port and the logical serial port without human intervention, thereby improving the efficiency and accuracy of the identification matching.
  • special external equipment and auxiliary software are not required, the cost is also reduced.
  • FIG. 1 is a schematic flowchart of a serial port mapping method based on a Linux or Unix kernel operating system according to an embodiment of the present invention.
  • FIG. 2 is a data structure diagram of a first serial port list according to an embodiment of the present invention.
  • FIG. 3 is a data structure diagram of a second serial port list according to an embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of generating a serial port mapping file according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a serial port mapping apparatus based on a Linux or Unix kernel operating system according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of the first list unit shown in FIG. 5 acquiring a first serial port list.
  • FIG. 7 is a schematic structural view of the matching unit shown in FIG. 5.
  • FIG. 8 is a schematic structural diagram of the serial port matching module shown in FIG. 7.
  • the invention provides a serial port mapping method and device based on a Linux or Unix kernel operating system, which is used for automatically generating a mapping relationship between a physical serial port and a logical serial port, and realizing automatic identification and matching of the serial port, which are respectively described in detail below.
  • FIG. 1 is a schematic flowchart of a serial port mapping method based on a Linux or Unix kernel operating system according to an embodiment of the present invention.
  • the serial port mapping method may be performed by a serial port mapping device (hereinafter referred to as a serial port mapping device) based on a Linux or Unix kernel operating system, and includes at least the following steps:
  • the first serial port list stores serial port information of at least one physical serial port of the panel.
  • the serial port mapping device may send an interrupt instruction to the basic input/output system (Basic Input Output System) by calling an interrupt instruction at the user layer.
  • the BIOS After receiving the interrupt instruction, the BIOS returns a first serial port list to the serial port mapping device, wherein all physical serial ports and each physical of the panel are sequentially stored in the first serial port list.
  • Serial port serial port information the serial port information of the physical serial port may include a transceiver type, an interrupt number, and a port address.
  • S102 Obtain a second serial port list from an operating system based on a Linux or Unix kernel.
  • the second serial port list stores serial port information of at least one logical serial port of the operating system.
  • the serial port mapping device inputs a specific instruction to read a second serial port list in a user layer of an operating system, where the second serial port list stores the The serial port information of all logical serial ports of the operating system.
  • the serial port information of the logical serial port may include a transceiver type, an interrupt number, and a port address.
  • the operating system may be a Linux system, and generally, the specific instruction may be /proe/tty/driver/serial.
  • the operating system may also be other operating systems, such as a UNIX system, and the specific instructions may also be specified according to actual system configurations, which are not specifically limited by the present invention. .
  • the serial port mapping device after obtaining the first serial port list and the second serial port list, performs logic on the physical serial port of the first serial port list and the second serial port list according to the serial port information.
  • the serial port performs matching, and generates a serial port mapping file of the first serial port list and the second serial port list according to the matched result.
  • S1031 Obtain serial port information of a physical serial port currently pointed by the first pointer configured for the first serial port list.
  • the serial port mapping device may define a first pointer, where the first pointer is used to point to a physical serial port in the first serial port list, and may move in the first serial port list.
  • the serial port mapping device obtains the serial port information of the physical serial port when the first pointer points to a physical serial port.
  • S1032 Obtain serial port information of a logical serial port currently pointed by the second pointer configured for the second serial port list.
  • the serial port mapping device may further define a second pointer, where the second pointer is used to point to a logical serial port in the second serial port list, and may be in the second serial port.
  • the serial port mapping device moves to obtain a serial port information of the logical serial port when the second pointer points to a logical serial port.
  • S1033 Determine, according to the serial port information of the physical serial port that the first pointer is currently pointing to, and the serial port information of the logical serial port that the second pointer is currently pointing to, whether the physical serial port matches the logical serial port.
  • the serial port mapping device may determine whether the serial port information of the physical serial port currently pointed by the first pointer and the serial port information of the logical serial port currently pointed by the second pointer are consistent, for example, sequentially determining the physical serial port. Whether the transceiver type, the interrupt number, and the port address are consistent with the transceiver type, the interrupt number, and the port address of the logical serial port. If all of them are consistent, the physical serial port matches the logical serial port, and only one serial port information is provided. If the configurations are inconsistent, the physical serial port does not match the logical serial port.
  • a hash value may be first generated according to the hash algorithm and the serial port information, and then it is determined whether the hash value is consistent to determine whether the physical serial port matches the logical serial port, because the hash algorithm
  • the characteristics are only consistent when the transceiver type, interrupt number, and port address are identical. specifically:
  • the first hash value is generated according to the hash algorithm and the serial port information of the physical serial port currently pointed by the first pointer.
  • the serial port mapping device first determines whether the logical serial port currently pointed by the second pointer is located at the end of the list of the second serial port list ( When the second pointer moves backward by one step and points to NULL, it means that the end of the list of the second serial port list has been reached, and if so, the first pointer is controlled to move to the physical serial port currently located. After the next physical serial port, and control the office The second pointer points to the first logical serial port in the second serial port list. If not, the serial port mapping device controls the second pointer to move to the next logical serial port located after the logical serial port currently pointed.
  • the serial port mapping device records a mapping relationship between the physical serial port and the logical serial port, such as recording the serial number of the physical serial port and the The mapping relationship formed by the path of the logical serial port.
  • the mapping relationship can be recorded as: physical serial port 1 is mapped to /dev/COM1, which indicates that the physical serial port with serial number 1 on the panel matches the logical serial port of the operating system's /dev/COM1. .
  • the serial port mapping device further determines whether a physical serial port currently pointed by the first pointer is located at the end of the list of the first serial port list (when the first pointer When you move backward one step and then point to NULL, it means that you have reached the end of the list of the first serial port list).
  • the serial port mapping device determines that the physical serial port currently pointed by the first pointer is not located at the end of the list of the first serial port list, it indicates that the physical serial port is not in the first serial port list. After the matching, the serial port mapping device controls the first pointer to move to the next physical serial port located after the physical serial port currently pointed, and deletes the second pointer current in the second serial port list. After the logical serial port is pointed, the second pointer is controlled to point to the first logical serial port in the second serial port list.
  • the serial port mapping device determines that the physical serial port currently pointed by the first pointer is located at the end of the list of the first serial port list, it indicates that all physical serial ports in the first serial port list pass
  • the serial port mapping device generates a serial port mapping file of the first serial port list and the second serial port list according to all the recorded mapping relationships.
  • the serial port mapping file is a summary file of mapping relationship between all physical serial ports and logical serial ports.
  • the serial port mapping method provided by the embodiment of the present invention automatically matches the physical serial port in the first serial port list obtained from the BIOS and the logical serial port in the second serial list obtained from the operating system.
  • the serial port mapping file describing the mapping relationship between the physical serial port and the logical serial port is automatically generated without human intervention, and the efficiency and accuracy of the identification matching are improved.
  • special external equipment and auxiliary software are not required, the cost is also reduced.
  • serial port mapping device based on Linux or Unix kernel operating system will be described in detail below.
  • FIG. 5 is a schematic structural diagram of a serial port mapping apparatus based on a Linux or Unix kernel operating system according to an embodiment of the present invention.
  • the serial port mapping device 100 includes a first list obtaining unit 10, a second list obtaining unit 20, and a matching unit 30, where:
  • the first list obtaining unit 10 is configured to obtain a first serial port list from the basic input/output system, wherein the first serial port list stores serial port information of at least one physical serial port of the panel.
  • the first list obtaining unit 10 may send an interrupt instruction to the basic input/output system (Basic Input Output System) by calling an interrupt instruction at the user layer.
  • BIOS Basic Input Output System
  • the BIOS after receiving the interrupt instruction, the BIOS returns a first serial port list to the first list obtaining unit 10.
  • the serial port information includes a transceiver type, an interrupt number, and a port address.
  • the second list obtaining unit 20 is configured to obtain a second serial port list from an operating system based on a Linux or Unix kernel operating system; wherein the second serial port list stores serial port information of at least one logical serial port of the operating system .
  • the matching unit 30 is configured to match the physical serial port of the first serial port list and the logical serial port in the second serial port list according to the serial port information, to generate the first serial port list and the second serial port list.
  • the serial port maps the file, so that the operating system obtains the mapped logical serial port according to the serial port mapping file and the physical serial port currently accessed by the external device when detecting the access of the external device, and according to the program corresponding to the logical serial port. Communicate with the external device.
  • the matching unit 30 specifically includes a first pointer module 31 , a second pointer module 32 , a serial port matching module 33 , a pointer processing module 34 , a mapping relationship recording module 35 , and a mapping file generating module 36 . ,among them:
  • the first pointer module 31 is configured to obtain serial port information of a physical serial port currently pointed by the first pointer configured for the first serial port list.
  • the second pointer module 32 is configured to obtain serial port information of a logical serial port currently pointed by the second pointer configured for the second serial port list.
  • the serial port matching module 33 is configured to determine, according to the serial port information of the physical serial port that the first pointer is currently pointing to and the serial port information of the logical serial port that the second pointer is currently pointing, whether the physical serial port matches the logical serial port. If not, the pointer processing module 34 is notified, and if it matches, the mapping relationship recording module 35 is notified.
  • the pointer processing module 34 is configured to control the second pointer to move to the logical serial port currently located when determining that the logical serial port currently pointed by the second pointer is not located at the end of the list of the second serial port list After the next logical serial port.
  • the mapping relationship record module 35 is configured to record a mapping relationship between the physical serial port and the logical serial port, and determine Whether the physical serial port currently pointed by the first pointer is located at the end of the list of the first serial port list; if not, notifying the pointer processing module 34, and if so, notifying the mapping file generating module 36.
  • the pointer processing module 34 is further configured to control the first pointer to move to a next physical serial port located after the physical serial port currently pointed, and delete the current pointer of the second pointer in the second serial port list. After the logical serial port, the second pointer is controlled to point to the first logical serial port in the second serial port list.
  • the mapping file generating module 36 is configured to generate a serial port mapping file of the first serial port list and the second serial port list according to the mapping relationship recorded by the mapping relationship recording module.
  • the serial port matching module 33 specifically includes:
  • a first hash value calculation sub-module 331, configured to generate a first hash value according to the hash algorithm and the serial port information of the physical serial port currently pointed by the first pointer;
  • a second hash value calculation sub-module 332 configured to generate a second hash value according to the hash algorithm and the serial port information of the logical serial port currently pointed by the second pointer;
  • the hash value matching sub-module 333 is configured to determine, according to the first hash value and the second hash value, whether the physical serial port matches the logical serial port.
  • the hash value is generated by the serial port information, and the hash value is matched, which simplifies the matching process and improves the reliability of the matching.
  • the pointer processing module 34 is further configured to: when determining that the logical serial port currently pointed by the second pointer is located at the end of the list of the second serial port list, control the first pointer to move to the current pointing location The next physical serial port after the physical serial port, and controlling the second pointer to point to the first logical serial port in the second serial port list.
  • the matching unit 30 obtains the physical serial port and the second list in the first serial port list obtained by the first list obtaining unit 10 from the BIOS.
  • the unit 20 automatically matches the logical serial port in the second serial list obtained by the operating system, thereby automatically generating a serial port mapping file describing the mapping relationship between the physical serial port and the logical serial port without human intervention, thereby improving the efficiency of identifying and matching. And accuracy.
  • special external equipment and auxiliary software are not required, the cost is also reduced.
  • the embodiment of the present invention further provides a terminal, where the terminal has a BIOS and an operating system (such as a Linux system or a UNIX system), wherein the terminal further includes the serial port mapping device 100 described in any one of the foregoing embodiments.
  • the matching unit 30 obtains the physical serial port in the first serial port list obtained by the first list obtaining unit 10 from the BIOS and the second list obtaining unit 20 from the operating system.
  • the logical serial port in the second serial list is automatically matched, thereby automatically generating a serial port mapping file describing the mapping relationship between the physical serial port and the logical serial port without human intervention, thereby improving the efficiency and accuracy of the identification matching.
  • special external equipment and auxiliary software are not required, the cost is also reduced.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Systems (AREA)

Abstract

一种基于Linux或Unix内核操作系统的串口映射方法和装置,所述方法包括如下步骤:从基本输入输出系统(BIOS)获取第一串口列表;其中,所述第一串口列表存储了面板的至少一个物理串口的串口信息(S101);从操作系统获取第二串口列表;其中,所述第二串口列表存储了所述操作系统的至少一个逻辑串口的串口信息(S102);根据所述串口信息对所述第一串口列表的物理串口和第二串口列表中的逻辑串口进行匹配,生成所述第一串口列表与所述第二串口列表的串口映射文件(S103)。该方法和装置可在不需要人为干涉的情况下自动生成描述物理串口与逻辑串口映射关系的串口映射文件,提高了识别匹配的效率和准确率。

Description

一种基于Linux或Unix内核操作系统的串口映射方法及装置 技术领域
本发明涉及串口识别领域,尤其涉及一种基于Linux或Unix内核操作系统的串口映射方法及装置。
背景技术
Linux系统是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统,它能运行主要的UNIX工具软件、应用程序和网络协议,继承了Unix以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。在Linux系统下接入外部设备时,需要通过串口进行通信,然而Linux系统下的逻辑串口的顺序可能与面板的物理串口的顺序可能不一致,导致无法正常通信。
现有的解决方案主要是利用人工进行匹配。例如,一种方法是将硬件设备固定接入到面板上的某个物理串口,然后在应用软件中根据硬件设备特有的通信指令特性穷举每个串口进行识别;另一种方法是在应用软件固定打开某个串口的端口链接,通过人为方式切换每个物理串口,从而找到对应的物理串口。但人工匹配的方法由于需要人为的参与,容易导致效率低下、错误率高的问题,且由于需要固定的硬件设备和特定的识别辅助软件的支持,也会额外增加成本。
发明内容
针对上述问题,本发明的目的在于提供一种串口映射方法、装置及终端,可实现物理串口与逻辑串口的自动映射。
本发明提供了一种串口映射方法,包括如下步骤:
从基本输入输出系统(BIOS)获取第一串口列表;其中,所述第一串口列表存储了面板的至少一个物理串口的串口信息;
从基于Linux或Unix内核的操作系统获取第二串口列表;其中,所述第二串口列表存储了所述操作系统的至少一个逻辑串口的串口信息;
根据所述串口信息对所述第一串口列表的物理串口和第二串口列表中的逻辑串口进行匹配,生成所述第一串口列表与所述第二串口列表的串口映射文件,以使所述操作系统在检测 到外部设备接入时,根据所述串口映射文件及所述外部设备当前接入的物理串口获取映射的逻辑串口,并根据与所述逻辑串口对应的程序与所述外部设备进行通信。
优选地,所述从基本输入输出系统获取第一串口列表具体为:通过在用户层调用中断指令,从基本输入输出系统获取第一串口列表;所述串口信息包括收发器类型、中断号及端口地址。
优选地,所述根据所述串口信息对所述第一串口列表的物理串口和第二串口列表中的逻辑串口进行匹配,生成所述第一串口列表与所述第二串口列表的串口映射文件,具体包括:
获取为所述第一串口列表配置的第一指针当前指向的物理串口的串口信息;
获取为所述第二串口列表配置的第二指针当前指向的逻辑串口的串口信息;
根据所述第一指针当前指向的物理串口的串口信息及所述第二指针当前指向的逻辑串口的串口信息,判断所述物理串口与所述逻辑串口是否匹配;
若不匹配,则在确定所述第二指针当前指向的逻辑串口不位于所述第二串口列表的列表末尾时,控制所述第二指针移动到位于当前指向的所述逻辑串口之后的下一个逻辑串口;
若匹配,则记录所述物理串口与所述逻辑串口的映射关系,并判断所述第一指针当前指向的物理串口是否位于所述第一串口列表的列表末尾;
若否,则控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并在所述第二串口列表中删除所述第二指针当前指向的逻辑串口后,控制所述第二指针指向所述第二串口列表内的第一个逻辑串口;
若是,则根据所有已记录的映射关系,生成所述第一串口列表与所述第二串口列表的串口映射文件。
优选地,所述根据所述第一指针当前指向的物理串口的串口信息及所述第二指针当前指向的逻辑串口的串口信息,判断所述物理串口与所述逻辑串口是否匹配,具体包括:
根据哈希算法及所述第一指针当前指向的物理串口的串口信息生成第一哈希值;
根据哈希算法及所述第二指针当前指向的逻辑串口的串口信息生成第二哈希值;
根据所述第一哈希值及所述第二哈希值判断所述物理串口与所述逻辑串口是否匹配。
优选地,还包括:
在确定所述第二指针当前指向的逻辑串口位于所述第二串口列表的列表末尾时,控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并控制所述第二指针指向所述第二串口列表内的第一个逻辑串口。
本发明还提供一种基于Linux或Unix内核操作系统的串口映射装置,包括:
第一列表获取单元,用于从基本输入输出系统获取第一串口列表;其中,所述第一串口 列表存储了面板的至少一个物理串口的串口信息;
第二列表获取单元,用于从基于Linux或Unix内核的操作系统获取第二串口列表;其中,所述第二串口列表存储了所述操作系统的至少一个逻辑串口的串口信息;
匹配单元,用于根据所述串口信息对所述第一串口列表的物理串口和第二串口列表中的逻辑串口进行匹配,生成所述第一串口列表与所述第二串口列表的串口映射文件,以使所述操作系统在检测到外部设备接入时,根据所述串口映射文件及所述外部设备当前接入的物理串口获取映射的逻辑串口,并根据与所述逻辑串口对应的程序与所述外部设备进行通信。
优选地,所述第一列表获取单元具体用于,通过在用户层调用中断指令,从基本输入输出系统获取第一串口列表;所述串口信息包括收发器类型、中断号及端口地址。
优选地,所述匹配单元具体包括第一指针模块、第二指针模块、串口匹配模块,指针处理模块、映射关系记录模块及映射文件生成模块,其中:
所述第一指针模块,用于获取为所述第一串口列表配置的第一指针当前指向的物理串口的串口信息;
所述第二指针模块,用于获取为所述第二串口列表配置的第二指针当前指向的逻辑串口的串口信息;
所述串口匹配模块,用于根据所述第一指针当前指向的物理串口的串口信息及所述第二指针当前指向的逻辑串口的串口信息,判断所述物理串口与所述逻辑串口是否匹配;若不匹配,则通知所述指针处理模块,若匹配,则通知所述映射关系记录模块;
所述指针处理模块,用于在确定所述第二指针当前指向的逻辑串口不位于所述第二串口列表的列表末尾时,控制所述第二指针移动到位于当前指向的所述逻辑串口之后的下一个逻辑串口;
所述映射关系记录模块,用于记录所述物理串口与所述逻辑串口的映射关系,并判断所述第一指针当前指向的物理串口是否位于所述第一串口列表的列表末尾;若否,则通知所述指针处理模块,若是,则通知所述映射文件生成模块;
所述指针处理模块,还用于控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并在所述第二串口列表中删除所述第二指针当前指向的逻辑串口后,控制所述第二指针指向所述第二串口列表内的第一个逻辑串口;
所述映射文件生成模块,用于根据所述映射关系记录模块记录的映射关系,生成所述第一串口列表与所述第二串口列表的串口映射文件。
优选地,所述串口匹配模块具体包括:
第一哈希值计算子模块,用于根据哈希算法及所述第一指针当前指向的物理串口的串口 信息生成第一哈希值;
第二哈希值计算子模块,用于根据哈希算法及所述第二指针当前指向的逻辑串口的串口信息生成第二哈希值;
哈希值匹配子模块,用于根据所述第一哈希值及第二哈希值判断所述物理串口与所述逻辑串口是否匹配。
优选地,所述指针处理模块,还用于在确定所述第二指针当前指向的逻辑串口位于所述第二串口列表的列表末尾时,控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并控制所述第二指针指向所述第二串口列表内的第一个逻辑串口。
本发明提供的基于Linux或Unix内核操作系统的串口映射方法及装置,通过对从基本输入输出系统获取的第一串口列表内的物理串口和从操作系统下获取的第二串联列表内的逻辑串口进行自动匹配,从而在不需要人为干涉的情况下自动生成描述物理串口与逻辑串口映射关系的串口映射文件,提高了识别匹配的效率和准确率。此外,由于不需要专门的外部设备和辅助软件,还同时减低了成本。
附图说明
为了更清楚地说明本发明的技术方案,下面将对实施方式中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例提供的基于Linux或Unix内核操作系统的串口映射方法的流程示意图。
图2是本发明实施例提供的第一串口列表的数据结构图。
图3是本发明实施例提供的第二串口列表的数据结构图。
图4是本发明实施例提供的生成串口映射文件的流程示意图。
图5是本发明实施例提供的基于Linux或Unix内核操作系统的串口映射装置的结构示意图。
图6是图5所示的第一列表单元获取第一串口列表的示意图。
图7是图5所示的匹配单元的结构示意图。
图8是图7所示的串口匹配模块的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描 述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明提供了一种基于Linux或Unix内核操作系统的串口映射方法及装置,用于自动生成物理串口与逻辑串口的映射关系,实现串口的自动识别和匹配,以下分别进行详细描述。
请参阅图1,图1是本发明实施例提供的基于Linux或Unix内核操作系统的串口映射方法的流程示意图。所述串口映射方法可由基于Linux或Unix内核操作系统的串口映射装置(以下称为串口映射装置)来执行,并至少包括如下步骤:
S101,从基本输入输出系统(BIOS)获取第一串口列表;其中,所述第一串口列表存储了面板的至少一个物理串口的串口信息。
请一并参阅图2,具体的,在本发明实施例中,所述串口映射装置可通过在用户层调用中断指令,并将所述中断指令发送给所述基本输入输出系统(Basic Input Output System,BIOS),所述BIOS在接收到所述中断指令后,向所述串口映射装置返回第一串口列表,其中,所述第一串口列表内按顺序存储了面板的所有物理串口及每个物理串口的串口信息,所述物理串口的串口信息可包括收发器类型、中断号及端口地址。
S102,从基于Linux或Unix内核的操作系统获取第二串口列表;其中,所述第二串口列表存储了所述操作系统的至少一个逻辑串口的串口信息。
请一并参阅图3,具体地,在本发明实施例中,所述串口映射装置在操作系统的用户层输入特定指令读取第二串口列表,其中,所述第二串口列表存储了所述操作系统的所有逻辑串口的串口信息,同样的,所述逻辑串口的串口信息可包括收发器类型、中断号及端口地址。
在本发明实施例中,所述操作系统可为Linux系统,则一般地,所述特定指令可为/proe/tty/driver/serial。然而应当理解的是,在本发明的其他实施例中,所述操作系统还可为其他操作系统,如UNIX系统等,具体的指令也可根据实际的系统配置进行指定,本发明不做具体限定。
S103,根据所述串口信息对所述第一串口列表的物理串口和第二串口列表中的逻辑串口进行匹配,生成所述第一串口列表与所述第二串口列表的串口映射文件,以使所述操作系统在检测到外部设备接入时,根据所述串口映射文件及所述外部设备当前接入的物理串口获取映射的逻辑串口,并根据与所述逻辑串口对应的程序与所述外部设备进行通信。
在本发明实施例中,所述串口映射装置在获得所述第一串口列表和第二串口列表后,根据所述串口信息对所述第一串口列表的物理串口和第二串口列表中的逻辑串口进行匹配,并根据匹配的结果生成所述第一串口列表与所述第二串口列表的串口映射文件。
请一并参阅图4,具体地,可包括如下步骤:
S1031,获取为所述第一串口列表配置的第一指针当前指向的物理串口的串口信息。
在本发明实施例中,所述串口映射装置可定义一个第一指针,所述第一指针用于指向所述第一串口列表内的物理串口,并可在所述第一串口列表内移动,以指向不同的物理串口,其中,所述第一指针指向一个物理串口时,所述串口映射装置将获取该物理串口的串口信息。
S1032,获取为所述第二串口列表配置的第二指针当前指向的逻辑串口的串口信息。
在本发明实施例中,同样的,所述串口映射装置还可定义一个第二指针,所述第二指针用于指向所述第二串口列表内的逻辑串口,并可在所述第二串口列表内移动,以指向不同的逻辑串口,其中,所述第二指针指向一个逻辑串口时,所述串口映射装置将获取该逻辑串口的串口信息。
S1033,根据所述第一指针当前指向的物理串口的串口信息及所述第二指针当前指向的逻辑串口的串口信息,判断所述物理串口与所述逻辑串口是否匹配。
在一个实施例中,所述串口映射装置可判断第一指针当前指向的物理串口的串口信息及所述第二指针当前指向的逻辑串口的串口信息是否完成一致,例如,依次判断所述物理串口的收发器类型、中断号及端口地址是否与所述逻辑串口的收发器类型、中断号及端口地址一致,若全部一致,则所述物理串口与所述逻辑串口匹配,而只要有一个串口信息不一致,则所述物理串口与所述逻辑串口不匹配。
在另一个实施例中,也可先根据哈希算法和所述串口信息生成一个哈希值,再判断哈希值是否一致来判断所述物理串口与所述逻辑串口是否匹配,由于哈希算法的特性,只有当收发器类型、中断号及端口地址完全一致,得出的哈希值才一致。具体地:
首先,根据哈希算法及所述第一指针当前指向的物理串口的串口信息生成第一哈希值。
然后,根据哈希算法及所述第二指针当前指向的逻辑串口的串口信息生成第二哈希值。
最后,根据所述第一哈希值及所述第二哈希值判断所述物理串口与所述逻辑串口是否匹配。
如此,相比于直接对串口信息进行匹配,简化了匹配的过程,并提高了匹配的可靠性
S1034,若否,则在确定所述第二指针当前指向的逻辑串口不位于所述第二串口列表的列表末尾时,控制所述第二指针移动到位于当前指向的所述逻辑串口之后的下一个逻辑串口。
在本发明实施例中,若所述物理串口与所述逻辑串口不匹配,则所述串口映射装置先确定所述第二指针当前指向的逻辑串口是否位于所述第二串口列表的列表末尾(当所述第二指针向后移动一步后指向NULL时,则代表已经到了所述第二串口列表的列表末尾),如果是,则控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并控制所 述第二指针指向所述第二串口列表内的第一个逻辑串口。若否,则所述串口映射装置控制所述第二指针移动到位于当前指向的所述逻辑串口之后的下一个逻辑串口。
S1035,若是,则记录所述物理串口与所述逻辑串口的映射关系,并判断所述第一指针当前指向的物理串口是否位于所述第一串口列表的列表末尾。
在本发明实施例中,若所述物理串口与所述逻辑串口匹配,则所述串口映射装置记录所述物理串口与所述逻辑串口的映射关系,如记录所述物理串口的序号及所述逻辑串口的路径形成的映射关系,例如,映射关系可记录为:物理串口1映射为/dev/COM1,其表示面板上的序号为1的物理串口与操作系统的/dev/COM1的逻辑串口匹配。
在本发明实施例中,在记录所述映射关系后,所述串口映射装置还判断所述第一指针当前指向的物理串口是否位于所述第一串口列表的列表末尾(当所述第一指针向后移动一步后指向NULL时,则代表已经到了所述第一串口列表的列表末尾)。
S1036,若否,则控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并在所述第二串口列表中删除所述第二指针当前指向的逻辑串口后,控制所述第二指针指向所述第二串口列表内的第一个逻辑串口。
在本发明实施例中,若所述串口映射装置判断所述第一指针当前指向的物理串口不是位于所述第一串口列表的列表末尾,则说明所述第一串口列表内尚有物理串口未经过匹配,此时,所述串口映射装置控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并在所述第二串口列表中删除所述第二指针当前指向的逻辑串口后,控制所述第二指针指向所述第二串口列表内的第一个逻辑串口。
S1037,若是,则根据所有已记录的映射关系,生成所述第一串口列表与所述第二串口列表的串口映射文件。
在本发明实施例中,若所述串口映射装置判断所述第一指针当前指向的物理串口位于所述第一串口列表的列表末尾,则说明所述第一串口列表内的所有物理串口均经过匹配,此时,所述串口映射装置根据所有已记录的映射关系,生成所述第一串口列表与所述第二串口列表的串口映射文件。所述串口映射文件为所有物理串口与逻辑串口的映射关系的汇总文件,如此,当有外部设备接入面板上的物理串口时,即可根据所述串口映射文件找到对应的逻辑串口,再根据所述逻辑串口找到对应的程序来实现与所述外部设备进行通信。
综上所述,本发明实施例提供的串口映射方法,通过对从BIOS获取的第一串口列表内的物理串口和从操作系统下获取的第二串联列表内的逻辑串口进行自动匹配,从而在不需要人为干涉的情况下自动生成描述物理串口与逻辑串口映射关系的串口映射文件,提高了识别匹配的效率和准确率。此外,由于不需要专门的外部设备和辅助软件,还同时减低了成本。
下面将对上述提及的基于Linux或Unix内核操作系统的串口映射装置进行详细描述。
请参阅图5,图5是本发明实施例提供的基于Linux或Unix内核操作系统的串口映射装置的结构示意图。所述串口映射装置100包括第一列表获取单元10、第二列表获取单元20及匹配单元30,其中:
所述第一列表获取单元10,用于从基本输入输出系统获取第一串口列表;其中,所述第一串口列表存储了面板的至少一个物理串口的串口信息。
如图6所示,在本发明实施例中,所述第一列表获取单元10可通过在用户层调用中断指令,并将所述中断指令发送给所述基本输入输出系统(Basic Input Output System,BIOS),所述BIOS在接收到所述中断指令后,向所述第一列表获取单元10返回第一串口列表。
在本发明实施例中,所述串口信息包括收发器类型、中断号及端口地址。
所述第二列表获取单元20,用于从基于Linux或Unix内核操作系统的操作系统获取第二串口列表;其中,所述第二串口列表存储了所述操作系统的至少一个逻辑串口的串口信息。
所述匹配单元30,用于根据所述串口信息对所述第一串口列表的物理串口和第二串口列表中的逻辑串口进行匹配,生成所述第一串口列表与所述第二串口列表的串口映射文件,以使所述操作系统在检测到外部设备接入时,根据所述串口映射文件及外部设备当前接入的物理串口获取映射的逻辑串口,并根据与所述逻辑串口对应的程序与所述外部设备进行通信。
请一并参阅图7,具体地,所述匹配单元30具体包括第一指针模块31、第二指针模块32、串口匹配模块33,指针处理模块34、映射关系记录模块35及映射文件生成模块36,其中:
所述第一指针模块31,用于获取为所述第一串口列表配置的第一指针当前指向的物理串口的串口信息。
所述第二指针模块32,用于获取为所述第二串口列表配置的第二指针当前指向的逻辑串口的串口信息。
所述串口匹配模块33,用于根据所述第一指针当前指向的物理串口的串口信息及所述第二指针当前指向的逻辑串口的串口信息,判断所述物理串口与所述逻辑串口是否匹配;若不匹配,则通知所述指针处理模块34,若匹配,则通知所述映射关系记录模块35。
所述指针处理模块34,用于在确定所述第二指针当前指向的逻辑串口不位于所述第二串口列表的列表末尾时,控制所述第二指针移动到位于当前指向的所述逻辑串口之后的下一个逻辑串口。
所述映射关系记录模块35,用于记录所述物理串口与所述逻辑串口的映射关系,并判断 所述第一指针当前指向的物理串口是否位于所述第一串口列表的列表末尾;若否,则通知所述指针处理模块34,若是,则通知所述映射文件生成模块36。
所述指针处理模块34,还用于控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并在所述第二串口列表中删除所述第二指针当前指向的逻辑串口后,控制所述第二指针指向所述第二串口列表内的第一个逻辑串口。
所述映射文件生成模块36,用于根据所述映射关系记录模块记录的映射关系,生成所述第一串口列表与所述第二串口列表的串口映射文件。
请一并参阅图8,优选地,所述串口匹配模块33具体包括:
第一哈希值计算子模块331,用于根据哈希算法及所述第一指针当前指向的物理串口的串口信息生成第一哈希值;
第二哈希值计算子模块332,用于根据哈希算法及所述第二指针当前指向的逻辑串口的串口信息生成第二哈希值;
哈希值匹配子模块333,用于根据所述第一哈希值及第二哈希值判断所述物理串口与所述逻辑串口是否匹配。
本优选实施例中,通过串口信息生成哈希值,再对哈希值进行匹配,简化了匹配的过程,提高了匹配的可靠性。
优选地,所述指针处理模块34,还用于在确定所述第二指针当前指向的逻辑串口位于所述第二串口列表的列表末尾时,控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并控制所述第二指针指向所述第二串口列表内的第一个逻辑串口。
综上所述,本发明实施例提供的串口映射装置100,所述匹配单元30通过对所述第一列表获取单元10从BIOS获取的第一串口列表内的物理串口和所述第二列表获取单元20从操作系统下获取的第二串联列表内的逻辑串口进行自动匹配,从而在不需要人为干涉的情况下自动生成描述物理串口与逻辑串口映射关系的串口映射文件,提高了识别匹配的效率和准确率。此外,由于不需要专门的外部设备和辅助软件,还同时减低了成本。
本发明实施例还提供一种终端,所述终端具有BIOS和操作系统(如Linux系统或UNIX系统),其中,所述终端还包括上述任一实施例所述的串口映射装置100。
本发明实施例提供的终端,所述匹配单元30通过对所述第一列表获取单元10从BIOS获取的第一串口列表内的物理串口和所述第二列表获取单元20从操作系统下获取的第二串联列表内的逻辑串口进行自动匹配,从而在不需要人为干涉的情况下自动生成描述物理串口与逻辑串口映射关系的串口映射文件,提高了识别匹配的效率和准确率。此外,由于不需要专门的外部设备和辅助软件,还同时减低了成本。
以上所揭露的仅为本发明一种较佳实施例而已,当然不能以此来限定本发明之权利范围,本领域普通技术人员可以理解实现上述实施例的全部或部分流程,并依本发明权利要求所作的等同变化,仍属于发明所涵盖的范围。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可获取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。

Claims (10)

  1. 一种基于Linux或Unix内核操作系统的串口映射方法,其特征在于,包括如下步骤:
    从基本输入输出系统(BIOS)获取第一串口列表;其中,所述第一串口列表存储了面板的至少一个物理串口的串口信息;
    从基于Linux或Unix内核的操作系统获取第二串口列表;其中,所述第二串口列表存储了所述操作系统的至少一个逻辑串口的串口信息;
    根据所述串口信息对所述第一串口列表的物理串口和第二串口列表中的逻辑串口进行匹配,生成所述第一串口列表与所述第二串口列表的串口映射文件,以使所述操作系统在检测到外部设备接入时,根据所述串口映射文件及所述外部设备当前接入的物理串口获取映射的逻辑串口,并根据与所述逻辑串口对应的程序与所述外部设备进行通信。
  2. 根据权利要求1所述的串口映射方法,其特征在于,所述从基本输入输出系统获取第一串口列表具体为:通过在用户层调用中断指令,从基本输入输出系统获取第一串口列表;所述串口信息包括收发器类型、中断号及端口地址。
  3. 根据权利要求1或2所述的串口映射方法,其特征在于,所述根据所述串口信息对所述第一串口列表的物理串口和第二串口列表中的逻辑串口进行匹配,生成所述第一串口列表与所述第二串口列表的串口映射文件,具体包括:
    获取为所述第一串口列表配置的第一指针当前指向的物理串口的串口信息;
    获取为所述第二串口列表配置的第二指针当前指向的逻辑串口的串口信息;
    根据所述第一指针当前指向的物理串口的串口信息及所述第二指针当前指向的逻辑串口的串口信息,判断所述物理串口与所述逻辑串口是否匹配;
    若不匹配,则在确定所述第二指针当前指向的逻辑串口不位于所述第二串口列表的列表末尾时,控制所述第二指针移动到位于当前指向的所述逻辑串口之后的下一个逻辑串口;
    若匹配,则记录所述物理串口与所述逻辑串口的映射关系,并判断所述第一指针当前指向的物理串口是否位于所述第一串口列表的列表末尾;
    若否,则控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并在所述第二串口列表中删除所述第二指针当前指向的逻辑串口后,控制所述第二指针指向所述第二串口列表内的第一个逻辑串口;
    若是,则根据所有已记录的映射关系,生成所述第一串口列表与所述第二串口列表的串 口映射文件。
  4. 根据权利要求3所述的串口映射方法,其特征在于,所述根据所述第一指针当前指向的物理串口的串口信息及所述第二指针当前指向的逻辑串口的串口信息,判断所述物理串口与所述逻辑串口是否匹配,具体包括:
    根据哈希算法及所述第一指针当前指向的物理串口的串口信息生成第一哈希值;
    根据哈希算法及所述第二指针当前指向的逻辑串口的串口信息生成第二哈希值;
    根据所述第一哈希值及所述第二哈希值判断所述物理串口与所述逻辑串口是否匹配。
  5. 根据权利要求3所述的串口映射方法,其特征在于,还包括:
    在确定所述第二指针当前指向的逻辑串口位于所述第二串口列表的列表末尾时,控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并控制所述第二指针指向所述第二串口列表内的第一个逻辑串口。
  6. 一种基于Linux或Unix内核操作系统的串口映射装置,其特征在于,包括:
    第一列表获取单元,用于从基本输入输出系统获取第一串口列表;其中,所述第一串口列表存储了面板的至少一个物理串口的串口信息;
    第二列表获取单元,用于从基于Linux或Unix内核的操作系统获取第二串口列表;其中,所述第二串口列表存储了所述操作系统的至少一个逻辑串口的串口信息;
    匹配单元,用于根据所述串口信息对所述第一串口列表的物理串口和第二串口列表中的逻辑串口进行匹配,生成所述第一串口列表与所述第二串口列表的串口映射文件,以使所述操作系统在检测到外部设备接入时,根据所述串口映射文件及所述外部设备当前接入的物理串口获取映射的逻辑串口,并根据与所述逻辑串口对应的程序与所述外部设备进行通信。
  7. 根据权利要求6所述的串口映射装置,其特征在于,所述第一列表获取单元具体用于,通过在用户层调用中断指令,从基本输入输出系统获取第一串口列表;所述串口信息包括收发器类型、中断号及端口地址。
  8. 根据权利要求6或7所述的串口映射装置,其特征在于,所述匹配单元具体包括第一指针模块、第二指针模块、串口匹配模块,指针处理模块、映射关系记录模块及映射文件生成模块,其中:
    所述第一指针模块,用于获取为所述第一串口列表配置的第一指针当前指向的物理串口 的串口信息;
    所述第二指针模块,用于获取为所述第二串口列表配置的第二指针当前指向的逻辑串口的串口信息;
    所述串口匹配模块,用于根据所述第一指针当前指向的物理串口的串口信息及所述第二指针当前指向的逻辑串口的串口信息,判断所述物理串口与所述逻辑串口是否匹配;若不匹配,则通知所述指针处理模块,若匹配,则通知所述映射关系记录模块;
    所述指针处理模块,用于在确定所述第二指针当前指向的逻辑串口不位于所述第二串口列表的列表末尾时,控制所述第二指针移动到位于当前指向的所述逻辑串口之后的下一个逻辑串口;
    所述映射关系记录模块,用于记录所述物理串口与所述逻辑串口的映射关系,并判断所述第一指针当前指向的物理串口是否位于所述第一串口列表的列表末尾;若否,则通知所述指针处理模块,若是,则通知所述映射文件生成模块;
    所述指针处理模块,还用于控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并在所述第二串口列表中删除所述第二指针当前指向的逻辑串口后,控制所述第二指针指向所述第二串口列表内的第一个逻辑串口;
    所述映射文件生成模块,用于根据所述映射关系记录模块记录的映射关系,生成所述第一串口列表与所述第二串口列表的串口映射文件。
  9. 根据权利要求8所述的串口映射装置,其特征在于,所述串口匹配模块具体包括:
    第一哈希值计算子模块,用于根据哈希算法及所述第一指针当前指向的物理串口的串口信息生成第一哈希值;
    第二哈希值计算子模块,用于根据哈希算法及所述第二指针当前指向的逻辑串口的串口信息生成第二哈希值;
    哈希值匹配子模块,用于根据所述第一哈希值及第二哈希值判断所述物理串口与所述逻辑串口是否匹配。
  10. 根据权利要求8所述的串口映射装置,其特征在于,所述指针处理模块,还用于在确定所述第二指针当前指向的逻辑串口位于所述第二串口列表的列表末尾时,控制所述第一指针移动到位于当前指向的所述物理串口之后的下一个物理串口,并控制所述第二指针指向所述第二串口列表内的第一个逻辑串口。
PCT/CN2017/083531 2016-05-09 2017-05-09 一种基于Linux或Unix内核操作系统的串口映射方法及装置 WO2017193898A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610304975.2 2016-05-09
CN201610304975.2A CN106021136B (zh) 2016-05-09 2016-05-09 一种基于Linux或Unix内核操作系统的串口映射方法及装置

Publications (1)

Publication Number Publication Date
WO2017193898A1 true WO2017193898A1 (zh) 2017-11-16

Family

ID=57098958

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/083531 WO2017193898A1 (zh) 2016-05-09 2017-05-09 一种基于Linux或Unix内核操作系统的串口映射方法及装置

Country Status (2)

Country Link
CN (1) CN106021136B (zh)
WO (1) WO2017193898A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256513A (zh) * 2020-10-29 2021-01-22 成都菁蓉联创科技有限公司 一种调试串口和数据串口复用的方法、装置和控制器
CN113347025A (zh) * 2021-05-20 2021-09-03 上海上讯信息技术股份有限公司 一种用于运维串口设备的方法与设备
CN113740781A (zh) * 2021-08-30 2021-12-03 广州文远知行科技有限公司 一种接口松动检测方法、装置、交通工具及存储介质
CN116483751A (zh) * 2023-04-06 2023-07-25 河南翔宇医疗设备股份有限公司 一种串口号识别方法、装置及介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106021136B (zh) * 2016-05-09 2019-01-01 广州广电运通金融电子股份有限公司 一种基于Linux或Unix内核操作系统的串口映射方法及装置
CN109634884A (zh) * 2018-10-19 2019-04-16 珠海格力电器股份有限公司 通讯端口连接方法和装置
CN114201442A (zh) * 2021-12-14 2022-03-18 广州通则康威智能科技有限公司 串口远程双向通信方法、装置、计算机设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102314372A (zh) * 2010-05-25 2012-01-11 微软公司 虚拟机i/o多路径配置
CN103150190A (zh) * 2013-03-26 2013-06-12 汉柏科技有限公司 Linux系统下用户态网卡自动探测及驱动加载的方法
CN103793651A (zh) * 2014-02-22 2014-05-14 西安电子科技大学 基于Xen虚拟化的内核完整性检测方法
CN103853683A (zh) * 2014-03-07 2014-06-11 山东超越数控电子有限公司 一种多串口数据通讯实现方法
CN106021136A (zh) * 2016-05-09 2016-10-12 广州广电运通金融电子股份有限公司 一种基于Linux或Unix内核操作系统的串口映射方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7974202B2 (en) * 2005-05-06 2011-07-05 Corrigent Systems, Ltd. Tunnel provisioning with link aggregation
CN103049401B (zh) * 2011-10-17 2018-02-06 康佳集团股份有限公司 一种控制外围串口设备的方法、系统及控制设备
CN103294630B (zh) * 2013-05-07 2015-11-04 福建鑫诺通讯技术有限公司 一种嵌入式linux系统中实现串口多路复用的方法
CN103414597A (zh) * 2013-08-30 2013-11-27 上海寰创通信科技股份有限公司 一种逻辑端口的状态更新系统和方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102314372A (zh) * 2010-05-25 2012-01-11 微软公司 虚拟机i/o多路径配置
CN103150190A (zh) * 2013-03-26 2013-06-12 汉柏科技有限公司 Linux系统下用户态网卡自动探测及驱动加载的方法
CN103793651A (zh) * 2014-02-22 2014-05-14 西安电子科技大学 基于Xen虚拟化的内核完整性检测方法
CN103853683A (zh) * 2014-03-07 2014-06-11 山东超越数控电子有限公司 一种多串口数据通讯实现方法
CN106021136A (zh) * 2016-05-09 2016-10-12 广州广电运通金融电子股份有限公司 一种基于Linux或Unix内核操作系统的串口映射方法及装置

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256513A (zh) * 2020-10-29 2021-01-22 成都菁蓉联创科技有限公司 一种调试串口和数据串口复用的方法、装置和控制器
CN112256513B (zh) * 2020-10-29 2023-10-20 成都菁蓉联创科技有限公司 一种调试串口和数据串口复用的方法、装置和控制器
CN113347025A (zh) * 2021-05-20 2021-09-03 上海上讯信息技术股份有限公司 一种用于运维串口设备的方法与设备
CN113740781A (zh) * 2021-08-30 2021-12-03 广州文远知行科技有限公司 一种接口松动检测方法、装置、交通工具及存储介质
CN113740781B (zh) * 2021-08-30 2022-05-24 广州文远知行科技有限公司 一种接口松动检测方法、装置、交通工具及存储介质
CN116483751A (zh) * 2023-04-06 2023-07-25 河南翔宇医疗设备股份有限公司 一种串口号识别方法、装置及介质

Also Published As

Publication number Publication date
CN106021136A (zh) 2016-10-12
CN106021136B (zh) 2019-01-01

Similar Documents

Publication Publication Date Title
WO2017193898A1 (zh) 一种基于Linux或Unix内核操作系统的串口映射方法及装置
US10656909B2 (en) Learning intended user actions
WO2018126935A1 (zh) 基于语音的交互方法、装置、电子设备及操作系统
EP3646320B1 (en) Secure utterance storage
US11265414B2 (en) Method and device for waking up voice recognition function in mobile terminal, and computer readable storage medium
US10902039B2 (en) Automatic identification of retraining data in a classifier-based dialogue system
US10831799B2 (en) External action execution with conversational agent
JP2019169126A (ja) 人工知能に基づく三元組チェック方法、装置及びコンピュータプログラム
EP4345645A1 (en) User question labeling method and device
WO2019232980A1 (zh) 节点配置方法及装置、计算机可读存储介质和电子设备
WO2021259232A1 (zh) Ai芯片的数据处理方法、装置和计算机设备
CN116306396A (zh) 芯片验证方法及装置、设备和介质
US11222225B2 (en) Image recognition combined with personal assistants for item recovery
CN109684103A (zh) 一种接口调用方法、装置、服务器及存储介质
US9965447B2 (en) Efficient handling of bi-directional data
US10664663B2 (en) Natural language processing system
CN110874176B (zh) 交互方法、存储介质、操作系统和设备
US10620718B2 (en) Device selection in three-dimensional environments
CN109241164A (zh) 一种数据处理方法、装置、服务器及存储介质
US11677832B2 (en) Voice activated device enabling
WO2022078189A1 (zh) 一种支持动态意图的控制方法、装置及存储介质
US11178216B2 (en) Generating client applications from service model descriptions
CN109298956A (zh) 文件传输方法、装置及终端设备
CN109815469A (zh) 一种文字编辑方法、装置、介质和电子设备
CN111897774B (zh) 一种文件上传方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17795516

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17795516

Country of ref document: EP

Kind code of ref document: A1