A method, system, device and medium for bidirectional communication based on interface switching

CN120763099BActive Publication Date: 2026-08-11GUANGZHOU LANGO ELECTRONICS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-21
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0003]现有技术中,若想实现外部设备与一体机的双向通信,需要依赖专业技术人员手动切换所述OPS盒子的接口的接口模式,而在切换的过程中,由于技术人员需严格执行“断开PC连接→物理切换跳线帽→重启OPS模块→重建USB驱动栈”的四步法操作来进行OPS的切换,导致双向通信的效率低下,且人工插拔HDMI/USB线缆可能导致ESD(静电放电)事件,影响双向通信过程中信号的完整性,导致双向通信的效果不佳

Benefits of technology

[0042]所述双向通信模块用于识别所述OPS终端获取的信号的类型,以根据所述第一通信通道或所述第二通信通道将所述信号发送至所述信号输入终端或所述外部设备。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120763099B_ABST
    Figure CN120763099B_ABST
Patent Text Reader

Abstract

This invention discloses a bidirectional communication method, system, device, and medium based on interface switching, applied to an all-in-one device integrating an OPS terminal and a signal input terminal. The USB interface of the signal input terminal and the USB interface of the OPS terminal are electrically connected to the motherboard of the all-in-one device. The OTG interface of the OPS terminal is electrically connected to the communication interface of an external device. The bidirectional communication method includes: when an external device is detected connected to the OPS terminal, establishing a first communication channel connecting the signal input terminal to the OPS terminal; obtaining the device type of the external device and switching the interface mode of the OTG interface according to the device type; simulating the OPS terminal as a USB device according to the interface mode to establish a second communication channel connecting the OPS terminal and the external device; identifying the type of signal acquired by the OPS terminal, and sending the signal to the signal input terminal or the external device according to the first or second communication channel, thereby realizing bidirectional communication between the all-in-one device and the external device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a bidirectional communication method, system, device and medium based on interface switching. Background Technology

[0002] In existing technologies, all-in-one devices often communicate with external devices by integrating an OPS box. However, existing OPS boxes often adopt a pure input interface design, thus only enabling unidirectional communication.

[0003] In existing technologies, to achieve bidirectional communication between external devices and the all-in-one machine, it is necessary for professional technicians to manually switch the interface mode of the OPS box. During the switching process, technicians must strictly follow a four-step operation of "disconnecting the PC connection → physically switching the jumper cap → restarting the OPS module → rebuilding the USB driver stack" to switch the OPS, which results in low efficiency of bidirectional communication. In addition, manually plugging and unplugging HDMI / USB cables may cause ESD (electrostatic discharge) events, affecting the integrity of the signal during bidirectional communication and resulting in poor bidirectional communication performance. Summary of the Invention

[0004] To address the aforementioned technical problems, this invention provides a bidirectional communication method, system, device, and medium based on interface switching, which can improve the efficiency and accuracy of bidirectional communication.

[0005] To achieve the above objectives, in a first aspect, the present invention discloses a bidirectional communication method based on interface switching, characterized in that it is applied to an all-in-one device integrating an OPS terminal and a signal input terminal; wherein, the USB interface of the signal input terminal is electrically connected to the motherboard of the all-in-one device; the USB interface of the OPS terminal is electrically connected to the motherboard of the all-in-one device; the OTG interface of the OPS terminal is electrically connected to the communication interface of an external device, and the bidirectional communication method includes:

[0006] When the external device is detected to be connected to the OPS terminal, a first communication channel is established between the signal input terminal and the OPS terminal;

[0007] Obtain the device type of the external device, and switch the interface mode of the OTG interface according to the device type;

[0008] According to the interface mode, the OPS terminal is simulated as a USB device to build a second communication channel connecting the OPS terminal and the external device;

[0009] The type of signal acquired by the OPS terminal is identified, and the signal is sent to the signal input terminal or the external device according to the first communication channel or the second communication channel.

[0010] This invention discloses a bidirectional communication method based on interface switching. Through a hardware architecture integrating an OPS terminal and a signal input terminal, it achieves automated switching of bidirectional communication. When an external device connects, the construction of the first communication channel directly connects the signal input terminal and the OPS terminal, ensuring that the initial signal from the external device can be quickly transmitted to the all-in-one machine. By acquiring the external device type and dynamically switching the OTG interface mode, the interface working mode automatically matches the device characteristics, avoiding the manual judgment and physical switching operations required in traditional technologies. Based on the interface mode, the OPS terminal is simulated as a USB device, allowing the same physical interface to function as both a host and a slave, solving the key problem of role switching in bidirectional communication. Finally, dynamic allocation of data flow is achieved through signal type recognition. The first communication channel is used for external devices to send signals to the all-in-one machine, and the second communication channel is used for the all-in-one machine to send signals back to external devices, forming a closed-loop bidirectional communication link.

