Serial port device management method, device, equipment and storage medium

Through the configuration program of the first operating system, the serial port devices available in the second operating system are automatically identified and configured, which solves the problem of inconvenience in the use of serial port devices in a multi-operating system environment, realizes automatic identification and configuration, and improves user experience and convenience.

CN119441111BActive Publication Date: 2025-04-11ZHONGKE FANGDE SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510039157.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-10
Publication Date
2025-04-11
Estimated Expiration
2045-01-10

AI Technical Summary

Technical Problem

In a multi-operating system environment, the identification and use of serial port devices are less convenient. The existing technology requires manual writing of underlying code for configuration, which has low user experience and is prone to problems of concern to invalid devices.

Method used

The accessed serial port device is automatically identified through the configuration program of the first operating system, and the target device that can be used by the second operating system, and the second configuration program is called by the compatible application program to automatically configure the device registry to achieve access and use of the target serial port device.

Benefits of technology

It realizes the automated identification and configuration of serial port equipment, reduces human resources dependence, improves convenience and user experience, and avoids attention to invalid devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441111B_ABST
    Figure CN119441111B_ABST
Patent Text Reader

Abstract

The present application provides a serial port device management method, apparatus, electronic device and computer-readable storage medium, which are applied to the field of computer technology, including: identifying a serial port device connected to an electronic device through a first configuration program of a first operating system; identifying a target serial port device that can be used by an application of a second operating system; in response to triggering a configuration control in an interface of the first configuration program, calling a second configuration program of a second operating system running in a compatible application through the first configuration program to configure a device registry of the second operating system provided by the compatible application according to information of the target serial port device; and realizing access and use of the target serial port device in the second operating system through the compatible application based on information in the device registry. The entire configuration process of the present application can be performed automatically by the program, which improves the convenience of identifying and using serial port devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a management method and apparatus for serial port devices, an electronic device, and a computer-readable storage medium. Background Art

[0002] Serial port is a data communication interface. Serial communication is a form of serial communication. Serial devices based on serial communication can only transmit one data bit at a time, but it is simple to implement, low cost, and has a long transmission distance, so it is still very popular in many applications.

[0003] Currently, serial port devices are often inserted into electronic devices for use. Electronic devices can access and use serial port devices in electronic devices through identification and registration operations, so that applications of electronic devices can call serial port devices to implement related functions.

[0004] However, in the current solution, when the electronic device runs in a multi-operating system environment, it is inconvenient to identify and use the serial port device. Summary of the invention

[0005] The embodiments of the present application provide a method and apparatus for managing a serial port device to solve the problems in the prior art.

[0006] In a first aspect, an embodiment of the present application provides a method for managing a serial port device, which is applied to an electronic device running a first operating system, and the method includes:

[0007] Identifying, by a first configuration program of a first operating system, a serial port device connected to the electronic device;

[0008] Identifying, by the first configuration program, a target serial port device that can be used by the application program of the second operating system from among all the serial port devices, and displaying information of the target serial port device in an interface of the first configuration program;

[0009] In response to triggering a configuration control in an interface of the first configuration program, calling, through the first configuration program, a second configuration program of a second operating system running in a compatible application program, so as to configure a device registry of the second operating system provided by the compatible application program according to information of the target serial port device;

[0010] Through the compatible application, based on the information in the device registry, the target serial port device is accessed and used in the second operating system.

[0011] In a second aspect, an embodiment of the present application provides a management device for a serial port device, the device comprising:

[0012] A first identification module, used to identify a serial port device connected to the electronic device through a first configuration program of a first operating system;

[0013] a second identification module, configured to identify, from among all the serial port devices, a target serial port device that can be used by the application program of the second operating system through the first configuration program, and to display information of the target serial port device in an interface of the first configuration program;

[0014] a configuration module, configured to, in response to triggering a configuration control in an interface of the first configuration program, call, through the first configuration program, a second configuration program of a second operating system running in a compatible application program, so as to configure a device registry of the second operating system provided by the compatible application program according to information of the target serial port device;

[0015] The access module is used to access and use the target serial port device in the second operating system based on the information in the device registry through the compatible application.

[0016] In a third aspect, an embodiment of the present application further provides an electronic device, including a processor;

[0017] a memory for storing instructions executable by the processor;

[0018] The processor is configured to execute the instructions to implement the method of the first aspect.

[0019] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to execute the method of the first aspect.

[0020] The embodiment of the present application can automatically identify the serial port device connected to the electronic device through the first configuration program of the first operating system, and identify the target serial port device that can be used by the application of the second operating system. Subsequently, in response to the triggering of the configuration control in the interface of the first configuration program, the device registry provided by the compatible application can be automatically configured according to the information of the target serial port device by calling the second configuration program running in the compatible application, so as to realize the access and use of the target serial port device in the second operating system. In the whole process, the identification of the serial port device and the configuration and use in the second operating system can be realized automatically and accurately. By identifying the target serial port device that can be used by the application of the second operating system, the second operating system avoids paying attention to invalid devices. In addition, the whole process can be performed automatically by the program, which reduces the dependence on human resources, improves the convenience of identifying and using serial port devices, and improves the user experience.

[0021] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 It is an implementation scenario diagram provided by an embodiment of the present application;

[0024] Figure 2 It is a flowchart of the steps of a serial port device management method provided by an embodiment of the present application;

[0025] Figure 3 It is a flowchart of the specific steps of a serial port device management method provided in an embodiment of the present application;

[0026] Figure 4 This is an interface diagram of a serial port device management method provided in an embodiment of the present application;

[0027] Figure 5 It is an execution flow chart of a serial port device management method provided in an embodiment of the present application;

[0028] Figure 6 It is a block diagram of a management device for a serial port device provided in an embodiment of the present application;

