A keyboard protocol adaptation system and method for embedded graphics

By designing a keyboard protocol adaptive system, the problem of the single keyboard device type in domestic embedded graphics systems was solved. It achieved adaptive support for keyboard devices with USB 1.0, USB 2.0 and PS2 protocols, and improved the system's multi-keyboard device processing capability and adaptability.

CN115963933BActive Publication Date: 2026-04-17709TH RESEARCH INSTITUTE CHINA STATE SHIPBUILDING CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
709TH RESEARCH INSTITUTE CHINA STATE SHIPBUILDING CORP LTD
Filing Date
2022-12-02
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Domestic embedded graphics systems suffer from limited keyboard device types, insufficient flexibility and adaptability, and difficulty in supporting multiple keyboard devices and device interchangeability.

Method used

Design a keyboard protocol adaptive system, including an application layer, a graphics system layer, a plug-in layer, a driver layer, and a hardware layer. Through a multi-protocol adaptive processing module and an event processing module, it achieves adaptive support for keyboard devices with USB 1.0, USB 2.0, and PS/2 protocols.

Benefits of technology

It improves the information processing and adaptive support capabilities of domestically produced embedded graphics systems for multi-keyboard devices, and achieves compatibility and interchangeability with keyboard devices of different protocols.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115963933B_ABST
    Figure CN115963933B_ABST
Patent Text Reader

Abstract

This invention provides a keyboard protocol adaptive system and method for embedded graphics, belonging to the field of embedded graphics display and control. It includes an application layer, a graphics system layer, a plug-in layer, a driver layer, and a hardware layer. The hardware layer is connected to the driver layer for unidirectional information transmission; the driver layer is connected to the plug-in layer for unidirectional information transmission; the plug-in layer is connected to the graphics system layer for bidirectional information transmission; and the graphics system layer is connected to the application layer for unidirectional information transmission. The driver layer includes independently configured USB 1.0 / 2.0 keyboard device driver modules and PS2 keyboard device driver modules. The plug-in layer includes a keyboard multi-protocol adaptive processing module, and the graphics system layer includes a keyboard event processing module. This invention also provides a method for operating the above system. This invention achieves adaptive support for USB 1.0, USB 2.0, and PS2 protocol type keyboard devices in a domestically produced embedded graphics system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of embedded graphics display and control of domestic basic software and hardware platforms, and more specifically, relates to a keyboard protocol adaptive system and method for embedded graphics. Background Technology

[0002] Embedded graphics display systems are a crucial component of modern electronic information equipment control systems. They provide comprehensive, accurate, and real-time visualization of data, offering strong support for operators to accurately and dynamically grasp dynamics and rationally conduct human-computer interaction. With the rapid development of computer hardware and software technology and graphics processing technology, many advanced foreign weapons are now equipped with complex, multi-screen, high-resolution, highly integrated, and flexible graphics display systems. As a vital component of information input processing in graphics display systems, keyboard technology has also made significant progress. In practical applications, keyboard devices primarily utilize two keyboard protocol types: PS / 2 and USB. The USB protocol itself includes USB 1.0, USB 2.0, and others, resulting in a coexistence of various keyboard types.

[0003] Currently, keyboard input support for embedded graphics systems, especially domestically produced ones, suffers from limitations such as limited device type support, insufficient flexibility, and poor adaptability. For example, some systems only support either USB or PS / 2 keyboards, or only one of the USB 1.0 or USB 2.0 protocols. In practical applications, these graphics systems support a limited range of keyboard devices, making it difficult to meet application requirements such as keyboard device adaptability, multi-keyboard support, and keyboard device interchangeability.

[0004] Therefore, there is a need to develop a system and method for adaptive implementation of keyboard protocols for embedded graphics to overcome the problem of limited keyboard device support in applications. Summary of the Invention

[0005] To address the shortcomings of existing technologies, the present invention aims to provide a keyboard protocol adaptive system and method for embedded graphics. By designing new functional modules and implementation methods, it achieves multi-protocol adaptive support for keyboards in embedded graphics systems, solving the problems of adaptability support for keyboard devices with different protocols and simultaneous support in the coexistence of multiple keyboard devices in embedded graphics systems.