[0011] As a preferred example, the step of establishing a first communication channel between the signal input terminal and the OPS terminal when the external device is detected to be connected to the OPS terminal includes:

[0012] When a change in the voltage level of the OTG interface is detected, it is determined that the external device is connected to the OPS terminal;

[0013] The USB interface of the signal input terminal is switched to the OPS terminal by a USB multiplexer switch preset in the motherboard, so as to establish a first communication channel through the OPS terminal to send the signal of the external device to the signal input terminal.

[0014] In the above scheme, by monitoring changes in the physical characteristic of the OTG interface level as a trigger condition, the physical connection actions of external devices can be detected in real time, replacing the traditional method of relying on manual observation of device status and realizing automated detection of connection events. Interface switching is performed based on a preset USB multiplexer switch, utilizing the preset logic of the hardware circuit to achieve instant switching of signal channels. This avoids the time-consuming physical operation required for traditional jumper cap switching and ensures the stability of signal transmission through a fixed hardware switching path. The constructed first communication channel uses the OPS terminal as a relay node to directly transmit external device signals to the signal input terminal, forming a complete unidirectional transmission link and establishing a basic channel for subsequent bidirectional communication.

[0015] As a preferred example, before obtaining the device type of the external device, the process includes:

[0016] Perform a bus reset operation on the external device to reset the external device to its default state;

[0017] The device address of the external device is generated based on the default state.

[0018] In the above scheme, the synergy between bus reset and device address generation ensures the reliability of device identification. Performing a bus reset on an external device clears any abnormal or residual data from its original state, forcibly restoring it to its initial default state, thereby eliminating communication conflicts caused by incorrect device initialization. Generating a device address based on the reset default state establishes a unique device identifier, preventing address conflicts when multiple devices connect. By controlling the timing of resetting before address allocation, the consistency of device states is guaranteed, and a stable and reliable addressing foundation is provided for subsequent device type identification, thus improving the device compatibility and identification accuracy of the entire bidirectional communication system.

[0019] As a preferred example, obtaining the device type of the external device includes:

[0020] The device identification command is sent to the external device according to the device address, so as to obtain the device description information sent by the external device within a preset time period;

[0021] When the device description signal information is acquired within the time period, the device type of the external device is determined based on the device description information, and the interface mode of the OTG interface is determined based on the device type.

[0022] The above solution establishes an active identification mechanism based on device addresses to accurately determine the type of external devices. Sending device identification commands based on the device address forces the acquisition of device description information within a preset time window, avoiding identification failures caused by device response delays or communication anomalies. By limiting the preset time period, both the timeliness of the identification process and the prevention of the system from entering an infinite loop due to timeouts are ensured. Determining the device type based on the device description information allows for pattern matching based on inherent device attributes (such as device category identifiers), providing a reliable basis for subsequent interface mode switching. This solution forms a closed-loop logic between device identification and interface mode decision-making, ensuring the accuracy and real-time performance of OTG interface mode switching.

[0023] As a preferred example, the step of switching the interface mode of the OTG interface according to the device type includes:

[0024] When the external device is determined to be a USB device based on the device description information, the interface mode of the OTG interface is kept in the preset USB Host mode;

[0025] When it is determined from the device description information that the external device is not a USB device, the interface mode of the OTG interface is switched to USB Device mode.

[0026] The above solution achieves intelligent switching of OTG interface mode by dynamically identifying the type of external device, thus solving the inefficiency and signal integrity risks associated with traditional manual switching. First, it determines whether the external device is a USB device based on the device description information. If it is a USB device, the default USB Host mode is maintained, and the OPS terminal directly manages the data transmission of the USB device as the host. If a non-USB device is detected, the interface mode is actively switched to USB Device mode, allowing the OPS terminal to simulate a slave device and adapt to other types of external devices. This dual-mode switching mechanism based on device type identification not only avoids communication interruptions caused by manual physical switching operations but also ensures stable communication between different devices through adaptive adjustment at the protocol layer.

[0027] As a preferred example, the step of simulating the OPS terminal as a USB device according to the interface mode to establish a second communication channel connecting the OPS terminal and the external device includes:

[0028] When the interface mode is switched to USB Device mode, the preset USB emulation function inside the OPS terminal is triggered;