[0029] Figure 7 is a block diagram of an apparatus of the present application;

[0030] Figure 8 It is a schematic diagram of the structure of the server in some embodiments of the present application. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0032] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally a class, and the number of objects is not limited. For example, the first object can be one or more. In addition, the term "and / or" in the specification and claims is used to describe the association relationship of associated objects, indicating that three kinds of relationships can exist, for example, A and / or B can be represented: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the front and back associated objects are a kind of "or" relationship. In the embodiment of the present application, the term "multiple" refers to two or more, and other quantifiers are similar.

[0033] Reference Figure 1 , Figure 1 It is an implementation scenario diagram provided in an embodiment of the present application, including: an electronic device 10 and a serial port device 20.

[0034] The electronic device 10 runs a first operating system, and the serial port device 20 stores a driver of a second operating system; the serial port device 20 can be inserted into the electronic device 10 for use. The compatible application is used to run the application of the second operating system in the electronic device 10. For example, the serial port device can be a serial port mouse, a serial port keyboard, a serial port camera, a serial port card reader, and other devices.

[0035] In the related art, since the serial port device is directly inserted into the electronic device of the first operating system, and the serial port device is often used by the second operating system application in the second operating system container of the electronic device, the related art usually adopts the method of manually writing the underlying code to complete the configuration of the serial port device in the second operating system. The user needs to manually check the serial port and change the serial port settings every time the second operating system container is started, which makes the identification and use of the serial port device extremely inconvenient, resulting in a decrease in user experience. In addition, the related art will treat all the identified devices as serial port devices for use by the second operating system, without distinguishing whether there are invalid devices among them, resulting in the inability to accurately match the corresponding valid serial port devices in the second operating system container. Among them, the second operating system container is provided by a compatible application in the electronic device.

[0036] In order to solve the above problems, the embodiment of the present application can install a compatible application in an electronic device, automatically identify the serial port device connected to the electronic device through the first configuration program of the first operating system, and identify the target serial port device that can be used by the application of the second operating system. Subsequently, in response to the triggering of the configuration control in the interface of the first configuration program, the device registry provided by the compatible application can be automatically configured according to the information of the target serial port device by calling the second configuration program running in the compatible application, so as to realize the access and use of the target serial port device in the second operating system. In the whole process, the identification of the serial port device and the configuration and use in the second operating system can be realized automatically and accurately. By identifying the target serial port device that can be used by the application of the second operating system, the second operating system avoids paying attention to invalid devices. In addition, the whole process can be automated by the program, which reduces the dependence on human resources, improves the convenience of identifying and using serial port devices, and enhances the user experience.

[0037] Figure 2 , is a flowchart of a method for managing a serial port device provided in an embodiment of the present application, which is applied to an electronic device running a first operating system, such as Figure 2 As shown, the method may include:

[0038] Step 101: Identify a serial port device connected to the electronic device through a first configuration program of a first operating system.

[0039] In the embodiments of the present application, a serial port is a data communication interface, also known as a serial interface or a serial communication interface. Serial communication is a form of serial communication, which means that data is transmitted in bit order, and each bit of data takes a fixed length of time. Compared with parallel communication, serial communication can only transmit one data bit at a time, but it is simple to implement, low cost, and has a long transmission distance, so it is still very popular in many applications. A serial port device is a device that supports serial port communication, such as a serial port mouse, a serial port keyboard, a serial port camera, a serial port card reader and other devices.

[0040] In addition, the electronic device of the embodiment of the present application supports running compatible applications in the first operating system. The compatible application is used to provide a second operating system container. The application of the second operating system can run in the second operating system container, thereby achieving the purpose of compatible running of the application of the second operating system in the electronic device of the first operating system.

[0041] In computer operating systems, communication ports (COM) usually refer to the interface for serial communication, i.e., serial ports. In Windows systems, serial ports are managed by the Windows operating system and are used to communicate with serial devices. Users can view and configure serial ports through the device manager.

[0042] In an embodiment of the present application, in actual applications, there are usually multiple serial port devices (such as a mouse, a keyboard, etc.) inserted into an electronic device. In order to identify the inserted serial port device in the first operating system of the electronic device, it is first necessary to identify the serial port device connected to the electronic device through a first configuration program of the first operating system in the electronic device, and then filter out invalid serial port devices from the identified serial port devices before implementing an identification and registration mechanism based on valid serial port devices in the second operating system.

[0043] In the embodiment of the present application, the first configuration program can use the libudev interface function (when the first operating system is a Linux system) to identify the local serial port device of the first operating system. The function is to detect whether there are files in the three paths " / dev / ttyS*, / dev / ttyUSB*, / dev / ttyACM*" in the first operating system, and identify the existing files as files of the serial port device, thereby realizing the identification of the serial port device.

[0044] Step 102: Identify, through the first configuration program, a target serial port device that can be used by the application program of the second operating system from among all the serial port devices, and display information of the target serial port device in an interface of the first configuration program.

[0045] In the embodiment of the present application, there may be invalid devices among the serial port devices identified by the first configuration program in the first operating system. For example, some serial port devices are actually virtual devices of the first operating system, which are invalid devices. These invalid devices cannot be called and used by the application program in the second operating system, so these invalid devices need to be filtered so that the remaining serial port devices are used as target serial port devices (i.e., valid devices).

[0046] For example, you can detect whether there are files in the three paths " / dev / ttyS*, / dev / ttyUSB*, / dev / ttyACM*" in the first operating system (Linux), and identify the existing files as files of serial port devices. Assuming that 33 files are identified, it is determined that 33 serial port devices are detected in the first operating system:

[0047] # ls / dev / ttyS* / dev / ttyUSB* / dev / ttyACM*