[0006] To achieve the above objectives, this invention provides a keyboard protocol adaptive system for embedded graphics, comprising an application layer, a graphics system layer, a plug-in layer, a driver layer, and a hardware layer. The hardware layer is connected to the driver layer, and they transmit information in a unidirectional manner. The driver layer is connected to the plug-in layer, and they transmit information in a unidirectional manner. The plug-in layer is connected to the graphics system layer, and they transmit information in a bidirectional manner. The graphics system layer is connected to the application layer, and they transmit information in a unidirectional manner.

[0007] The driver layer includes multiple keyboard device driver modules with different protocols that are configured independently; the plug-in layer includes a keyboard multi-protocol adaptive processing module; and the graphics system layer includes a keyboard event processing module.

[0008] The keyboard multi-protocol adaptive processing module is used to provide the graphics system with adaptive message data reception, distribution, conversion processing, and keyboard event reporting support for keyboard devices with various protocol types.

[0009] The keyboard event handling module is used to receive and classify keyboard events for both the graphical window system and the keyboard multi-protocol adaptive processing module.

[0010] Furthermore, the driver layer includes independently configured USB 1.0 / 2.0 keyboard device driver modules and PS2 keyboard device driver modules. The USB 1.0 / 2.0 keyboard device driver module is used to provide device initialization and driver support for USB type keyboard devices, and the PS2 keyboard device driver module is used to provide device initialization and driver support for PS2 type keyboard devices. The keyboard multi-protocol adaptive processing module is used to provide the graphics system with adaptive message data reception, distribution conversion processing and keyboard event reporting support for three types of keyboard devices: USB 1.0 protocol, USB 2.0 protocol and PS2 protocol.

[0011] Furthermore, the keyboard multi-protocol adaptive processing module includes a keyboard initialization module, a keyboard data distribution processing module, and a keyboard data processing module. The keyboard initialization module is connected to the keyboard data distribution processing module. The keyboard data distribution processing module is used to identify and determine the source keyboard device information of the message data and to distribute the corresponding tasks. The keyboard data distribution processing module is connected to the keyboard data processing module.

[0012] Furthermore, the keyboard initialization module is used for setting initial information for multi-protocol keyboard devices, as well as for iterating through keyboard device opening operations and creating keyboard processing tasks based on the iteration results.

[0013] Furthermore, the keyboard data processing module is used to independently perform USB 1.0 data processing, USB 2.0 data processing, and PS2 data processing, specifically including parsing the messages triggered by the keys, converting protocols with external window systems, and reporting information.

[0014] According to a second aspect of the present invention, an adaptive method for a keyboard protocol adaptive system for embedded graphics, as described above, is also provided, comprising the following steps:

[0015] Step S1: The keyboard initialization module sets the initial information of the multi-protocol keyboard devices, performs a multi-keyboard device traversal and opening operation, and creates keyboard data tasks based on the aforementioned keyboard device traversal and opening results.

[0016] Step S2: The keyboard data distribution processing module identifies and determines the keyboard device information from which the message data originates, and performs corresponding task distribution processing.

[0017] Step S3: The keyboard data processing module parses the messages of the trigger keys of keyboard devices with different protocols, converts the protocol encoding format of the external window system, and reports the converted code value information. The different protocol keyboard devices include USB 2.0 protocol keyboard devices, PS2 protocol keyboard data processing module and USB 1.0 protocol keyboard devices.

[0018] Furthermore, step S1 specifically includes the following steps:

[0019] Step S101: Obtain keyboard device parameters and initialize keyboard device variables and message structures.

[0020] Step S102: Obtain the priority of the graphics task to determine the priority of subsequent keyboard data processing tasks.

[0021] Step S103: Perform keyboard device traversal and opening operations, sequentially judge the preset information of USB1.0, USB2.0, and PS2 keyboard devices and perform the corresponding device opening operations to obtain device access permissions, and determine the currently mounted and registered keyboard devices based on the returned results, and set the mode and assign device ID values.