[0029] The USB configuration information of the OPS terminal is generated according to the USB emulation function, so as to emulate the OPS terminal as a USB device according to the USB configuration information;

[0030] A second communication channel is constructed based on the USB device to send data from the signal input terminal to the external device.

[0031] In the above solution, the USB emulation function of the OPS terminal is triggered by interface mode switching, thereby automating the construction of a bidirectional communication channel. First, when the interface mode is switched to USB Device mode, the internally preset USB emulation function is triggered, avoiding efficiency losses and potential signal interference caused by manual operation. Second, the configuration information generated based on the USB emulation function allows the OPS terminal to dynamically adapt to the communication requirements of external devices, ensuring protocol compatibility between the simulated USB device and the external device. Finally, by constructing a second communication channel, data from the signal input terminal is directly transmitted to the external device, achieving physical link support for bidirectional communication. This solves the problems of communication interruption and driver reconstruction that occur when manually switching interface modes.

[0032] As a preferred example, identifying the type of signal acquired by the OPS terminal, and transmitting the signal to the signal input terminal or the external device according to the first communication channel or the second communication channel, includes:

[0033] The signals acquired by the OPS terminal are parsed to obtain the signal protocol in the signals.

[0034] The signal protocol is matched with the first terminal protocol of the signal input terminal and the second terminal protocol of the external device, respectively, so as to determine the type of the signal based on the matching result;

[0035] When the signal is identified as being sent by the external device, the signal is sent to the signal input terminal through the first communication channel;

[0036] When the signal is identified as being sent by the signal input terminal, the signal is sent to the external device through the second communication channel.

[0037] The above solution achieves automatic signal source identification and routing selection through signal analysis and protocol matching mechanisms, solving the efficiency and reliability problems caused by manual switching. First, key protocol features are extracted by analyzing the signal protocol, providing basic data for subsequent protocol matching. Second, the analyzed protocol is matched with preset first and second terminal protocols, accurately distinguishing the signal source type based on protocol feature differences. When the matching result indicates an external device signal, the first communication channel is automatically selected to transmit the signal to the signal input terminal, ensuring correct data input to the all-in-one machine. When the matching result indicates a signal sent by the signal input terminal, the data is transmitted back to the external device via the second communication channel, achieving automated switching of bidirectional communication. This solution replaces physical switching operations with intelligent judgment at the protocol level, eliminating the risks of manual operation while ensuring the accuracy and real-time performance of signal transmission in different directions.

[0038] Secondly, the present invention discloses a bidirectional communication system based on interface switching, applied to an all-in-one device integrating an OPS terminal and a signal input terminal; wherein, the USB interface of the signal input terminal is electrically connected to the motherboard of the all-in-one device; the USB interface of the OPS terminal is electrically connected to the motherboard of the all-in-one device; the OTG interface of the OPS terminal is electrically connected to the communication interface of an external device; the bidirectional communication system includes a first channel module, an interface switching module, a second channel module, and a bidirectional communication module;

[0039] The first channel module is used to establish a first communication channel between the signal input terminal and the OPS terminal when the external device is detected to be connected to the OPS terminal;

[0040] The interface switching module is used to obtain the device type of the external device and switch the interface mode of the OTG interface according to the device type;

[0041] The second channel module is used to simulate the OPS terminal as a USB device according to the interface mode, so as to build a second communication channel connecting the OPS terminal and the external device;

[0042] The bidirectional communication module is used to identify the type of signal acquired by the OPS terminal, so as to send the signal to the signal input terminal or the external device according to the first communication channel or the second communication channel.

[0043] This invention discloses a bidirectional communication system based on interface switching. Through a hardware architecture integrating an OPS terminal and a signal input terminal, it achieves automated switching of bidirectional communication. When an external device connects, the construction of the first communication channel directly connects the signal input terminal and the OPS terminal, ensuring that the initial signal from the external device can be quickly transmitted to the all-in-one machine. By acquiring the external device type and dynamically switching the OTG interface mode, the interface working mode automatically matches the device characteristics, avoiding the manual judgment and physical switching operations required in traditional technologies. Based on the interface mode, the OPS terminal is simulated as a USB device, allowing the same physical interface to function as both a host and a slave, solving the key problem of role switching in bidirectional communication. Finally, dynamic allocation of data flow is achieved through signal type recognition. The first communication channel is used for external devices to send signals to the all-in-one machine, and the second communication channel is used for the all-in-one machine to send signals back to external devices, forming a closed-loop bidirectional communication link.

[0044] Thirdly, the present invention discloses a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements a bidirectional communication method based on interface switching as described in the first aspect.