[0048] / dev / ttyS0 / dev / ttyS15 / dev / ttyS21 / dev / ttyS28 / dev / ttyS6

[0049] / dev / ttyS1 / dev / ttyS16 / dev / ttyS22 / dev / ttyS29 / dev / ttyS7

[0050] / dev / ttyS10 / dev / ttyS17 / dev / ttyS23 / dev / ttyS3 / dev / ttyS8

[0051] / dev / ttyS11 / dev / ttyS18 / dev / ttyS24 / dev / ttyS30 / dev / ttyS9

[0052] / dev / ttyS12 / dev / ttyS19 / dev / ttyS25 / dev / ttyS31 / dev / ttyUSB0

[0053] / dev / ttyS13 / dev / ttyS2 / dev / ttyS26 / dev / ttyS4

[0054] / dev / ttyS14 / dev / ttyS20 / dev / ttyS27 / dev / ttyS5

[0055] However, among these 33 serial port devices, there are actually only 3 valid devices. In the related technology, when the serial port debugging tool of the second operating system is started in the compatible application, it will be displayed that there are 33 serial ports, and when the serial port debugging tool of the first operating system is started, it will be displayed that there are 3 serial ports. In this way, it can be determined that there are actually only 3 valid devices. However, the serial port debugging tool of the second operating system in the related technology displays 33 serial ports, which will make it difficult to accurately find 3 valid devices when using serial port devices in the second operating system.

[0056] To solve this problem, the embodiment of the present application can identify the target serial port device (i.e., valid device) available for use by the application program of the second operating system from all serial port devices through the first configuration program, and display the information of the target serial port device in the interface of the first configuration program.

[0057] Specifically, the embodiment of the present application can filter out invalid devices (such as virtual devices) from all serial port devices through filtering rules, so that the remaining serial port devices are used as valid target serial port devices, and the configuration operation in the second operating system can be performed based on the target serial port devices, so that when the serial port devices are used in the second operating system, the valid devices can be accurately located. In addition, the embodiment of the present application can also provide a related visual debugging interface, and display the information of the target serial port device in the interface, so that the user can have an intuitive perception of the identification of valid devices.

[0058] Step 103: In response to triggering a configuration control in the interface of the first configuration program, the first configuration program calls a second configuration program of the second operating system running in the compatible application to configure a device registry of the second operating system provided by the compatible application according to information of the target serial port device.

[0059] In an embodiment of the present application, since the compatible application realizes the simulation of the second operating system container environment in the electronic device of the first operating system through the interface and dynamic link library and other related files of the simulated second operating system, the second configuration program of the second operating system can be run in the compatible application. The second configuration program can respond to the call of the first configuration program and execute the operation of configuring the device registry of the second operating system provided by the compatible application according to the information of the target serial port device, thereby completing the effective registration of the target serial port device in the second operating system. Among them, the specific device registry configuration operation may include: adding a new target serial port device, deleting an existing target serial port device, querying an existing target serial port device, etc. Based on the information of the target serial port device, a registry information can be constructed and stored in the device registry. The registry information may include the port number of the serial port assigned to the target serial port device, the device file path of the target serial port device, etc.

[0060] The compatible application is a compatibility layer that can run a second operating system (such as Windows operating system) application on a variety of first operating systems (such as Linux, Mac OS, Berkeley Software Distribution (BSD)), etc. Preferably, the first operating system can be a Linux system, and the second operating system can be a Windows system.

[0061] Specifically, the compatible application may be a Wine (Wine Is Not an Emulator) application, which can run Windows applications on a variety of first operating systems (such as Linux, macOS, and BSD, etc.). Wine does not imitate the internal Windows logic like a virtual machine or emulator, but translates Windows interface calls into dynamic first operating system calls, eliminating performance and other memory usage of some behaviors, so that Windows applications can be cleanly integrated and run on user devices of the first operating system.

[0062] Furthermore, when the compatible application is started for the first time, a connection can be established between the compatible application and the program of the first operating system, that is, through the compatible application, the first docking interface provided by the first operating system is replaced with a second docking interface corresponding to the second operating system simulated by the compatible application. Since the compatible application simulates the program of the second operating system, and the electronic device runs the first operating system, it is necessary to set the second docking interface between the program of the first operating system and the compatible application due to the difference between the two operating systems. The data conversion method of the first operating system and the second operating system can be defined in the second docking interface, thereby playing the role of data format conversion.

[0063] In addition, the first configuration program of the embodiment of the present application can also provide a related visual debugging interface. The debugging interface has a configuration control that supports human-computer interaction functions. When receiving a trigger for the configuration control, the second configuration program can be called through the first configuration program to configure the device registry of the second operating system provided to the compatible application according to the information of the target serial port device. Through the interface configuration operation, the user's personalized configuration of the device registry of the second operating system is satisfied, and the user only needs to trigger the corresponding configuration control to automatically complete the corresponding configuration operation in the background, without the user having to complete the configuration by modifying the underlying code, which reduces the difficulty of configuration and improves configuration efficiency.

[0064] Step 104: Access and use of the target serial port device in the second operating system is achieved through the compatible application based on the information in the device registry.

[0065] In the embodiment of the present application, after completing the configuration of the device registry of the second operating system based on the identified target serial port device, since the client program of the second operating system can also be run in the compatible application, the client program can be a program that has a use requirement for the serial port device, such as a program that uses a mouse serial port device. Then the client program can realize the access and use of the target serial port device in the second operating system based on the information in the device registry.