[0022] Step S104: Create a keyboard data receiving and processing task that includes both USB and PS2 keyboard device descriptor parameters, and set the corresponding task priority, stack parameters, and task entry point to listen for and process keyboard information.

[0023] Furthermore, step S2 specifically includes the following steps:

[0024] Step S201: First, set the timeout and clear the set of file descriptors. Then, use the select mechanism to listen for and wait for keyboard input.

[0025] Step S202: Set the USB file descriptor or PS2 file descriptor and the device handle abort flag as the loop condition, and enter the conditional loop processing.

[0026] Step S203: Determine the USB keyboard descriptor and PS2 keyboard descriptor. If a descriptor meets the conditions, add it to the new file descriptor set.

[0027] Step S204: Use the select function to monitor and wait for the file descriptor status, and determine whether the file descriptor that triggered the key press is a PS2 or USB file based on the file descriptor status.

[0028] If it's a PS2, then it enters the PS2 keyboard data processing flow.

[0029] If it is a USB device, the system determines whether it is a USB 1.0 device or a USB 2.0 device based on the current keyboard handle device ID, and then enters the corresponding USB keyboard data processing flow.

[0030] Furthermore, step S3 specifically includes the following steps:

[0031] Step S301: Determine the source of the keyboard message information.

[0032] Step S302: When keyboard message information comes from both USB 1.0 and USB 2.0 keyboard devices, the process enters USB keyboard data processing. It reads the USB device descriptor to obtain the data message, checks the message's validity, performs keycode filtering and recognition, then performs keyboard message mapping to convert the raw message code into a code value recognizable by the graphical window system. Finally, it returns and reports back to the graphical window system.

[0033] When keyboard message information comes from the PS2 keyboard device, it enters the PS2 mouse data processing stage. The PS2 device descriptor is read using standard IOCTL functions to obtain the data message, the validity of the message is checked, and then it is unpacked, and keyboard message mapping and key code value conversion are performed before finally being reported to the graphical window system.

[0034] In summary, compared with the prior art, the above-described technical solutions conceived by this invention have the following advantages:

[0035] Beneficial effects:

[0036] This invention provides a keyboard protocol adaptive implementation system and method for embedded graphics, which realizes adaptive support for USB 1.0, USB 2.0 and PS2 protocol type keyboard devices in domestic embedded graphics systems, and improves the information processing capability and adaptive support capability of domestic embedded graphics systems for multiple keyboard devices. Attached Figure Description

[0037] Figure 1 A schematic diagram of the overall architecture of the keyboard multi-protocol adaptive system according to an embodiment of the present invention;

[0038] Figure 2 A schematic diagram illustrating the design principle of the keyboard multi-protocol adaptive implementation system and method according to an embodiment of the present invention;

[0039] Figure 3 A flowchart illustrating the operation of the keyboard initialization module in an embodiment of the present invention;

[0040] Figure 4 A flowchart illustrating the workflow of the keyboard distribution processing module in this embodiment of the invention;

[0041] Figure 5 A flowchart illustrating the operation of the keyboard data processing module in this embodiment of the invention. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0043] Figure 1 This is a schematic diagram of the overall architecture of the keyboard multi-protocol adaptive system according to an embodiment of the present invention. As shown in the figure, a keyboard protocol adaptive system for embedded graphics includes an application layer, a graphics system layer, a plug-in layer, a driver layer, and a hardware layer. The hardware layer is connected to the driver layer, and they can transmit information in one direction. The driver layer is connected to the plug-in layer, and they can transmit information in one direction. The plug-in layer is connected to the graphics system layer, and they can transmit information in two directions. The graphics system layer is connected to the application layer, and they can transmit information in one direction. The driver layer includes a USB 1.0 / 2.0 keyboard device driver module and a PS / 2 keyboard device driver module that are independently configured. The plug-in layer includes a keyboard multi-protocol adaptive processing module, and the graphics system layer includes a keyboard event processing module. The USB 1.0 / 2.0 keyboard device driver module provides device initialization and driver support for USB keyboard devices; the PS2 keyboard device driver module provides device initialization and driver support for PS2 keyboard devices; the keyboard multi-protocol adaptive processing module provides adaptive message data reception, distribution, conversion processing, and keyboard event reporting support for USB 1.0, USB 2.0, and PS2 protocol keyboard devices in the graphics system; and the keyboard event processing module is used for receiving and classifying keyboard events within the graphics window system.