[0045] Fourthly, the present invention discloses a computer-readable storage medium comprising: a stored computer program, wherein, when the computer program is executed, the device on which the computer-readable storage medium is located is controlled to perform a bidirectional communication method based on interface switching as described in the first aspect. Attached Figure Description

[0046] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0047] Figure 1 This is a flowchart illustrating a bidirectional communication method based on interface switching, as disclosed in an embodiment of the present invention.

[0048] Figure 2 This is a schematic diagram of the structure of a bidirectional communication system based on interface switching, as disclosed in an embodiment of the present invention.

[0049] Figure 3 This is a flowchart illustrating a bidirectional communication method based on interface switching, disclosed in another embodiment of the present invention.

[0050] Figure 4 This is a schematic diagram of an integrated machine structure that combines an OPS box and a signal input terminal, as disclosed in another embodiment of the present invention. Detailed Implementation

[0051] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.

[0053] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.

[0054] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0055] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.

[0056] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).

[0057] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.

[0058] See Figure 1 To address the problems of inability to achieve bidirectional communication and poor bidirectional communication performance in existing technologies, an embodiment of the present invention provides a bidirectional communication method based on interface switching, applied to an all-in-one device integrating an OPS terminal and a signal input terminal; wherein, the USB interface of the signal input terminal is electrically connected to the motherboard of the all-in-one device; the USB interface of the OPS terminal is electrically connected to the motherboard of the all-in-one device; and the OTG interface of the OPS terminal is electrically connected to the communication interface of an external device. Specifically, the bidirectional communication method includes:

[0059] Step 101: When the external device is detected to be connected to the OPS terminal, a first communication channel is established between the signal input terminal and the OPS terminal.

[0060] In this embodiment, the step mainly includes: when a change in the level of the OTG interface is detected, determining that the external device is connected to the OPS terminal; switching the USB interface of the signal input terminal to the OPS terminal according to the USB multiplexer preset in the motherboard, so as to establish a first communication channel through the OPS terminal to send the signal of the external device to the signal input terminal.

[0061] In this embodiment, the above steps use the physical characteristic change of OTG interface level as a trigger condition to detect the physical connection action of external devices in real time, replacing the traditional method of relying on manual observation of device status and realizing automated detection of connection events. Interface switching is performed based on a preset USB multiplexer switch, and the preset logic of the hardware circuit realizes instant switching of signal channels. This avoids the time-consuming physical operation required for traditional jumper cap switching and ensures the stability of signal transmission through a fixed hardware switching path. The constructed first communication channel uses the OPS terminal as a relay node to directly transmit external device signals to the signal input terminal, forming a complete unidirectional transmission link and establishing a basic channel for subsequent bidirectional communication.

[0062] Step 102: Obtain the device type of the external device, and switch the interface mode of the OTG interface according to the device type.

[0063] In this embodiment, the above steps mainly include: performing a bus reset operation on the external device to reset the external device to a default state; generating a device address for the external device based on the default state; sending a device identification command to the external device based on the device address to obtain device description information sent by the external device within a preset time period; when the device description signal information is obtained within the time period, determining the device type of the external device based on the device description information, and determining the interface mode of the OTG interface based on the device type; when the external device is determined to be a USB device based on the device description information, maintaining the interface mode of the OTG interface in the preset USB Host mode; when the external device is determined not to be a USB device based on the device description information, switching the interface mode of the OTG interface to USB Device mode.

[0064] In this embodiment, firstly, the above steps, through the synergistic effect of bus reset and device address generation, ensure the reliability of device identification. Performing a bus reset on an external device clears any abnormal or residual data from its original state, forcibly restoring it to its initial default state, thereby eliminating communication conflicts caused by incorrect device initialization. Generating a device address based on the reset default state establishes a unique device identifier, preventing address conflicts when multiple devices connect. This timing control of resetting before address allocation ensures device state consistency and provides a stable and reliable addressing foundation for subsequent device type identification, thus improving the device compatibility and identification accuracy of the entire bidirectional communication system. Secondly, by establishing an active identification mechanism based on device addresses, accurate judgment of external device types is achieved. Sending a device identification command based on the device address forces the acquisition of device description information within a preset time window, avoiding identification failures due to device response delays or communication anomalies. Limiting the preset time period ensures the timeliness of the identification process and prevents the system from entering an infinite loop due to timeout. Determining the device type based on the device description information allows for pattern matching based on inherent device attributes (such as device category identifiers), providing a reliable basis for subsequent interface mode switching. This solution establishes a closed-loop logic between device identification and interface mode decision-making, ensuring the accuracy and real-time performance of OTG interface mode switching. Ultimately, by dynamically identifying the external device type, it achieves intelligent switching of the OTG interface mode, resolving the inefficiency and signal integrity risks associated with traditional manual switching. First, it determines whether the external device is a USB device based on the device description information. If it is identified as a USB device, the default USB Host mode is maintained, and the OPS terminal directly manages the data transmission of the USB device as the host. If a non-USB device is detected, the interface mode is proactively switched to USB Device mode, allowing the OPS terminal to simulate a slave device and adapt to other types of external devices. This dual-mode switching mechanism based on device type identification not only avoids communication interruptions caused by manual physical switching operations but also ensures stable communication between different devices through adaptive adjustments at the protocol layer.