[0066] In summary, the embodiment of the present application automatically identifies the serial port device connected to the electronic device through the first configuration program of the first operating system, and identifies the target serial port device that can be used by the application of the second operating system. Subsequently, in response to the triggering of the configuration control in the interface of the first configuration program, the device registry provided by the compatible application can be automatically configured according to the information of the target serial port device by calling the second configuration program running in the compatible application, so as to achieve the access and use of the target serial port device in the second operating system. In the whole process, the identification of the serial port device and the configuration and use in the second operating system can be realized automatically and accurately. By identifying the target serial port device that can be used by the application of the second operating system, the second operating system avoids paying attention to invalid devices. In addition, the whole process can be performed automatically by the program, which reduces the dependence on human resources, improves the convenience of identifying and using serial port devices, and enhances the user experience.

[0067] Figure 3 is a flowchart of the specific steps of a serial port device management method provided by an embodiment of the present application, such as Figure 3 As shown, the method may include:

[0068] Step 201: Identify a serial port device connected to the electronic device through a first configuration program of a first operating system.

[0069] Optionally, the first operating system is a Linux operating system, and the second operating system is a Windows operating system.

[0070] This step may specifically refer to the above step 101, which will not be described in detail here.

[0071] Step 202: Select a first serial port device of a first target category from all the serial port devices, where the first target category is a TTY category.

[0072] Step 203: Delete invalid first serial port devices of a second target category from all the first serial port devices; the second target category is the 8250 category.

[0073] Step 204: Select a first serial port device of a third target category from the remaining first serial port devices as the target serial port device.

[0074] In the embodiment of the present application, for steps 202-204, the first configuration program identifies a valid target serial port device from all serial port devices. Specifically, the first configuration program can first call the udev interface (called when the first operating system is Linux) to enumerate all first serial port devices in the system that belong to the first target category (teletype device category, TTY, Teletype). In the Linux operating system, the TTY category is a terminal device category for connecting to a computer. TTY is a traditional way for users to interact with computers in the Linux operating system. It allows users to enter text commands on the screen and view output results.

[0075] Specifically, the embodiment of the present application can identify the TTY subsystem of the first operating system through the udev interface, and use all devices in the TTY subsystem as the first serial port devices. Afterwards, the first configuration program can delete invalid first serial port devices of the second target category from all the first serial port devices; the second target category is the 8250 category; filtering out invalid first serial port devices of the 8250 type can avoid subsequent interference caused by these devices.

[0076] Finally, a first serial port device of a third target category may be selected from the remaining first serial port devices as a target serial port device. The third target category includes tnt, ttyGS, and rfcomm.

[0077] Step 205: In the interface of the first configuration program, display the correspondence between the target port name of the target serial port device and the target device file path.

[0078] The target port name is: the name of the serial port assigned when the target serial port device is added to the device registry.

[0079] In an embodiment of the present application, for example, when a target port device is registered in the device registry, a serial port can be assigned to it, and the serial port has a corresponding target port name (port number), such as COM1. In addition, the target port device also has a corresponding target device file path. The main purpose of the target device file path is to allow an application (such as an operating system loader) to determine the target serial port device connected to the serial interface. The target device file path is intended to maximize the use of the name space. The design of the target device file path enables the operating system loader and the operating system to determine which devices the platform firmware is using as boot devices.

[0080] In the embodiment of the present application, the port names and device file paths of different serial port devices are different, and the device file path can be used to specifically locate the device of the serial port device. The first configuration program of the embodiment of the present application can display the correspondence between the target port name of the target serial port device and the target device file path in the interface. This allows the user to perceive the target serial port device that can currently access the second operating system container, and can specifically locate the device of the serial port device through the target device file path information of the target serial port device.

[0081] For example, for a target serial port device, the corresponding relationship between COM1 and dev / ttyS1 can be displayed in the interface, where COM1 is the target port name of the target serial port device, and dev / ttyS1 is the target device file path of the target serial port device.

[0082] Step 206: In response to triggering the configuration control in the interface of the first configuration program, the first configuration program calls a second configuration program of the second operating system running in the compatible application to configure the device registry of the second operating system provided by the compatible application according to the information of the target serial port device.

[0083] This step may be specifically referred to as the above step 103, which will not be described in detail here.

[0084] Optionally, step 206 may specifically include sub-steps 2061-2062:

[0085] Sub-step 2061: in response to triggering an add control in the interface of the first configuration program, displaying a list including information of target serial port devices through the first configuration program, and selecting at least one target serial port device from the list according to input into the list.

[0086] Sub-step 2062: calling the second configuration program through the first configuration program to add the information of the selected target serial port device into the device registration table.

[0087] In the embodiment of the present application, for sub-steps 2061-2062, the first configuration program of the embodiment of the present application can also provide a related visual debugging interface, which has configuration controls that support human-computer interaction functions, such as Figure 4 As shown, the interface of the first configuration program [1] displays a query control, an add control, and a delete control. When the query control, the add control, and the delete control are triggered respectively, the second configuration program [2] is used for corresponding query operations, add operations, and delete operations.

[0088] Specifically, for adding controls, the purpose is to register a new target serial port device in the device registry of the second operating system provided by the compatible application. In response to triggering the adding control in the interface of the first configuration program, a list including information of the target serial port devices can be displayed through the first configuration program, and based on the input of the list, at least one target serial port device can be selected from the list, and the selected target serial port device is the device that needs to be registered in the device registry.

[0089] After selecting the target serial port device, the second configuration program can be called through the first configuration program to add the information of the selected target serial port device to the device registry. The target serial port device registered in the device registry can subsequently be connected to the second operating system container and used by the application of the second operating system.

[0090] Optionally, the information of the target serial port device includes: the port number of the target serial port allocated to the target serial port device, the data type of the information of the target serial port device, and the target device file path of the target serial port device; sub-step 2062 may specifically include sub-steps 20621-20622:

[0091] Sub-step 20621: construct the correspondence between the port number of the selected target serial port device, the data type, and the target device file path into a piece of information in the device registration table.

[0092] Sub-step 20622: Add the constructed information to the device registry.

[0093] The port number in the constructed information is obtained by incrementing the port number in the last piece of information stored in the device registration table.

[0094] In the embodiment of the present application, for sub-steps 20621-20622, the information of the target serial port device includes: the port number of the target serial port assigned to the target serial port device, the data type of the information of the target serial port device, and the target device file path of the target serial port device.

[0095] For example, for a target serial port device, when it is registered in the device registry, the user can trigger the addition control and assign it a serial port with the port name COM1. The target device file path of the target serial port device is "dev\":\" / dev / ttyS1\", and the data type of the information added to the device registry during registration is "REG_SZ" (string type). For the target serial port device, the information constructed for adding to the device registry can be: "COM1——REG_SZ—dev\":\" / dev / ttyS1\".

[0096] Among them, for the above example, in response to adding a control, the parameter passed by the first configuration program to the second configuration program can be "B.exe add "{\"coms\":[{\"name\":\"COM1\",\"dev\":\" / dev / ttyS1\"}]}", which means notifying the second configuration program to add a target serial port device with a device file path of " / dev / ttyS1\" in the device registry.

[0097] It should be noted that the port names in the information of each target serial port device that already exists in the device registry are sorted in ascending order (the earlier the serial port device is added to the device registry, the larger the serial number of the port name). For example, the port name assigned to the first target serial port device added to the device registry can be "COM0", the port name assigned to the second target serial port device added to the device registry can be "COM1", and the port name assigned to the third target serial port device added to the device registry can be "COM2"...

[0098] For the currently added target serial port device, the port name assigned to it can be obtained by incrementing the port number in the previous information stored in the device registry. For example, when the port name assigned to the previous target serial port device added to the device registry is "COM2", the port name assigned to the next target serial port device added to the device registry is "COM3".

[0099] Of course, the port names in the device registry may not be sorted in ascending order, for example, the port names in the device registry may be sorted in descending order (the earlier the serial port device is added to the device registry, the smaller the serial number of the port name), which is not elaborated in the embodiments of the present application.

[0100] Optionally, step 206 may specifically include sub-steps 2063-2064:

[0101] Sub-step 2063: in response to triggering the delete control in the interface of the first configuration program, displaying the device registry through the first configuration program, and calling the second configuration program through the first configuration program based on the input of the device registry to select information of at least one target serial port device from the device registry for deletion.

[0102] Specifically, with respect to the deletion control, the purpose of which is to delete the registered target serial port device in the device registry of the second operating system provided by the compatible application, in response to triggering the deletion control in the interface of the first configuration program, the device registry can be displayed through the first configuration program, and based on the input to the device registry, at least one target serial port device can be selected from the device registry, and the selected target serial port device is the device that needs to be deleted from the device registry.

[0103] After the deletion control is provided, the user can delete the target serial port device that is not needed by the second operating system container according to actual needs, thereby realizing convenient management of the target serial port device.

[0104] For an example, in response to deleting a control, the parameter passed by the first configuration program to the second configuration program may be "B.exe del "{\"coms\":[{\"name\":\"COM1\",\"dev\":\" / dev / ttyUSB0\"}]}")", which indicates that the second configuration program is notified to delete the target serial port device with a port name of "COM1" from the device registry.

[0105] Sub-step 2064: in response to triggering a query control in the interface of the first configuration program, displaying the information in the device registration table through the first configuration program.

[0106] Specifically, the purpose of the query control is to display the information in the device registry. After the query control is provided, the user can view the current registration status in the device registry according to actual needs, thereby realizing convenient management of the target serial port device.

[0107] For an example, in response to the query control, the parameter passed by the first configuration program to the second configuration program may be "B.exe search", which indicates notifying the second configuration program to return the information recorded in the device registry for display on the interface of the first configuration program.

[0108] Step 207: Using the compatible application and based on the information in the device registry, access and use of the target serial port device in the second operating system are achieved.

[0109] This step may be specifically referred to as the above step 104, which will not be described in detail here.

[0110] Optionally, the method may further include:

[0111] Step 208: When the compatible application is started, the compatible application identifies the content in the device registration table to obtain an identification result.

[0112] Step 209: If the identification result is that the device registry contains information configured by the second configuration program, the target serial port device is connected to the second operating system for use through the compatible application according to the target device file path and target serial port of the target serial port device recorded in the device registry.

[0113] In the embodiment of the present application, for steps 208-209, when the compatible application is started, it is necessary to automatically start the management and configuration of the device registry, that is, when the compatible application is started, the content in the device registry is first identified by the compatible application to obtain an identification result. If the identification result is that the device registry contains information previously configured by the second configuration program, the target serial port device can be directly connected to the second operating system through the compatible application according to the target device file path and target serial port of the target serial port device recorded in the device registry, so as to be used by the application in the second operating system container.

[0114] The device registry can be stored in the "HKEY_LOCAL_MACHINE\Software\Wine\Ports" path.

[0115] Optionally, step 209 may specifically include sub-steps 2091-2092:

[0116] Sub-step 2091: When verifying the existence of the target serial port device recorded in the device registry according to the target device file path, connect the target serial port device to the second operating system for use through the compatible application according to the target device file path and the target serial port. Connect the target serial port device to the second operating system for use through the compatible application according to the target device file path and the target serial port.

[0117] Sub-step 2092: When it is verified according to the target device file path that the target serial port device recorded in the device registry does not exist, feedback device non-existence information to the first configuration program through the compatible application program to display the device non-existence information in the interface of the first configuration program.

[0118] In an embodiment of the present application, for sub-steps 2091-2092, in the process of the compatible application connecting the target serial port device to the second operating system, it is possible to first verify whether the corresponding target serial port device recorded in the device registry exists based on the target device file path; if it exists, then based on the target device file path and the target serial port, the target serial port device is connected to the second operating system for use through the compatible application; if it does not exist, then the compatible application feeds back the device non-existence information to the first configuration program for display.

[0119] Specifically, verifying whether the corresponding target serial port device recorded in the device registry exists according to the target device file path can be achieved by executing the target device file path through a function; if the corresponding target serial port device can operate normally after executing the target device file path, it is determined that the corresponding target serial port device recorded in the device registry exists; if the corresponding target serial port device cannot operate normally after executing the target device file path, it is determined that the corresponding target serial port device recorded in the device registry does not exist.

[0120] Optionally, the method may further include:

[0121] Step 210: If the identification result is that the information configured by the second configuration program does not exist in the device registry, the information of all the target serial port devices is added to the device registration through the second configuration program, or the information of all serial port devices connected to the electronic device is added to the device registry through the second configuration program.

[0122] In an embodiment of the present application, if the identification result is that the information configured by the second configuration program does not exist in the device registration table, the second configuration program can implement an automated configuration process, that is, add the information of all target serial port devices identified by the first configuration program to the device registration.

[0123] In addition, if the identification result is that the information configured by the second configuration program does not exist in the device registry, the information of all serial port devices connected to the electronic device can also be added to the device registry through the second configuration program. It should be noted that this will cause invalid devices to exist in the serial port devices connected to the second operating system, thereby increasing the cost of screening and analyzing valid devices.

[0124] Optionally, the method may further include:

[0125] Step 211: When it is detected that the information of the target serial port device changes due to a device plug-in or plug-out operation, the first configuration program calls the second configuration program to delete old information of the target serial port device in the device registration table.

[0126] Step 212: Add the changed new information of the target serial port device to the device registration table through the second configuration program.

[0127] In an embodiment of the present application, for steps 211-212, when it is detected that the information of the target serial port device in the device registry has changed due to the device plug-in and unplug operation, it is necessary to update the content of the device registry, that is, to delete the old information of the target serial port device in the device registry, and add the new information of the target serial port device after the change to the device registry. It should be noted that when adding the new information of the target serial port device after the change to the device registry, the port number in the new information of the target serial port device after the change is the reallocated port number. For example, before adding the new information of the target serial port device after the change to the device registry, if the port number of the last added target serial port device is COM6, the port number in the new information of the target serial port device after the change currently added is COM7.

[0128] Regarding steps 208-210, during the process of starting the compatible application, the following operations may be performed: Figure 5 The process shown includes:

[0129] S1. Launch a compatible application.

[0130] S2. Determine whether there is information configured by the second configuration program in the device registration table.

[0131] If it does not exist, then execute S3 and configure according to the default rule, that is, execute the operation of the above step 210.

[0132] If it exists, then S4 is executed to perform serial port mapping according to the configured information, that is, verify whether the corresponding target serial port device recorded in the device registry exists according to the target device file path.

[0133] S5. Determine whether the target serial port device exists according to the mapping result.

[0134] If so, execute S6 to connect the target serial port device to the second operating system.

[0135] If it does not exist, execute S7 and prompt that the target serial port device does not exist.

[0136] In summary, the embodiment of the present application automatically identifies the serial port device connected to the electronic device through the first configuration program of the first operating system, and identifies the target serial port device that can be used by the application of the second operating system. Subsequently, in response to the triggering of the configuration control in the interface of the first configuration program, the device registry provided by the compatible application can be automatically configured according to the information of the target serial port device by calling the second configuration program running in the compatible application, so as to access and use the target serial port device in the second operating system. In the whole process, the identification of the serial port device and the configuration and use in the second operating system can be realized automatically and accurately. By identifying the target serial port device that can be used by the application of the second operating system, the second operating system avoids paying attention to invalid devices. In addition, the whole process can be carried out automatically by the program, which reduces the dependence on human resources, improves the convenience of identifying and using serial port devices, and enhances the user experience.

[0137] Figure 6 : is a block diagram of a serial port device management device provided in an embodiment of the present application, the device is applied to an electronic device running a first operating system, and the device includes:

[0138] A first identification module 301, used to identify a serial port device connected to the electronic device through a first configuration program of a first operating system;

[0139] A second identification module 302 is used to identify a target serial port device that can be used by the application program of the second operating system from all the serial port devices through the first configuration program, and display information of the target serial port device in the interface of the first configuration program;

[0140] A configuration module 303 is configured to, in response to triggering a configuration control in an interface of the first configuration program, call a second configuration program of a second operating system running in a compatible application through the first configuration program to configure a device registry of the second operating system provided by the compatible application according to information of the target serial port device;

[0141] The access module 304 is used to access and use the target serial port device in the second operating system based on the information in the device registry through the compatible application.

[0142] Optionally, the device further comprises:

[0143] A startup module, used for identifying the content in the device registry through the compatible application when the compatible application is started, to obtain an identification result;

[0144] A processing module is used to connect the target serial port device to the second operating system for use through the compatible application according to the target device file path and target serial port of the target serial port device recorded in the device registry if the identification result is that the device registry contains information configured by the second configuration program.

[0145] Optionally, the device further comprises:

[0146] A default processing module is used to add the information of all the target serial port devices to the device registration through the second configuration program if the identification result is that the information configured by the second configuration program does not exist in the device registration table, or to add the information of all serial port devices connected to the electronic device to the device registration table through the second configuration program.

[0147] Optionally, the access module 304 includes:

[0148] an access submodule, for accessing the target serial port device recorded in the device registry to use the target serial port device according to the target device file path and the target serial port through the compatible application program, when the target serial port device exists according to the target device file path;

[0149] The device also includes:

[0150] A display module is used to feedback device non-existence information to the first configuration program through the compatible application program when the target serial port device recorded in the device registry does not exist according to the target device file path, so as to display the device non-existence information in the interface of the first configuration program.

[0151] Optionally, the second identification module 302 includes:

[0152] A display submodule, used to display the corresponding relationship between the target port name of the target serial port device and the target device file path in the interface of the first configuration program;

[0153] The target port name is: the name of the serial port assigned when the target serial port device is added to the device registry.

[0154] Optionally, the second identification module 302 includes:

[0155] A first screening submodule, configured to select a first serial port device of a first target category from all the serial port devices, wherein the first target category is a TTY category;

[0156] A second filtering submodule is used to delete invalid first serial port devices of a second target category from all the first serial port devices; the second target category is an 8250 category;

[0157] The third screening submodule is used to select a first serial port device of a third target category from the remaining first serial port devices as the target serial port device.

[0158] Optionally, the configuration module 303 includes:

[0159] a selection submodule, configured to, in response to triggering an add control in the interface of the first configuration program, display a list including information of target serial port devices through the first configuration program, and select at least one target serial port device from the list according to input into the list;

[0160] The adding submodule is used to call the second configuration program through the first configuration program to add the information of the selected target serial port device into the device registration table.

[0161] Optionally, the information of the target serial port device includes: a port number of a target serial port allocated to the target serial port device, a data type of the information of the target serial port device, and a target device file path of the target serial port device;

[0162] The adding submodule includes:

[0163] A construction unit, configured to construct a correspondence between the port number of the selected target serial port device, the data type, and the target device file path into a piece of information in the device registration table;

[0164] An adding unit, used for adding the constructed information to the device registry;

[0165] The port number in the constructed information is obtained by incrementing the port number in the last piece of information stored in the device registration table.

[0166] Optionally, the configuration module 303 includes:

[0167] a deletion submodule, configured to, in response to triggering a deletion control in the interface of the first configuration program, display the device registration table through the first configuration program, and call the second configuration program through the first configuration program according to input into the device registration table, so as to select information of at least one target serial port device from the device registration table for deletion;

[0168] The device also includes:

[0169] A query module is used to display the information in the device registration table through the first configuration program in response to triggering a query control in the interface of the first configuration program.

[0170] Optionally, the device further comprises:

[0171] a detection module, configured to, when detecting that the information of the target serial port device has changed due to a device plug-in / plug-out operation, call the second configuration program through the first configuration program to delete old information of the target serial port device in the device registration table;

[0172] An updating module is used to add the new information of the target serial port device after the change to the device registration table through the second configuration program.

[0173] Optionally, the first operating system is a Linux operating system, and the second operating system is a Windows operating system.

[0174] In summary, the embodiment of the present application automatically identifies the serial port device connected to the electronic device through the first configuration program of the first operating system, and identifies the target serial port device that can be used by the application of the second operating system. Subsequently, in response to the triggering of the configuration control in the interface of the first configuration program, the device registry provided by the compatible application can be automatically configured according to the information of the target serial port device by calling the second configuration program running in the compatible application, so as to realize the access and use of the target serial port device in the second operating system. In the whole process, the identification of the serial port device and the configuration and use in the second operating system can be realized automatically and accurately. By identifying the target serial port device that can be used by the application of the second operating system, the second operating system avoids paying attention to invalid devices. In addition, the whole process can be performed automatically by the program, which reduces the dependence on human resources, improves the convenience of identifying and using serial port devices, and enhances the user experience.

[0175] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0176] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0177] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0178] An embodiment of the present application provides a management device for a serial port device, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to include methods for performing one or more of the methods described in the above-mentioned embodiments.

