A keyboard and mouse simulation device based on Ethernet
By designing a keyboard and mouse simulation device that integrates Ethernet, PS/2 and USB interfaces, the problem of distance limitation in the existing technology is solved, the remote simulation function of keyboard and mouse is realized, and the application scenario is expanded.
Patent Information
- Application Number
- CN202010696171.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-20
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2040-07-20
AI Technical Summary
In the prior art, the distance between the main control computer and the device under test cannot be too far, which limits the application scenarios of the keyboard and mouse simulation system based on PCI.
A keyboard and mouse simulation device based on Ethernet was designed, integrating the Ethernet interface, PS/2 keyboard and mouse interface and USB keyboard and mouse interface. The Ethernet interface module, protocol processing module and keyboard and mouse interface module are connected to each other to realize the main The control computer remotely sends control commands over Ethernet to simulate keyboard and mouse operations.
The application scenarios of keyboard and mouse simulation devices are expanded to make them not limited by the use site and distance, and the remote simulation function of keyboard and mouse interface is realized.
Smart Images

Figure CN111966612B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a keyboard and mouse simulation device based on Ethernet, in particular to a device capable of realizing the function of remote simulation of a keyboard and mouse. The invention is applied to the field of industrial automation testing. Background Art
[0002] a) PS / 2 keyboard and mouse interface technology
[0003] The PS / 2 interface is a special interface for mouse and keyboard, proposed by IBM. It is a 6-pin circular interface, and the keyboard and mouse only use 4 pins to transmit data and power, and the other 2 are empty pins. The transmission rate of the PS / 2 interface is slightly faster than that of the COM interface, and it is a standard interface of the ATX motherboard. It is one of the most widely used mouse and keyboard interfaces, but it does not support hot plugging and has a low signal transmission rate. Due to the slow replacement of computers in the industrial testing field, the PS / 2 interface is still widely used.
[0004] b)USB keyboard and mouse interface technology
[0005] USB (Universal Serial Bus) is a computer external interface standard used to regulate the connection and communication between computers and external devices. It is mainly used in the PC field and was jointly proposed by Intel, Compaq, IBM, Microsoft and other companies at the end of 1994. USB interface keyboard and mouse devices have plug-and-play and hot-swap functions.
[0006] c) Ethernet interface technology
[0007] Ethernet is the most widely used LAN communication method and also a protocol. The Ethernet protocol defines a series of software and hardware standards to connect different computer devices together. The basic elements of Ethernet device networking include switches, routers, hubs, optical fibers and ordinary network cables, as well as Ethernet protocols and communication rules.
[0008] Since the Ethernet protocol is relatively complex, a dedicated Ethernet interface protocol chip is usually used to complete the transmission and reception of data. On the one hand, the Ethernet protocol chip communicates with the system data processor through a simple SPI (Serial Peripheral Interface) interface, and on the other hand, it converts the data into a data stream that can be recognized by Ethernet and sends it to the Ethernet network for transmission. This method can simplify system design and expand the application scope of the system.
[0009] d) PCI-based keyboard and mouse emulation technology
[0010] CN204808311U A PCI-based keyboard and mouse simulation system This utility model patent implements a PCI-based keyboard and mouse simulation system, which is used to perform keyboard and mouse test operations on the system where the embedded software under test is located. The PCI board used in this technology needs to be installed on the main control computer, and the main control computer sends a control command to the PCI board, and finally forms a PS / 2 keyboard and mouse signal or a USB keyboard and mouse signal, which is connected to the device under test through a PS / 2 cable or a USB cable. Due to the signal attenuation of the PS / 2 cable or the USB cable, the length of the cable cannot be too long, generally not exceeding 2m, and the longest cannot exceed 10m, otherwise the keyboard and mouse device will not be recognized. This requires that the distance between the main control computer and the device under test cannot be too far, thereby limiting the application scenario of the PCI-based keyboard and mouse simulation system. Summary of the invention
[0011] The purpose of the present invention is to provide a keyboard and mouse simulation device based on Ethernet, which can be used to realize the function of remote simulation of keyboard and mouse. In order to solve the problem in the prior art that the distance between the main control computer and the device under test cannot be too far. By using the Ethernet interface, the present invention expands the application scenarios of the keyboard and mouse simulation device, so that it is no longer limited by the use site and distance.
[0012] The invention realizes a keyboard and mouse simulation device based on Ethernet. The device is provided with a PS / 2 keyboard and mouse interface and a USB keyboard and mouse interface, and an Ethernet interface module.
[0013] The Ethernet-based keyboard and mouse simulation device is composed of an Ethernet interface module, a protocol processing module, and a keyboard and mouse interface module; wherein the keyboard and mouse interface module includes a PS / 2 keyboard and mouse interface and a USB keyboard and mouse interface. The connection relationship between them is: the Ethernet interface module is connected to the protocol processing module through an SPI interface for transmitting Ethernet control codes and interface control signals; the keyboard and mouse interface module is connected to the protocol processing module through an internal cable for receiving keyboard and mouse control signals.
[0014] The main control computer remotely sends control instructions to the keyboard and mouse simulation device via Ethernet. The Ethernet interface module on the device receives the control instructions and forwards them to the keyboard and mouse interface module via the protocol processing module, thereby realizing the keyboard and mouse remote simulation function of the main control computer.
[0015] Preferably, the Ethernet interface module is an Ethernet interface protocol analysis chip, and one of its ports is fixedly selected as a communication port, and a maximum of 64k bytes of data buffer area is allocated to cache the Ethernet control code sent from the main control computer.
[0016] Preferably, the protocol processing module unifies the control signal coding format sent by the Ethernet interface module according to the characteristics of the keyboard and mouse control data to form a keyboard and mouse control code; after receiving the keyboard and mouse control code, the protocol processing module parses it and processes it into interface control signals that can be recognized by the keyboard and mouse interface module.
[0017] Preferably, the keyboard and mouse interface module can be divided into three independent parts, namely, a PS / 2 keyboard interface, a PS / 2 mouse interface and a USB keyboard and mouse interface; each part includes an interface chip and its corresponding plug; the interface chip and its corresponding plug are connected via a signal line on a circuit board.
[0018] The implementation process of the PS / 2 keyboard interface simulation is as follows:
[0019] 1). The protocol processing module parses the keyboard key value to be simulated according to the PS / 2 keyboard interface control signal it outputs. If the key is popped up, the key value is set to 0;
[0020] 2). According to the key value table pre-stored in the protocol processing module, automatically find out the row and column of the table corresponding to the key value, which are recorded as row and col respectively;
[0021] 3). Receive the keyboard array scan output signal sent by the interface chip of the PS / 2 keyboard. When the value of the signal is equal to the row of the key value, the protocol processing module sets the value of the keyboard array scan input signal to col;
[0022] 4). When the keyboard array scan output signal switches to the next value, the value of the keyboard array scan input signal is set to 0.
[0023] The implementation process of the PS / 2 mouse interface simulation is as follows:
[0024] 1). The protocol processing module parses the left or right mouse button to be simulated according to the PS / 2 mouse interface control signal it outputs, and sets the corresponding left mouse button press signal and right mouse button press signal to 0 "pop-up" or 1 "pressed";
[0025] 2). The protocol processing module parses the simulated displacement in the horizontal direction and controls the relative change of the optocoupler input that detects horizontal movement;
[0026] 3). The protocol processing module parses the simulated displacement in the vertical direction and controls the relative change of the optocoupler input that detects vertical movement;
[0027] 4). The protocol processing module parses the displacement simulated by the roller and controls the relative changes of the optocoupler or encoder input that detects the rotation of the roller.
[0028] The implementation process of the USB keyboard and mouse interface simulation is as follows:
[0029] 1). The protocol processing module parses the keyboard information and mouse information to be simulated according to the USB keyboard and mouse interface control signal output by it;
[0030] 2). Pack the keyboard information and mouse information into the serial port data frame required by the USB keyboard and mouse interface;
[0031] 3). Detect the USB mouse chip status and output the UART_RDY signal. If the UART_RDY signal is 1, send data frames in sequence according to the serial port protocol. If the UART_RDY signal is 0, wait.
[0032] The present invention provides a keyboard and mouse simulation device based on Ethernet, which has the following advantages and functions:
[0033] The present invention integrates an Ethernet interface, a PS / 2 keyboard and mouse interface, and a USB keyboard and mouse interface on one device, has high integration and complete functions.
[0034] The invention realizes the Ethernet function. By using the device, the remote simulation of the keyboard and mouse interface can be realized without being restricted by the use site. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a schematic diagram of the architecture of the present invention.
[0036] Figure 2 This is a schematic diagram of the interface connection between XC3S500E and W5500.
[0037] Figure 3 This is a schematic diagram of the W5500 initialization process.
[0038] Figure 4 This is a schematic diagram of the data transmission and reception processing flow of W5500.
[0039] Figure 5 This is a schematic diagram of the internal wiring of the keyboard and mouse interface module.
[0040] Figure 6 This is the SMC520 chip state switching flow chart.
[0041] The serial numbers, symbols and codes in the figure are explained as follows:
[0042] Figure 2 The interface code definitions in are shown in Table 1.
[0043] Figure 5 The interface code definitions are shown in Table 3, Table 4 and Table 6. DETAILED DESCRIPTION
[0044] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and specific embodiments.
[0045] The present invention provides a keyboard and mouse simulation device architecture based on Ethernet. Figure 1 As shown. The device consists of an Ethernet interface module, a protocol processing module, and a keyboard and mouse interface module, wherein the keyboard and mouse interface module includes a PS / 2 keyboard and mouse interface and a USB keyboard and mouse interface. The connection relationship between them is: the Ethernet interface module is connected to the protocol processing module through an SPI interface for transmitting Ethernet control codes and interface control signals; the keyboard and mouse interface module is connected to the protocol processing module through an internal cable for receiving keyboard and mouse control signals.
[0046] The Ethernet interface module receives command information transmitted from the main control computer via Ethernet, and converts the command information into Ethernet control code, which includes keyboard parameters and mouse parameters. The Ethernet interface module transmits the Ethernet control code to the protocol processing module, which converts it into keyboard and mouse control signals. The keyboard and mouse interface module forms PS / 2 keyboard and mouse signals or USB keyboard and mouse signals according to the keyboard and mouse control signals, and connects to the device under test through the corresponding PS / 2 cable or USB cable.
[0047] The Ethernet interface module: The Ethernet interface module is an Ethernet interface protocol parsing chip. The Ethernet interface protocol chip used in the present invention is the W5500 chip of WIZnet. The Ethernet connection is realized by using the 10 / 100M Ethernet controller, MAC and TCP protocol stack integrated inside the chip. W5500 has 8 independent high-speed communication ports and 128k bytes of data buffer built in. The size of the buffer can be dynamically adjusted and allocated according to the port communication data throughput. In order to make full use of the chip performance, this design fixedly selects one of the ports as the communication port, and allocates a maximum of 64k bytes of data buffer to cache the Ethernet control code sent by the main control computer.
[0048] The interface control signal used for W5500 initialization and data transmission and reception control is sent by an FPGA chip, the FPGA model is the XC3S500E of the SPANTAN3 series of XILINX. XC3S500E and W5500 are connected through 5 signal lines, 4 of which communicate according to the SPI interface protocol, and the other 1 is the W5500 reset signal. The detailed definition of the connection is: W5500_MISO signal, output by W5500 to XC3S500E, this signal is the master input slave output signal of the SPI bus; W5500_MOSI signal, output by XC3S500E to W5500, this signal is the master output slave input signal of the SPI bus; W5500_SCS signal, output by XC3S500E to W5500, this signal is the slave select signal of the SPI bus; W5500_SCK signal, output by XC3S500E to W5500, this signal is the SPI bus clock signal; W5500_RST signal, output by XC3S500E to W5500, this signal is the W5500 chip reset signal.
[0049] The specific definitions are shown in Table 1 below.
[0050] Table 1 Ethernet interface module signal definition table
[0051] Serial number name definition 1 W5500_MISO SPI master input slave output signal, output from W5500 to XC3S500E 2 W5500_MOSI SPI master output slave input signal, output from XC3S500E to W5500 3 W5500_SCS SPI slave select signal, output by XC3S500E to W5500 4 W5500_SCK SPI clock signal, output by XC3S500E to W5500 5 W5500_RST Reset signal, output from XC3S500E to W5500
[0052] The interface connection between XC3S500E and W5500 is as follows Figure 2 As shown. According to the interface requirements of W5500, XC3S500E implements SPI bus interface to initialize W5500 and process data transmission and reception. Since W5500 does not have power-on reset function, XC3S500E outputs reset signal, which remains at low level for 10ms after power-on and then changes to high level to reset W5500.
[0053] The initialization process of W5500 is all implemented by XC3S500E, and the steps are as follows:
[0054] 1) Pull the reset signal low for 10ms, then pull it to a high level, wait for 20ms, read the LINK register of W5500, if it is 1, it means that W5500 has been reset correctly, otherwise repeat step 1);
[0055] 2) Write 0x80 to the reset register of W5500 to reset the internal register of W5500 and wait for 10ms;
[0056] 3) Configure the gateway register, subnet mask register, physical address register, and local IP address register of W5500 in sequence and write corresponding values, which are defined by the user according to needs;
[0057] 4) Configure the eight network interface registers of W5500 in turn and set the capacity of their send and receive buffers respectively;
[0058] 5) Write the port number of network interface 0 and configure network interface 0 to TCP SERVER mode.
[0059] The initialization process of the above W5500 is as follows Figure 3 shown.
[0060] After W5500 completes the initialization process, you can start the data sending and receiving process. The steps are as follows:
[0061] 1) Set network interface 0 to listening mode, wait for 5ms, and check whether the listening mode is set successfully. If successful, proceed to the next step, otherwise repeat step 1);
[0062] 2) Read the port interrupt flag register to obtain the interrupt number;
[0063] 3) If it is a network interface 0 interrupt, read the interrupt type, clear the interrupt, and go to step 4); otherwise, enter the data receiving state, i.e. step 9);
[0064] 4) If the interrupt type is a successful connection, set the initialization configuration state to connected and enter the data receiving state (i.e. step 9), otherwise go to step 5);
[0065] 5) If the interrupt type is a network interface disconnection, close the network interface, return to the initialization state, and reinitialize the register, i.e., step 10), otherwise proceed to step 6);
[0066] 6) If the interrupt type is data transmission completion, set the data state to transmission completion and enter the data receiving state, i.e. step 9), otherwise enter step 7);
[0067] 7) If the interrupt type is data received, set the data state to data received and enter the data receiving state, i.e. step 9), otherwise enter step 8);
[0068] 8) If the interrupt type is timeout, close the network interface, return to the initialization state, and reinitialize the register, i.e., step 10), otherwise proceed to step 9).
[0069] 9) Determine whether the data status is data received, if not, proceed to step 1); if yes, perform data processing, and then proceed to step 1).
[0070] 10) is the initialization of W5500, and its process has been described above. After completing step 10, proceed to step 1). The data transmission and reception processing process of the above W5500 is as follows: Figure 4 shown.
[0071] The protocol processing module: The protocol processing module is the core of the system and is an FPGA chip, whose model is XC3S500E. The chip is mainly responsible for processing the control code received by the Ethernet interface module into a keyboard and mouse interface control signal according to the set conversion protocol.
[0072] According to the characteristics of keyboard and mouse control data, the control signal encoding format sent by the Ethernet interface module is unified to form a keyboard and mouse control code to simplify the design of the Ethernet master control software. The keyboard and mouse control code can be transmitted through Ethernet in the form of a network data packet, and is forwarded to the protocol processing module after being received by the Ethernet interface module. After being decoded by the protocol processing module, it forms a control signal that can be recognized by the corresponding keyboard or mouse. The specific definition of the keyboard and mouse control code is shown in Table 2:
[0073] Table 2 Keyboard and mouse control code definition table
[0074]
[0075]
[0076] After receiving the keyboard and mouse control code, XC3S500E parses it according to the above format and processes it into interface control signals that can be recognized by the keyboard and mouse interface module. The parsing steps are as follows:
[0077] 1) Read out a frame of data (7 bytes) in sequence and store them in 7 registers respectively;
[0078] 2) If the value of the 7th byte is not 0xAA, discard the data of this frame, otherwise go to step 3;
[0079] 3) Judge the value of byte 1. If it is 0x01, combine byte 2 and byte 3 into a PS / 2 keyboard interface control signal.
[0080] 4) Determine the value of byte 1. If it is 0x01, combine byte 2, byte 4, byte 5, and byte 6 into a PS / 2 mouse interface control signal.
[0081] 5) Determine the value of byte 1. If it is 0x02, combine byte 2 and byte 3 into a USB keyboard interface control signal.
[0082] 6) Determine the value of byte 1. If it is 0x03, combine byte 2, byte 4, byte 5, and byte 6 into a USB mouse interface control signal.
[0083] The keyboard and mouse interface module: The keyboard and mouse interface module is composed of three keyboard and mouse interface chips and their corresponding plugs. The connection relationship between them and the protocol processing module XC3S500E chip is: the keyboard and mouse interface chips are connected to their corresponding plugs through signal lines on the circuit board, and the keyboard and mouse interface chips are connected to the XC3S500E chip through universal input and output signal lines on the circuit board.
[0084] The XC3S500E chip: In addition to the protocol processing function described above, the internal logic of the XC3S500E chip is also responsible for various control signals, and sends them to the keyboard and mouse interface chip respectively, to realize the parameter configuration and distribution of the keyboard and mouse interface chip, and the keyboard and mouse interface chip generates corresponding PS / 2 or USB signals to the computer under test, to realize the keyboard and mouse operation of the computer under test.
[0085] The keyboard and mouse interface chip: The keyboard and mouse interface chips are selected from the following three models:
[0086] The PS / 2 keyboard interface chip uses HT82K628A from HOLTEK; the PS / 2 mouse interface chip uses SMC520 from Shanghai Belling; the USB keyboard and mouse interface chip uses UI012 from Beijing Feiyila.
[0087] The internal connection diagram of the keyboard and mouse interface module is as follows: Figure 5 As shown in the figure, the keyboard and mouse interface module can be divided into three independent parts, namely the PS / 2 keyboard interface, the PS / 2 mouse interface and the USB keyboard and mouse interface. The connection relationship between them is:
[0088] 1) The PS / 2 keyboard interface consists of an interface chip HT82K628A and a PS / 2 keyboard plug, which are connected by signal lines on the circuit board. The signal lines include PS / 2_KB_DAT and PS / 2_KB_CLK.
[0089] The HT82K628A and XC3S500 are connected via a data bus. The signal lines include PS / 2_KB_R and
[0090] PS / 2_KB_C, the bit width and definition of each signal line and bus are shown in Table 3.
[0091] 2) The PS / 2 mouse interface consists of an interface chip SMC520 and a PS / 2 mouse plug, which are connected by a signal line on a circuit board. The signal line includes PS / 2_MS_DAT and PS / 2_MS_CLK. SMC520 is connected to XC3S500 by a signal line on a circuit board. The signal line includes PS / 2_MS_X1, PS / 2_MS_X2, PS / 2_MS_Y1, PS / 2_MS_Y2, PS / 2_MS_Z1, PS / 2_MS_Z2, PS / 2_MS_L, and PS / 2_MS_R. The bit width and definition of each signal line are shown in Table 4;
[0092] 3) The USB keyboard and mouse interface consists of an interface chip UI102 and a USB keyboard and mouse plug, which are connected via a UART signal line, which includes UART_RX and UART_RDY. UI102 is connected to XC3S500 via a signal line, which includes USB_D+ and USB_D-. The bit width and definition of each signal line are shown in Table 6.
[0093] The PS / 2 keyboard interface: The PS / 2 keyboard interface chip uses the HT82K628A. The XC3S500E sends control instructions to the HT82K628A through the control line. The definitions of the control lines involved are shown in the following table:
[0094] Table 3 HT82K628A control line list
[0095]
[0096] The implementation process of PS / 2 keyboard interface simulation is as follows:
[0097] 1). The protocol processing module XC3S500E parses the keyboard key value to be simulated according to the PS / 2 keyboard interface control signal it outputs. If the key is popped up, the key value is set to 0;
[0098] 2). According to the key value table pre-stored in XC3S500E, automatically find out the row and column of the table corresponding to the key value, which are recorded as row and col respectively;
[0099] 3). Receive the keyboard array scan output signal (PS / 2_KB_R) sent by the PS / 2 keyboard interface chip HT82K628A. When the value of the signal is equal to the row of the key value, XC3S500E sets the value of the keyboard array scan input signal (PS / 2_KB_R) to col;
[0100] 4). When the keyboard array scan output signal (PS / 2_KB_R) switches to the next value, the value of the keyboard array scan input signal (PS / 2_KB_R) is set to 0.
[0101] The PS / 2 bidirectional data interface (PS / 2_KB_DAT) and the PS / 2 bidirectional synchronous clock interface (PS / 2_KB_CLK) are controlled autonomously by the HT82K628A chip, so they only need to be connected to the PS / 2 interface socket of the device under test, and no special design is required.
[0102] The PS / 2 mouse interface: The PS / 2 mouse interface chip uses SMC520, and the XC3S500E sends control instructions to SMC520 through the control line. The definitions of the control lines involved are shown in the following table:
[0103] Table 4 SMC520 control line list
[0104]
[0105]
[0106] The implementation process of PS / 2 mouse interface simulation is as follows:
[0107] 1). XC3S500E parses the PS / 2 mouse interface control signal output by the protocol processing module to find out the left or right mouse button to be pressed, and sets the corresponding left mouse button pressed signal (PS / 2_MS_L) and right mouse button pressed signal (PS / 2_MS_L) to 0 (pop-up) or 1 (pressed);
[0108] 2). XC3S500E analyzes the simulated displacement in the horizontal direction and controls the relative changes of PS / 2_MS_X1 and PS / 2_MS_X2;
[0109] 3). XC3S500E analyzes the simulated displacement in the vertical direction and controls the relative changes of PS / 2_MS_Y1 and PS / 2_MS_Y2;
[0110] 4). XC3S500E analyzes the displacement of the roller simulation and controls the relative changes of PS / 2_MS_Z1 and PS / 2_MS_Z2.
[0111] SMC520 is a dedicated interface chip paired with an optical displacement detection chip. Therefore, XC3S500E needs to simulate the output signal of the optical displacement detection chip, mainly the horizontal, vertical and roller displacement signal simulation, that is, to detect the optocoupler input for horizontal movement (PS / 2_MS_X1, PS / 2_MS_X2), the optocoupler input for vertical movement (PS / 2_MS_Y1, PS / 2_MS_Y2) and the optocoupler or encoder input for roller flipping (PS / 2_MS_Z1, PS / 2_MS_Z2).
[0112] like Figure 6 As shown, the simulation method of the control signal of the PS / 2 mouse interface chip SMC520 adopts a four-state state machine, which is implemented by XC3S500E, and its state switching process is:
[0113] 1) Enter state 0 after power-on;
[0114] 2) If the mouse movement to be simulated is in the positive direction, the state is transferred to state 1, otherwise it is transferred to state 2;
[0115] 3) In state 1, if the mouse continues to move in the positive direction, the state is transferred to state 3, otherwise it is transferred to state 0;
[0116] 4) In state 2, if the mouse moves in the negative direction, the state is transferred to state 3, otherwise it is transferred to state 0; 5) In state 3, if the mouse moves in the positive direction, the state is transferred to state 2, otherwise it is transferred to state 1; 6) In each state, if the mouse does not move, the loop waits and keeps the state unchanged. In each state,
[0117] The corresponding X1 / X2, Y1 / Y2, and Z1 / Z2 values will be output, as shown in Table 5. X1 and X2 represent the two optocoupler input values for detecting horizontal movement, Y1 and Y2 represent the two optocoupler input values for detecting vertical movement, and Z1 and Z2 represent the optocoupler input values for detecting horizontal movement.
[0118] Table 5 PS / 2 mouse interface simulation state machine truth table
[0119]
[0120] The PS / 2 interface bidirectional data interface (PS / 2_MS_DAT) and the PS / 2 interface bidirectional synchronous clock interface (PS / 2_MS_CLK) are independently controlled by the chip SMC520, so they only need to be connected to the PS / 2 mouse interface socket of the device under test, and no special design is required.
[0121] The USB keyboard and mouse interface: The USB keyboard and mouse interface chip uses UI012, and XC3S500E sends control instructions to UI012 through the control line. The definition of the control line involved is shown in Table 6:
[0122] Table 6 UI012 control line list
[0123] name Bit width (bit) definition UART_RX 1 USB mouse chip serial port input signal UART_RDY 1 USB mouse chip status output, 0 means not idle, 1 means idle USB_D+ 1 USB interface differential signal positive terminal USB_D- 1 USB interface differential signal negative terminal
[0124] The implementation process of USB keyboard and mouse interface UI012 simulation is as follows:
[0125] 1). XC3S500E parses the keyboard and mouse information to be simulated according to the USB keyboard and mouse interface control signal output by the protocol processing module;
[0126] 2). Pack the keyboard information and mouse information into the serial port data frame required by UI012;
[0127] 3). Detect the UART_RDY signal. If the UART_RDY signal is 1, send the data frames in sequence according to the serial port protocol. If the UART_RDY signal is 0, wait.
[0128] The format of the serial port data frame complies with the requirements of the UI012 chip, and the serial port protocol is a standard RS232 serial interface. The USB interface differential signal positive end (USB_D+) and the USB interface differential signal negative end (USB_D+) are autonomously controlled by the chip UI012, so it only needs to be connected to the USB keyboard and mouse plug of the device under test, and no special design is required.
Claims
1. A keyboard and mouse simulation device based on Ethernet, characterized in that: The keyboard and mouse simulation device is composed of an Ethernet interface module, a protocol processing module, and a keyboard and mouse interface module; the connection relationship between them is: the Ethernet interface module is connected to the protocol processing module through an SPI interface for transmitting Ethernet control codes and interface control signals; the keyboard and mouse interface module is connected to the protocol processing module through an internal cable for receiving keyboard and mouse control signals; The main control computer remotely sends control instructions to the keyboard and mouse simulation device via Ethernet, and the Ethernet interface module on the device receives the control instructions and forwards them to the keyboard and mouse interface module via the protocol processing module, thereby realizing the keyboard and mouse remote simulation function of the main control computer; The Ethernet interface module is an Ethernet interface protocol analysis chip, and one of its ports is fixedly selected as a communication port, and a maximum of 64k bytes of data buffer area is allocated to buffer the Ethernet control code sent by the main control computer; The protocol processing module unifies the coding format of the control signal sent by the Ethernet interface module according to the characteristics of the keyboard and mouse control data to form a keyboard and mouse control code; after receiving the keyboard and mouse control code, the protocol processing module parses it and processes it into interface control signals that can be recognized by the keyboard and mouse interface module; The interface control signal includes a PS / 2 keyboard interface control signal, a PS / 2 mouse interface control signal, a USB keyboard interface control signal and a USB mouse interface control signal; The keyboard and mouse interface module can be divided into three independent parts, namely, PS / 2 keyboard interface, PS / 2 mouse interface and USB keyboard and mouse interface; each part includes an interface chip and its corresponding plug; the interface chip and its corresponding plug are connected through a signal line on the circuit board.
2. The Ethernet-based keyboard and mouse simulation device according to claim 1, characterized in that: The implementation process of the PS / 2 keyboard interface simulation is as follows: 1). The protocol processing module parses the keyboard key value to be simulated according to the PS / 2 keyboard interface control signal it outputs. If the key is popped up, the key value is set to 0; 2). According to the key value table pre-stored in the protocol processing module, automatically find out the row and column of the table corresponding to the key value, which are recorded as row and col respectively; 3). Receive the keyboard array scan output signal sent by the interface chip of the PS / 2 keyboard. When the value of the signal is equal to the row of the key value, the protocol processing module sets the value of the keyboard array scan input signal to col; 4). When the keyboard array scan output signal switches to the next value, the value of the keyboard array scan input signal is set to 0.
3. The Ethernet-based keyboard and mouse simulation device according to claim 1, characterized in that: The implementation process of the PS / 2 mouse interface simulation is as follows: 1). The protocol processing module parses the left or right mouse button to be simulated according to the PS / 2 mouse interface control signal it outputs, and sets the corresponding left mouse button press signal and right mouse button press signal to 0 "pop-up" or 1 "pressed"; 2). The protocol processing module parses the simulated displacement in the horizontal direction and controls the relative change of the optocoupler input that detects horizontal movement; 3). The protocol processing module parses the simulated displacement in the vertical direction and controls the relative change of the optocoupler input that detects vertical movement; 4). The protocol processing module parses the displacement simulated by the roller and controls the relative changes of the optocoupler or encoder input that detects the rotation of the roller.
4. The Ethernet-based keyboard and mouse simulation device according to claim 1, characterized in that: The implementation process of the USB keyboard and mouse interface simulation is as follows: 1). The protocol processing module parses the keyboard information and mouse information to be simulated according to the USB keyboard and mouse interface control signal output by it; 2). Pack the keyboard information and mouse information into the serial port data frame required by the USB keyboard and mouse interface; 3). Detect the USB mouse chip status and output the UART_RDY signal. If the UART_RDY signal is 1, send data frames in sequence according to the serial port protocol. If the UART_RDY signal is 0, wait.
Citation Information
Patent Citations
Keyboard and mouse analog system based on PCI
CN204808311U
FPGA (Field Programmable Gate Array) online-experiment platform-based online-experiment method of PS / 2 keyboard or mouse interface
CN107562221A
Remote keyboard and mouse control equipment
CN109657507A