[0065] Step 103: Simulate the OPS terminal as a USB device according to the interface mode to build a second communication channel connecting the OPS terminal and the external device.

[0066] In this embodiment, the above steps mainly include: when the interface mode is switched to USB Device mode, triggering the preset USB emulation function inside the OPS terminal; generating USB configuration information of the OPS terminal according to the USB emulation function, so as to emulate the OPS terminal as a USB device according to the USB configuration information; and constructing a second communication channel to send the data of the signal input terminal to the external device according to the USB device.

[0067] In this embodiment, the above steps trigger the USB emulation function of the OPS terminal through interface mode switching, thereby automating the construction of a bidirectional communication channel. First, when the interface mode is switched to USB Device mode, the internally preset USB emulation function is triggered, avoiding efficiency losses and potential signal interference caused by manual operation. Second, based on the configuration information generated by the USB emulation function, the OPS terminal can dynamically adapt to the communication requirements of external devices, ensuring protocol compatibility between the simulated USB device and the external device. Finally, by constructing a second communication channel, data from the signal input terminal is directly transmitted to the external device, achieving physical link support for bidirectional communication, thus solving problems such as communication interruption and driver reconstruction that occur when manually switching interface modes.

[0068] Step 104: Identify the type of signal acquired by the OPS terminal, and send the signal to the signal input terminal or the external device according to the first communication channel or the second communication channel.

[0069] In this embodiment, the above steps mainly include: performing signal parsing on the signal acquired by the OPS terminal to obtain the signal protocol in the signal; matching the signal protocol with the first terminal protocol of the signal input terminal and the second terminal protocol of the external device respectively, so as to determine the type of the signal according to the matching result; when the signal is identified as a signal sent by the external device, sending the signal to the signal input terminal through the first communication channel; when the signal is identified as a signal sent by the signal input terminal, sending the signal to the external device through the second communication channel.

[0070] In this embodiment, the above steps achieve automatic identification and routing selection of signal sources through signal parsing and protocol matching mechanisms, solving the efficiency and reliability problems caused by manual switching. First, key protocol features are extracted by parsing the signal protocol, providing basic data for subsequent protocol matching. Second, the parsed protocol is matched with preset first and second terminal protocols, accurately distinguishing the signal source type based on protocol feature differences. When the matching result indicates an external device signal, the first communication channel is automatically selected to transmit the signal to the signal input terminal, ensuring that external device data can be correctly input into the all-in-one machine. When the matching result indicates a signal sent by the signal input terminal, the data is transmitted back to the external device through the second communication channel, achieving automated switching of bidirectional communication. This solution replaces physical switching operations with intelligent judgment at the protocol level, eliminating the risks of manual operation while ensuring the accuracy and real-time performance of signal transmission in different directions.

[0071] like Figure 2As shown, based on the above method embodiments, corresponding device embodiments are provided; one embodiment of the present invention provides a bidirectional communication system based on interface switching, applied to an all-in-one device integrating an OPS terminal and a signal input terminal; wherein, the USB interface of the signal input terminal is electrically connected to the motherboard of the all-in-one device; the USB interface of the OPS terminal is electrically connected to the motherboard of the all-in-one device; the OTG interface of the OPS terminal is electrically connected to the communication interface of an external device; the bidirectional communication system includes a first channel module 201, an interface switching module 202, a second channel module 203, and a bidirectional communication module 204;

[0072] The first channel module 201 is used to establish a first communication channel between the signal input terminal and the OPS terminal when the external device is detected to be connected to the OPS terminal;

[0073] The interface switching module 202 is used to obtain the device type of the external device and switch the interface mode of the OTG interface according to the device type;

[0074] The second channel module 203 is used to simulate the OPS terminal as a USB device according to the interface mode, so as to build a second communication channel connecting the OPS terminal and the external device;