[0179] Figure 7 8 is a block diagram of a serial port device management apparatus 800 according to an exemplary embodiment. For example, the apparatus 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0180] Reference Figure 7 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0181] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0182] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0183] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0184] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0185] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a voice information processing mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0186] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0187] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also search for changes in the position of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0188] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency information processing (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0189] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0190] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0191] Figure 8 1 is a schematic diagram of the structure of the server in some embodiments of the present application. The server 1900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1922 (for example, one or more processors) and memory 1932, and one or more storage media 1930 (for example, one or more mass storage devices) storing application programs 1942 or data 1944. Among them, the memory 1932 and the storage medium 1930 can be short-term storage or permanent storage. The program stored in the storage medium 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 1922 can be configured to communicate with the storage medium 1930 and execute a series of instruction operations in the storage medium 1930 on the server 1900.

[0192] The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input and output interfaces 1958, one or more keyboards 1956, and / or, one or more operating systems 1941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0193] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a device (server or terminal), enables the device to execute the above-mentioned embodiment method.

[0194] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by the processor of the device (server or terminal), enables the device to perform the description of the method of the above embodiment, so it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer program product or computer program embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0195] In addition, it should be noted that: the embodiment of the present application also provides a computer program product or a computer program, which may include computer instructions, which may be stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor may execute the computer instructions so that the computer device performs the description of the method of the above embodiment, so it will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer program product or computer program embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0196] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the application disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0197] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