[0044] The keyboard multi-protocol adaptive processing module includes a keyboard initialization module, a keyboard data distribution processing module, and a keyboard data processing module. The keyboard initialization module is connected to the keyboard data distribution processing module and is used for the initial setting of the required variables and message structures of the keyboard device, the traversal and opening of the device, and the creation of keyboard data processing tasks. The keyboard data distribution processing module is used to identify and determine the source keyboard device information of the message data and to distribute the corresponding tasks. The keyboard data distribution processing module is connected to the keyboard data processing module and is located in the keyboard data processing task. Its main functions are to identify and determine the source keyboard device information of the message data and to distribute the tasks.

[0045] Specifically, the keyboard initialization module is used for setting initial information for multi-protocol keyboard devices, as well as for iterating through keyboard device opening operations and creating keyboard processing tasks based on the iteration results. That is, the keyboard initialization module mainly completes the initial settings of the required variables and message structures for the keyboard device, iterates through and opens the device, and creates keyboard data processing tasks. The keyboard data processing module is used independently for USB 1.0 data processing, USB 2.0 data processing, and PS / 2 data processing. Located within the keyboard data processing task, the keyboard data processing module is the specific execution module after keyboard information distribution, mainly performing message parsing for triggered keys, protocol conversion with the window system, and information reporting.

[0046] In this invention, the connection relationships between the keyboard initialization configuration module, the keyboard information distribution processing module, and the keyboard data processing module are as follows: Figure 2 As shown. Figure 2 This is a schematic diagram illustrating the design principle of the keyboard multi-protocol adaptive implementation system and method according to an embodiment of the present invention. Figure 2 The paper compares the keyboard data processing methods and related systems before and after the improvement. Compared with existing keyboard data processing methods, the keyboard data processing method of the present invention is mainly reflected in three steps, as follows:

[0047] Step S1: Initialization of the keyboard multi-protocol adaptive processing module plugin. The keyboard multi-protocol adaptive processing module is an improved design of the keyboard device initialization module of the graphics system keyboard plugin. It changes the initial setting of a single keyboard device to the initial information setting of multiple protocol keyboard devices, changes the operation of opening a single keyboard device to obtain device control to the traversal opening of multiple keyboard devices, and changes the creation of data tasks for a single keyboard device to the creation of keyboard data tasks based on the aforementioned keyboard device traversal opening results.

[0048] Step S2: The keyboard data distribution processing module is used for information distribution processing of the keyboard multi-protocol adaptive module. Based on the original keyboard plug-in design of the graphics system, a keyboard device information distribution processing module is added to adapt to the presence of different keyboard protocol devices. It can identify and determine the source keyboard device information of the message data and perform task distribution processing.

[0049] Step S3: The keyboard data processing module is used for data processing in the keyboard multi-protocol adaptive module. An improved design is made for the keyboard data processing module of the graphics system keyboard plug-in. The original single keyboard device data processing module is expanded to add a USB2.0 protocol keyboard device message data processing module and a PS2 protocol keyboard data processing module to perform message parsing of key triggering of different protocol keyboard devices, conversion of protocol encoding format with the window system, and reporting of information of the converted code value.

[0050] Figure 3 The flowchart of the keyboard initialization module in this embodiment of the invention, combined with... Figure 2 And refer to Figure 3 As shown, this is an implementation method of the keyboard device initialization module according to an embodiment of the present invention. Specifically, it is located in the keyboard plug-in constructor, and mainly completes the initial settings of variables and message structures required by the keyboard device, the traversal and opening of the keyboard device, and the creation of keyboard data processing tasks. Specifically, it includes the following steps:

[0051] Step S101: Obtain preset parameters such as keyboard device name from the preset environment variables of the graphics system through the constructor, and perform initial settings for keyboard device variables and message structures such as protocol flag, task abort flag, task ID, device descriptor, and data message.

[0052] Step S102: Obtain the current graphics task priority through the system task priority acquisition function to determine the priority of the following keyboard data processing task. That is, the priority of the keyboard data processing task is consistent with the priority of the graphics task so as to perform data collaborative processing with the graphics task.

[0053] Step S103: Perform keyboard device traversal and opening operations, sequentially judge the preset information of USB1.0, USB2.0, and PS2 keyboard devices and perform the corresponding device opening operations to obtain device access permissions, and determine the currently mounted and registered keyboard devices based on the returned results, and set the mode and assign device ID values.

[0054] The traversal operation is as follows: First, the USB keyboard device information is checked. If it is set to empty or opening the device fails, it means that this type of device does not exist. Then, the PS2 keyboard device settings are checked. If it is not empty and the USB keyboard device opens successfully, the protocol flag is obtained, and the return value is checked to see if it is 0x47. If the return value is not 0x47, it means that the current operating device is a USB 1.0 device. Then, the USB 1.0 device ID is assigned, the USB keyboard mode is set, and the PS2 keyboard device settings are checked again. If the return value is 0x47, it means that the current operating device is a USB 2.0 device. Then, the USB 2.0 device ID is assigned, the USB keyboard mode is set, and the PS2 keyboard settings are checked again. If the PS2 keyboard is set to empty or opening the PS2 keyboard fails, it means that the PS2 type keyboard device does not exist. If it is not empty and opening the PS2 keyboard device succeeds, it means that this type of device exists. Then, the PS2 keyboard mode is set and the ID is assigned. If all the above device type operations fail, it means that the traversal of keyboard devices has failed, and the process ends directly. Otherwise, it means that a device exists, and the next task is processed.

[0055] Step S104: Create a keyboard data receiving and processing task containing both USB and PS2 keyboard device descriptor parameters through the system task creation function, and set the corresponding task priority, stack parameters, task entry point, etc., to listen for and process keyboard information in the system.

[0056] Figure 4 The flowchart of the keyboard distribution processing module in this embodiment of the invention, combined with... Figure 2 And refer to Figure 4 As shown, the implementation method of the keyboard device information distribution processing module in a specific embodiment of the present invention can be obtained. Located in the keyboard data processing task loop, it mainly identifies and determines the source of the message data (keyboard device information) and distributes the task. The main steps are as follows:

[0057] Step S201: Before listening for keyboard input using the select mechanism, set a timeout and clear the set of file descriptors;

[0058] Step S202: Set the USB file descriptor or PS2 file descriptor and the device handle abort flag as the loop condition, and enter the condition judgment loop process;

[0059] Step S203: Determine the USB keyboard descriptor and PS2 keyboard descriptor. If the descriptor meets the conditions, add the descriptor to the set of file descriptors and determine the descriptor status.

[0060] Step S204: Use the select function to listen to and wait for the file descriptor status, and determine whether the file descriptor that triggered the key information is PS2 or USB based on the file descriptor status. If it is PS2, enter the PS2 keyboard data processing flow. If it is USB, determine whether it is a USB 1.0 device or a USB 2.0 device based on the current keyboard handle device ID, and enter the corresponding USB keyboard data processing flow.

[0061] Figure 5 The flowchart of the keyboard data processing module in this embodiment of the invention, combined with... Figure 2 And refer to Figure 5 As shown, the keyboard data processing module in this embodiment of the invention is used in the keyboard data processing task loop. It is the specific execution module after the keyboard information is distributed. It mainly performs message parsing of the triggered keys, conversion of the protocol encoding format with the window system, and reporting of information such as the converted code value. The main steps are as follows:

[0062] Step S301: Determine the source of the keyboard message information.