[0075] The bidirectional communication module 204 is used to identify the type of signal acquired by the OPS terminal, so as to send the signal to the signal input terminal or the external device according to the first communication channel or the second communication channel.

[0076] It is understood that the above-described device embodiments correspond to the method embodiments of the present invention, and can implement a bidirectional communication method based on interface switching provided by any of the above-described method embodiments of the present invention.

[0077] It should be noted that the device embodiments described above are merely illustrative, and some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can specifically be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.

[0078] Based on the above embodiment of a bidirectional communication method based on interface switching, another embodiment of the present invention provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements a bidirectional communication method based on interface switching according to any embodiment of the present invention.

[0079] For example, in this embodiment, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the terminal device.

[0080] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.

[0081] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting various parts of the terminal device via various interfaces and lines.

[0082] Based on the above-described method embodiments, another embodiment of the present invention provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute a bidirectional communication method based on interface switching as described in any of the above-described method embodiments of the present invention.

[0083] The modules / units integrated in the device / terminal equipment, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0084] This embodiment describes a bidirectional communication method, system, device, and medium based on interface switching. Through a hardware architecture integrating an OPS terminal and a signal input terminal, it achieves automated switching of bidirectional communication. When an external device connects, the construction of the first communication channel directly connects the signal input terminal and the OPS terminal, ensuring that the initial signal from the external device can be quickly transmitted to the all-in-one machine. By acquiring the external device type and dynamically switching the OTG interface mode, the interface working mode automatically matches the device characteristics, avoiding the manual judgment and physical switching operations required in traditional technologies. Based on the interface mode, the OPS terminal is simulated as a USB device, allowing the same physical interface to function as both a host and a slave, solving the key problem of role switching in bidirectional communication. Finally, dynamic allocation of data flow is achieved through signal type recognition. The first communication channel is used for external devices to send signals to the all-in-one machine, and the second communication channel is used for the all-in-one machine to send signals back to external devices, forming a closed-loop bidirectional communication link.

[0085] Example 2

[0086] OPS boxes are commonly used signal relay devices paired with integrated devices. External devices connect to the OPS box to send signals, and the OPS box then forwards the signals to the integrated device. However, how to forward the signals sent by the integrated device to the external device through the OPS box is a technical problem that existing technologies need to solve.

[0087] In this regard, refer to Figure 3This embodiment provides a bidirectional communication method based on interface switching to achieve bidirectional communication between the all-in-one device and external devices and improve the effectiveness of bidirectional communication. Specifically, the bidirectional communication method is applied to an all-in-one device integrating an OPS terminal and a signal input terminal.

[0088] Specifically, refer to Figure 4 The USB interface of the signal input terminal is electrically connected to the motherboard of the all-in-one device; the USB interface of the OPS terminal is electrically connected to the motherboard of the all-in-one device; and the OTG interface of the OPS terminal is electrically connected to the communication interface of the external device. It should be noted that the type of signal input terminal is not limited and can be a touch-screen terminal or similar device, while the external device can be a computer, mobile phone, or other similar terminal.

[0089] Specifically, the bidirectional communication method based on interface switching includes:

[0090] Step 301: Switch the USB interface of the signal input terminal to the OPS terminal to establish an OPS signal channel from the signal input terminal to the OPS terminal.

[0091] In this embodiment, when a signal input terminal, such as a touch frame, is connected to the motherboard of the all-in-one machine via USB, the touch frame is an input device connected to the USB port of the motherboard inside the all-in-one machine. It is essentially a USB device that supports the HID protocol, receives user touch information, and sends it to the motherboard for processing.

[0092] Next, the all-in-one PC switches the OPS channel for communication with the OPS based on the touch frame input signal, and simultaneously switches the touch frame's USB to the OPS end. The all-in-one PC's display control module identifies the input source and switches the screen to the OPS channel, while the USB signal switching is controlled by the all-in-one PC via a USB multiplexer (USB MUX), switching the touch frame's USB interface, originally connected to the motherboard, to the OPS.

[0093] Step 302: When an external device is connected to the OPS terminal, the interface mode of the OTG interface is switched according to the type of the external device to simulate the OPS terminal as a USB device, thereby establishing a communication channel between the OPS terminal and the external device.

[0094] In this embodiment, the OTG interface is first set to USB Host mode by default; wherein, the OTG controller is in Host mode by default and acts as USB Host, that is, the OTG controller in OPS acts as USB Host and attempts to identify external devices.