[0198] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

[0199] The above is a detailed introduction to a serial port device management method, apparatus, electronic device and computer-readable storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for managing a serial port device, applied to an electronic device running a first operating system, characterized in that: The method comprises: Using a libudev interface function, through a first configuration program of a first operating system, a serial port device connected to the electronic device is identified; the serial port device adopts a serial communication protocol; Identifying, by the first configuration program, a target serial port device that can be used by the application program of the second operating system from among all the serial port devices, and displaying information of the target serial port device in an interface of the first configuration program; In response to triggering a configuration control in an interface of the first configuration program, calling, through the first configuration program, a second configuration program of a second operating system running in a compatible application program, so as to configure a device registry of the second operating system provided by the compatible application program according to information of the target serial port device; Using the compatible application and based on the information in the device registry, access and use of the target serial port device in the second operating system; The step of identifying, from among all the serial port devices, a target serial port device that can be used by the application program of the second operating system by means of the first configuration program includes: Selecting a first serial port device of a first target category from all the serial port devices, wherein the first target category is a TTY category; Deleting invalid first serial port devices of a second target category from all the first serial port devices; the second target category is an 8250 category; A first serial port device of a third target category is selected from the remaining first serial port devices as the target serial port device, and the third target category includes: tnt, ttyGS, and rfcomm categories.