[0063] Step S302: When the keyboard message information comes from a USB 1.0 keyboard device, enter the USB keyboard data processing, read the USB device descriptor through the standard IOCTL function to obtain the data message, detect the validity of the message, perform key code filtering and recognition, then perform keyboard message mapping to convert the original message code into a code value that can be recognized by the graphical window system, and finally return and report to the graphical window system.

[0064] If the keyboard message comes from a USB 2.0 keyboard device, the process enters the USB keyboard data processing stage. The USB device descriptor is read using standard IOCTL functions to obtain the data message, the validity of the message is checked, and key code filtering and recognition are performed. Then, keyboard message mapping is performed to convert the original message code into a code value that can be recognized by the graphical window system, and finally, the message is returned and reported to the graphical window system.

[0065] If the keyboard message comes from a PS / 2 keyboard device, it enters the PS / 2 mouse data processing stage. The PS / 2 device descriptor is read using standard IOCTL functions to obtain the data message, the validity of the message is checked, and then after unpacking, keyboard message mapping and key code value conversion, it is reported to the graphical window system.

[0066] This invention provides a keyboard protocol adaptive system for embedded graphics, involving main functional modules including a USB 1.0 / 2.0 keyboard device driver module, a PS / 2 keyboard device driver module, a keyboard multi-protocol adaptive processing module, and a keyboard event processing module. The USB 1.0 / 2.0 keyboard device driver module, PS / 2 keyboard device driver module, and keyboard event processing module are participating modules in the working process. The keyboard multi-protocol adaptive processing module is located at the plug-in layer in the embedded graphics system and exists in the form of a plug-in. The keyboard multi-protocol adaptive processing module includes a keyboard initialization configuration module, a keyboard information distribution processing module, and a keyboard data processing module.

[0067] This invention, through an improved design of the keyboard processing module in the system plug-in layer, achieves adaptive support for USB 1.0, USB 2.0, and PS / 2 protocol keyboard devices in a domestically produced embedded graphics system. This enhances the information processing and adaptive support capabilities of domestically produced embedded graphics systems for multiple keyboard devices. This invention is applicable to the field of embedded human-computer interaction.

[0068] The method provided in this invention has been verified and implemented on domestic software and hardware platforms using Loongson and Phytium processors. The operating system is the Dao OS, and the graphics system is the Qt graphical window system based on a domestic GPU.

[0069] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An adaptive method for a keyboard protocol adaptive system for embedded graphics, characterized in that, The keyboard protocol adaptive system includes an application layer, a graphics system layer, a plug-in layer, a driver layer, and a hardware layer. The hardware layer is connected to the driver layer, and they transmit information in a unidirectional manner. The driver layer is connected to the plug-in layer, and they also transmit information in a unidirectional manner. The plug-in layer is connected to the graphics system layer, and they transmit information in a bidirectional manner. The graphics system layer is connected to the application layer, and they also transmit information in a unidirectional manner. The driver layer includes multiple keyboard device driver modules with different protocols that are configured independently; the plug-in layer includes a keyboard multi-protocol adaptive processing module; and the graphics system layer includes a keyboard event processing module. The keyboard multi-protocol adaptive processing module is used to provide the graphics system with adaptive message data reception, distribution, conversion processing, and keyboard event reporting support for keyboard devices with various protocol types. The keyboard event handling module is used for receiving and classifying keyboard events for both the graphical window system and the keyboard multi-protocol adaptive processing module. The driver layer includes two independently configured driver modules: a USB 1.0 / 2.0 keyboard device driver module and a PS / 2 keyboard device driver module. The USB 1.0 / 2.0 keyboard device driver module provides device initialization and driver support for USB keyboard devices, while the PS / 2 keyboard device driver module provides device initialization and driver support for PS / 2 keyboard devices. The keyboard multi-protocol adaptive processing module is used to provide the graphics system with adaptive message data reception, distribution, conversion processing, and keyboard event reporting support for three types of keyboard devices: USB 1.0, USB 2.0, and PS / 2 protocols. The keyboard multi-protocol adaptive processing module includes a keyboard initialization module, a keyboard data distribution and processing module, and a keyboard data processing module. The keyboard initialization module is connected to the keyboard data distribution and processing module, and the keyboard data distribution and processing module is connected to the keyboard data processing module. The keyboard data distribution and processing module is used to identify and determine the keyboard device information from which the message data originates, and to distribute the corresponding tasks. The keyboard initialization module is used to set initial information for multi-protocol keyboard devices, and also to iterate through keyboard device open operations and create keyboard processing tasks based on the iteration results. The keyboard data processing module is used to independently perform USB 1.0 data processing, USB 2.0 data processing, and PS / 2 data processing. Specifically, it includes parsing trigger key messages, protocol conversion with the window system, and information reporting. It includes the following steps: S1: The keyboard initialization module sets the initial information of the multi-protocol keyboard devices, performs a multi-keyboard device traversal and opening operation, creates keyboard data tasks based on the aforementioned keyboard device traversal and opening results, and also performs message data transmission. S2: The keyboard data distribution and processing module identifies and determines the keyboard device information from which the message data originates, and performs corresponding task distribution processing. S3: The keyboard data processing module parses the trigger key messages of different protocol keyboard devices according to the distribution processing results, converts the protocol encoding format of the window system, and reports the converted code value information. Among them, the different protocol keyboard devices include USB2.0 protocol keyboard devices, PS2 protocol keyboard devices, and USB1.0 protocol keyboard devices.