[0095] When a USB device is plugged into the OTG USB port, the Host identifies its presence by detecting changes in port voltage or signal line status. Next, the USB Host performs a bus reset operation, resetting all devices to their default state. Specifically, the Host issues a Reset command to the bus to reset the USB device's state, setting its address to 0 and clearing any potential transmission errors. It then sends a predefined instruction, such as a GET_DESCRIPTOR packet, to the device's default address 0 to request description information for the external device connected to the OPS box, such as a USB Device. If the external device, such as the USB Device, correctly responds to the USB Host and sends its device description data after receiving the GET_DESCRIPTOR instruction, it indicates that a USB Device is connected. If the USB Host does not receive a response from the USB Device within a specified time, it assumes that a USB Host is connected and automatically switches the OTG to USB Device mode, re-establishing the connection.

[0096] During the OTG switching process, the OPS runs an embedded Linux or embedded controller, with a built-in USB Gadget module or controller, and has USB device emulation capabilities. When the OPS's OTG port switches to Device mode, the USB Gadget is activated. The Gadget simulates a USB touch device by configuring HID class protocols, setting VID / PID, report descriptors, etc. All raw data from signal input terminals, such as the touch frame, is sent to external devices via the USB touch device simulated by the OPS.

[0097] Step 303: Send the signal from the external device to the all-in-one machine according to the OPS signal channel, or send the signal from the signal input terminal to the external device according to the communication channel.

[0098] In this embodiment, the OPS receives signals from external devices such as HDMI video signals, and also receives USB touch data from the signal input terminal, such as HID signals emitted from the touch frame. The HDMI or HID signal is identified by the all-in-one machine's display control module to switch the communication channel.

[0099] Specifically, when the OPS box detects the HDMI video signal, it switches the display to the OPS channel. When the OPS box detects the HDI signal, all raw coordinate data from the signal input terminal, such as the touch frame, is processed, packaged according to the HID protocol, and sent to the external device via the Gadget. Specifically, the OPS reads the raw touch frame data (such as X / Y coordinates, press status, etc.); the data is processed and repackaged according to the USB HID protocol; and then sent to the external device via the OTG Device (USB Gadget).

[0100] This embodiment provides a bidirectional communication method based on interface switching. A touch input device conforming to the USB HID class protocol is connected to the internal motherboard of an all-in-one PC via a USB interface. To enable touch control of an external PC, the all-in-one PC is equipped with a USB multiplexer (MUX), which can switch the USB connection of the touch frame between the motherboard and the OPS module. When an external device is connected to the OPS box via HDMI and becomes the display source, the all-in-one PC internally identifies the current input signal source as the OPS channel and then controls the USB MUX to switch the USB connection of the touch frame to the OPS end. At this time, the OPS module internally reads the data from the touch frame and simulates it as a HID class USB device through an embedded USB Gadget module. During the switching process, the OTG interface is initially set to Host mode to adapt to devices such as regular USB flash drives. When the user connects an external device to the OPS OTG port, the OPS, acting as the Host, first attempts to identify the external device. If the detection fails (e.g., the PC itself is a USB Host and does not return a device descriptor), the system determines that the other party is the Host and automatically switches the OTG port to Device mode. After the switch is complete, the internal USB Gadget of the OPS starts, establishes a USB connection with the external device, and transmits the touch frame data to the external device in real time using the HID protocol. This method eliminates the need for manual switching or driver installation by the user; the entire process is completed automatically based on the USB protocol and signal judgment mechanism, enabling the all-in-one machine to control external devices and improving interactive efficiency in teaching and demonstration environments.

[0101] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A method of bidirectional communication based on interface switching, characterized in that, An all-in-one device integrating an OPS terminal and a signal input terminal; wherein, the USB interface of the signal input terminal is electrically connected to the motherboard of the all-in-one device; the USB interface of the OPS terminal is electrically connected to the motherboard of the all-in-one device; the OTG interface of the OPS terminal is electrically connected to the communication interface of an external device; the all-in-one device is equipped with a USB multiplexer, capable of switching the USB connection of the touch frame between the motherboard and the OPS terminal; the OPS terminal internally reads data from the touch frame and simulates it as a HID-type USB device through an embedded USBGadget module; the bidirectional communication method includes: When the external device is detected to be connected to the OPS terminal, a first communication channel is established between the signal input terminal and the OPS terminal; wherein, when a change in the level of the OTG interface is detected, it is determined that the external device is connected to the OPS terminal; according to the USB multiplexer switch preset in the motherboard, the USB interface of the signal input terminal is switched to be connected to the OPS terminal, so as to establish a first communication channel through the OPS terminal to send the signal of the external device to the signal input terminal; Obtain the device type of the external device, and switch the interface mode of the OTG interface according to the device type; According to the interface mode, the OPS terminal is simulated as a USB device to build a second communication channel connecting the OPS terminal and the external device; The type of signal acquired by the OPS terminal is identified, and the signal is sent to the signal input terminal or the external device according to the first communication channel or the second communication channel; wherein, the signal acquired by the OPS terminal is parsed to obtain the signal protocol in the signal; the signal protocol is matched with the first terminal protocol of the signal input terminal and the second terminal protocol of the external device respectively, and the type of the signal is determined according to the matching result; when the signal is identified as being sent by the external device, the signal is sent to the signal input terminal through the first communication channel; when the signal is identified as being sent by the signal input terminal, the signal is sent to the external device through the second communication channel.