2. The serial port device management method according to claim 1, characterized in that: The method further comprises: When the compatible application is started, the compatible application identifies the content in the device registration table to obtain an identification result; If the identification result is that the device registry contains information configured by the second configuration program, the target serial port device is connected to the second operating system for use through the compatible application according to the target device file path and target serial port of the target serial port device recorded in the device registry.

3. The serial port device management method according to claim 2, characterized in that: The method further comprises: If the identification result is that the information configured by the second configuration program does not exist in the device registry, then the information of all the target serial port devices is added to the device registration through the second configuration program, or the information of all serial port devices connected to the electronic device is added to the device registry through the second configuration program.

4. The method for managing serial port devices according to claim 2, characterized in that: The step of connecting the target serial port device to the second operating system for use through the compatible application program according to the target device file path and the target serial port of the target serial port device recorded in the device registry comprises: When the existence of the target serial port device recorded in the device registry is verified according to the target device file path, the target serial port device is connected to the second operating system for use through the compatible application according to the target device file path and the target serial port; The method further comprises: When it is verified according to the target device file path that the target serial port device recorded in the device registry does not exist, the compatible application program feeds back device non-existence information to the first configuration program to display the device non-existence information in the interface of the first configuration program.

5. The serial port device management method according to claim 1, characterized in that: The displaying of the information of the target serial port device in the interface of the first configuration program includes: In the interface of the first configuration program, display the correspondence between the target port name of the target serial port device and the target device file path; The target port name is: the name of the serial port assigned when the target serial port device is added to the device registry.

6. The serial port device management method according to claim 1, characterized in that: The step of calling, by the first configuration program, a second configuration program of the second operating system running in the compatible application program in response to triggering the configuration control in the interface of the first configuration program comprises: In response to triggering an add control in the interface of the first configuration program, displaying a list including information of target serial port devices through the first configuration program, and selecting at least one target serial port device from the list according to input into the list; The second configuration program is called by the first configuration program to add the information of the selected target serial port device into the device registration table.

7. The serial port device management method according to claim 6, characterized in that: The information of the target serial port device includes: the port number of the target serial port allocated to the target serial port device, the data type of the information of the target serial port device, and the target device file path of the target serial port device; The step of adding the selected target serial port device information into the device registration table includes: Constructing the correspondence between the port number of the selected target serial port device, the data type and the target device file path into a piece of information in the device registration table; Adding the constructed information to the device registry; The port number in the constructed information is obtained by incrementing the port number in the last piece of information stored in the device registration table.

8. The serial port device management method according to claim 1, characterized in that: The step of calling, by the first configuration program, a second configuration program of the second operating system running in the compatible application program in response to triggering the configuration control in the interface of the first configuration program comprises: In response to triggering a delete control in the interface of the first configuration program, displaying the device registry through the first configuration program, and calling the second configuration program through the first configuration program according to input of the device registry, so as to select information of at least one target serial port device from the device registry for deletion; The method further comprises: In response to triggering a query control in an interface of the first configuration program, the information in the device registration table is displayed through the first configuration program.

9. The serial port device management method according to claim 1, characterized in that: The method further comprises: When it is detected that the information of the target serial port device changes due to the device plug-in and unplug operation, the second configuration program is called by the first configuration program to delete the old information of the target serial port device in the device registration table; The new information of the target serial port device after the change is added to the device registration table through the second configuration program.

10. The serial port device management method according to any one of claims 1 to 9, characterized in that: The first operating system is a Linux operating system, and the second operating system is a Windows operating system.

11. A serial port device management device, applied to an electronic device running a first operating system, characterized in that: The device comprises: A first identification module is used to identify a serial port device connected to the electronic device by using a libudev interface function through a first configuration program of a first operating system; the serial port device adopts a serial communication protocol; a second identification module, configured to identify, from among all the serial port devices, a target serial port device that can be used by the application program of the second operating system through the first configuration program, and to display information of the target serial port device in an interface of the first configuration program; a configuration module, configured to, in response to triggering a configuration control in an interface of the first configuration program, call, through the first configuration program, a second configuration program of a second operating system running in a compatible application program, so as to configure a device registry of the second operating system provided by the compatible application program according to information of the target serial port device; An access module, used to access and use the target serial port device in the second operating system based on the information in the device registry through the compatible application; The second identification module includes: A first screening submodule, configured to select a first serial port device of a first target category from all the serial port devices, wherein the first target category is a TTY category; A second filtering submodule is used to delete invalid first serial port devices of a second target category from all the first serial port devices; the second target category is an 8250 category; The third screening submodule is used to select a first serial port device of a third target category from the remaining first serial port devices as the target serial port device, and the third target category includes: tnt, ttyGS, and rfcomm categories.

12. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method as claimed in any one of claims 1 to 10.

Citation Information

Patent Citations

  • Equipment information acquisition method and device of access equipment, equipment and storage medium

    CN119166555A