2. The adaptive method of claim 1, wherein, Step S1 specifically includes the following steps: S101: Obtain keyboard device parameters and initialize keyboard device variables and message structures. S102: Obtain the priority of the graphics task to determine the priority of subsequent keyboard data processing tasks. S103: Perform a keyboard device traversal and opening operation, sequentially judging the preset information of USB1.0, USB2.0, and PS / 2 keyboard devices and performing the corresponding device opening operation to obtain device access permissions. Based on the returned results, determine the currently mounted and registered keyboard devices, and set the mode and assign device ID values. S104: Create a keyboard data receiving and processing task that includes both USB and PS2 keyboard device descriptor parameters, and set the corresponding task priority, stack parameters, and task entry point to listen for and process keyboard information.

3. The adaptive method of claim 2, wherein, Step S2 specifically includes the following steps: S201: First, set a timeout and clear the set of file descriptors, then use the select mechanism to listen for and wait for keyboard input. S202: Set the USB file descriptor or PS2 file descriptor and the device handle abort flag as the loop condition, and enter the conditional loop processing. S203: Perform USB keyboard descriptor and PS2 keyboard descriptor determination. If the descriptor meets the conditions, add the descriptor to the new set of file descriptors and proceed to step S204. If the conditions are not met, proceed to step S202. S204: The select function is used to listen for and wait for the new file descriptor status, and the file descriptor that triggered the key press is determined based on the new file descriptor status as either PS2 or USB. If it's a PS2, then it enters the PS2 keyboard data processing flow. If it is a USB device, the system determines whether it is a USB 1.0 device or a USB 2.0 device based on the current keyboard handle device ID, and then enters the corresponding USB keyboard data processing flow accordingly.

4. The adaptive method of claim 3, wherein, Step S3 specifically includes the following steps: S301: Determine the source of keyboard message information. S302: When keyboard message information comes from both USB 1.0 and USB 2.0 keyboard devices, the process enters USB keyboard data processing, reads the USB device descriptor to obtain the data message, checks the validity of the message, performs key code filtering and recognition, then performs keyboard message mapping to convert the raw message code into a code value that the graphical window system can recognize, and finally returns the result to the graphical window system. The keyboard message information from PS2 keyboard device enters PS2 mouse data processing, reads PS2 device descriptor to obtain data message, detects the validity of the message, then unpacks, carries out keyboard message mapping and key code value conversion, and finally reports to the graphic window system.

Citation Information

Patent Citations

  • Method and device for supporting multiple input devices based on WindML graphic system

    CN112748958A

  • Protocol adaptive identification, cross-platform and standardized software system based on serial port transceiving

    CN114356829A

  • USB storage drive development method in embedding system

    CN1529227A