2. The bidirectional communication method based on interface switching according to claim 1, characterized in that, Before obtaining the device type of the external device, the following steps are included: Perform a bus reset operation on the external device to reset the external device to its default state; The device address of the external device is generated based on the default state.

3. The bidirectional communication method based on interface switching according to claim 2, characterized in that, The step of obtaining the device type of the external device includes: The device identification command is sent to the external device according to the device address, so as to obtain the device description information sent by the external device within a preset time period; When the device description information is obtained within the time period, the device type of the external device is determined based on the device description information, and the interface mode of the OTG interface is determined based on the device type.

4. The bidirectional communication method based on interface switching according to claim 3, characterized in that, The step of switching the interface mode of the OTG interface according to the device type includes: When the external device is determined to be a USB device based on the device description information, the interface mode of the OTG interface is kept in the preset USB Host mode; When it is determined from the device description information that the external device is not a USB device, the interface mode of the OTG interface is switched to USB Device mode.

5. The bidirectional communication method based on interface switching according to claim 4, characterized in that, The step of simulating the OPS terminal as a USB device according to the interface mode to establish a second communication channel connecting the OPS terminal and the external device includes: When the interface mode is switched to USB Device mode, the preset USB emulation function inside the OPS terminal is triggered; The USB configuration information of the OPS terminal is generated according to the USB emulation function, so as to emulate the OPS terminal as a USB device according to the USB configuration information; A second communication channel is constructed based on the USB device to send data from the signal input terminal to the external device.

6. A bidirectional communication system based on interface switching, characterized in that, An all-in-one device integrating an OPS terminal and a signal input terminal is provided. The USB interface of the signal input terminal is electrically connected to the motherboard of the all-in-one device. The USB interface of the OPS terminal is electrically connected to the motherboard of the all-in-one device. The OTG interface of the OPS terminal is electrically connected to the communication interface of an external device. The all-in-one device is equipped with a USB multiplexer, capable of switching the USB connection of the touch frame between the motherboard and the OPS terminal. The OPS terminal internally reads data from the touch frame and simulates it as a HID-type USB device through an embedded USBGadget module. The bidirectional communication system includes a first channel module, an interface switching module, a second channel module, and a bidirectional communication module. The first channel module is used to establish a first communication channel connecting the signal input terminal to the OPS terminal when the external device is detected to be connected to the OPS terminal; wherein, when a change in the level of the OTG interface is detected, it is determined that the external device is connected to the OPS terminal; according to the USB multiplexer switch preset in the motherboard, the USB interface of the signal input terminal is switched to be connected to the OPS terminal, so as to establish a first communication channel through the OPS terminal to send the signal of the external device to the signal input terminal; The interface switching module is used to obtain the device type of the external device and switch the interface mode of the OTG interface according to the device type; The second channel module is used to simulate the OPS terminal as a USB device according to the interface mode, so as to build a second communication channel connecting the OPS terminal and the external device; The bidirectional communication module is used to identify the type of signal acquired by the OPS terminal, and to send the signal to the signal input terminal or the external device according to the first communication channel or the second communication channel; wherein, the signal acquired by the OPS terminal is parsed to obtain the signal protocol in the signal; the signal protocol is matched with the first terminal protocol of the signal input terminal and the second terminal protocol of the external device respectively, so as to determine the type of the signal according to the matching result; when the signal is identified as being sent by the external device, the signal is sent to the signal input terminal through the first communication channel; when the signal is identified as being sent by the signal input terminal, the signal is sent to the external device through the second communication channel.

7. A terminal device, characterized in that, The system includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements a bidirectional communication method based on interface switching as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, include: A stored computer program, wherein, when the computer program is executed, it controls the device containing the computer-readable storage medium to perform a bidirectional communication method based on interface switching as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Signal switching method and device

    CN107885688A

  • Equipment port switching method and device

    CN115292231A