Serial port equipment management method and device, equipment and storage medium
Through the configuration program of the first operating system, the configuration program of the first operating system automatically recognizes and filters invalid devices, and combines the configuration program of compatible applications, the accurate access and use of serial port devices in the second operating system is achieved, solving the problem of inconvenience in identification and use in a multi-operation system environment, and improving the user experience.
Patent Information
- Application Number
- CN202510334416.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-01-10
AI Technical Summary
In a multi-operating system environment, the identification and use of serial port devices is less convenient, especially the inability to accurately match effective devices, resulting in a decline in user experience.
The configuration program of the first operating system automatically recognizes the serial port device, filters invalid devices, calls the configuration program of compatible applications, realizes the access and use of the target serial port device in the second operating system, and uses the visual interface to perform configuration operations.
It realizes the accurate identification and configuration of serial port equipment in the second operating system, reduces dependence on human resources, and improves user experience and convenience.
Smart Images

Figure CN120407484A_ABST
Abstract
Description
[0001] This application is a divisional application of the mother application with the application number "2025100391573", the application date "2025.01.10", and the invention title "Management Method, Device, Equipment and Storage Medium for Serial Port Devices". Technical Field
[0002] This application relates to the field of computer technology, and particularly relates to a management method, device, electronic device and computer-readable storage medium for serial port devices. Background Art
[0003] A serial port is a data communication interface. Serial port communication is a form of serial communication. Serial port devices based on serial port communication can only transmit one data bit at a time. However, its implementation is simple, the cost is low, and the transmission distance is long. Therefore, it is still very popular in many application scenarios.
[0004] Currently, serial port devices are often inserted into electronic devices for use. The electronic device can realize the access and use of the serial port device in the electronic device through identification and registration operations, so that the application program of the electronic device can call the serial port device to implement related functions.
[0005] However, in the current solution, when the electronic device runs in a multi-operating system environment, the identification and use of serial port devices are relatively inconvenient. Summary of the Invention
[0006] The embodiments of this application provide a management method and device for serial port devices to solve the problems in the prior art.
[0007] In a first aspect, the embodiments of this application provide a management method for serial port devices, which is applied to an electronic device running a first operating system. The method includes: Identifying the serial port devices connected to the electronic device through the first configuration program of the first operating system; Identifying, from all the serial port devices, the target serial port devices available for the application programs of the second operating system through the first configuration program, and displaying the information of the target serial port devices in the interface of the first configuration program; In response to the triggering of the configuration control in the interface of the first configuration program, calling the second configuration program of the second operating system running in the compatible application program through the first configuration program to configure the device registry of the second operating system provided by the compatible application program according to the information of the target serial port devices; Realizing the access and use of the target serial port device in the second operating system through the compatible application program based on the information in the device registry.
[0008] Second aspect, an embodiment of the present application provides a management device for a serial port device, the device comprising: A first identification module, configured to identify a serial port device connected to the electronic device through a first configuration program of a first operating system; A second identification module, configured to identify, through the first configuration program, a target serial port device available for use by an application program of a second operating system from all the serial port devices, and display information of the target serial port device in an interface of the first configuration program; A configuration module, configured to, in response to a trigger of a configuration control in the interface of the first configuration program, call, through the first configuration program, a second configuration program of the 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 the information of the target serial port device; An access module, configured to, through the compatible application program, implement access and use of the target serial port device in the second operating system based on information in the device registry.
[0009] Third aspect, an embodiment of the present application further provides an electronic device, comprising a processor; A memory for storing executable instructions of the processor; wherein the processor is configured to execute the instructions to implement the method of the first aspect.
[0010] Fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the method of the first aspect.[[ID=ID=19]]
[0011] An embodiment of the present application can automatically identify a serial port device connected to an electronic device through a first configuration program of a first operating system, and identify a target serial port device available for use by an application program of a second operating system therefrom. Subsequently, in response to a trigger of a configuration control in the interface of the first configuration program, by calling a second configuration program running in a compatible application program, the device registry provided by the compatible application program can be automatically configured according to the information of the target serial port device, so as to implement access and use of the target serial port device in the second operating system. During 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 available for use by the application program of the second operating system, the second operating system's attention to invalid devices is avoided. In addition, the whole process can be automated by a program, reducing the dependence on human resources, improving the convenience of identifying and using the serial port device, and enhancing the user experience.
[0012] The above description is only an overview of the technical solution of the present application. In order to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present application more obvious and understandable, the specific embodiments of the present application are specifically given below. Brief Description of the Drawings
[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0014] Figure 1 It is an implementation scenario diagram provided by an embodiment of the present application; Figure 2 It is a step flowchart of a management method for a serial port device provided by an embodiment of the present application; Figure 3 It is a specific step flowchart of a management method for a serial port device provided by an embodiment of the present application; Figure 4 It is an interface diagram of a management method for a serial port device provided by an embodiment of the present application; Figure 5 It is an execution flowchart of a management method for a serial port device provided by an embodiment of the present application; Figure 6 It is a block diagram of a management device for a serial port device provided by an embodiment of the present application; Figure 7 It is a block diagram of a device of the present application; Figure 8 It is a schematic structural diagram of a server in some embodiments of the present application. Detailed Embodiments
[0015] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.
[0016] The terms "first", "second", etc. in the description and claims of this application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of this application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually of the same type, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, the term "and / or" in the description and claims is used to describe the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. In the embodiments of this application, the term "multiple" refers to two or more, and other quantifiers are similar.
[0017] Refer to Figure 1 , Figure 1 FIG. Figure 1 is a schematic diagram of an implementation scenario provided by an embodiment of this application, including: an electronic device 10 and a serial device 20.
[0018] Among them, a first operating system runs in the electronic device 10, and a driver of a second operating system is stored in the serial device 20; the serial 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 device can be a serial mouse, a serial keyboard, a serial camera, a serial card reader, etc.
[0019] In the related art, since the serial device is directly inserted into the electronic device of the first operating system, and the serial device is often used for the second operating system application in the second operating system container of the electronic device, the related art usually uses the method of manually writing the underlying code to complete the configuration of the serial 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 device extremely inconvenient and results in a decline in the user experience. In addition, the related art regards all the identified devices as serial devices for the second operating system without distinguishing whether there are invalid devices among them, resulting in an inability to accurately match the corresponding valid serial device in the second operating system container. Among them, the second operating system container is provided by the compatible application in the electronic device.
[0020] To solve the above problems, an embodiment of the present application can install a compatible application in an electronic device. Through the first configuration program of the first operating system, the serial port devices connected to the electronic device can be automatically identified, and the target serial port devices available for the applications of the second operating system can be identified therefrom. Subsequently, in response to the triggering of the configuration control in the interface of the first configuration program, by calling the second configuration program running in the compatible application, the device registry provided by the compatible application can be automatically configured according to the information of the target serial port device, so as to realize the access and use of the target serial port device in the second operating system. During the whole process, the identification of the serial port device and its configuration and use in the second operating system can be realized automatically and accurately. By identifying the target serial port device available for the applications of the second operating system, the second operating system's attention to invalid devices is avoided. In addition, the whole process can be automated by the program, reducing the dependence on human resources, improving the convenience of identifying and using the serial port device, and enhancing the user experience. [[ID=***]] [[ID=***]]
[0021] [[ID=***]] Figure 2 is a step flowchart of a method for managing a serial port device provided by an embodiment of the present application, which is applied to an electronic device running a first operating system, such as [[ID=***]] Figure 2 shown, the method may include: [[ID=***]] Step 101: Identify the serial port devices connected to the electronic device through the first configuration program of the first operating system. [[ID=***]] [[ID=***]]
[0022] In an embodiment 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 the order of bits (bit), and each bit of data occupies a fixed time length. Compared with parallel communication, serial communication can only transmit one data bit at a time, but it is simple to implement, low in cost, and has a long transmission distance, so it is still very popular in many application scenarios. A serial port device is a device that supports serial communication, such as a serial mouse, a serial keyboard, a serial camera, a serial card reader, etc. [[ID=***]] [[ID=***]]
[0023] In addition, the electronic device in an embodiment of the present application supports running a compatible application in the first operating system. The compatible application is used to provide a second operating system container, and the applications of the second operating system can run in this second operating system container, thereby realizing the purpose of compatibly running the applications of the second operating system in the electronic device running the first operating system. [[ID=***]] [[ID=***]]
[0024] In a computer operating system, a communication port (COM, Communication Port) usually refers to the interface for serial communication, that is, a serial port. In the Windows system, the serial port is managed through the Windows operating system and is used to communicate with serial devices. Users can view and configure the serial port through the Device Manager.
[0025] In the embodiments of the present application, in practical applications, there are usually multiple serial devices (such as a mouse, a keyboard, etc.) inserted into an electronic device. In order to identify the inserted serial devices in the first operating system of the electronic device, first, the first configuration program in the first operating system of the electronic device is required to identify the serial devices connected to the electronic device. Subsequently, after filtering out the invalid serial devices from the identified serial devices, the identification and registration mechanism in the second operating system based on the valid serial devices can be implemented.
[0026] In the embodiments of the present application, specifically, the first configuration program can use the libudev interface function (when the first operating system is the Linux system) to identify the serial devices local to the first operating system. The specific function of this function is to detect whether there are files in the three paths of " / dev / ttyS*, / dev / ttyUSB*, / dev / ttyACM*" in the first operating system, and identify the existing files as the files of the serial devices, so as to realize the identification of the serial devices.
[0027] Step 102: Identify, through the first configuration program, the target serial devices available for the application programs in the second operating system from all the serial devices, and display the information of the target serial devices in the interface of the first configuration program.
[0028] In the embodiments of the present application, there may be invalid devices among the serial devices identified by the first configuration program in the first operating system. For example, some serial devices are actually virtual devices of the first operating system, and these are invalid devices. These invalid devices cannot be called and used by the application programs in the second operating system. Therefore, it is necessary to filter out these invalid devices, and the remaining serial devices are used as the target serial devices (i.e., valid devices).
[0029] For example, it can be detected whether there are files in the three paths of " / dev / ttyS*, / dev / ttyUSB*, / dev / ttyACM*" in the first operating system (Linux), and the existing files are identified as the files of the serial devices. Assuming that 33 files are identified, it is determined that 33 serial devices are detected in the first operating system: # ls / dev / ttyS* / dev / ttyUSB* / dev / ttyACM* / dev / ttyS0 / dev / ttyS15 / dev / ttyS21 / dev / ttyS28 / dev / ttyS6 / dev / ttyS1 / dev / ttyS16 / dev / ttyS22 / dev / ttyS29 / dev / ttyS7 / dev / ttyS10 / dev / ttyS17 / dev / ttyS23 / dev / ttyS3 / dev / ttyS8 / dev / ttyS11 / dev / ttyS18 / dev / ttyS24 / dev / ttyS30 / dev / ttyS9 / dev / ttyS12 / dev / ttyS19 / dev / ttyS25 / dev / ttyS31 / dev / ttyUSB0 / dev / ttyS13 / dev / ttyS2 / dev / ttyS26 / dev / ttyS4 / dev / ttyS14 / dev / ttyS20 / dev / ttyS27 / dev / ttyS5 However, among these 33 serial port devices, only 3 are actually valid devices. At this time, when the serial port debugging tool of the second operating system is started in a compatible application in the related art, 33 serial ports will be displayed, while when the serial port debugging tool of the first operating system is started, 3 serial ports will be displayed. In this way, it can be determined that there are actually only 3 valid devices. In the related art, the fact that the serial port debugging tool of the second operating system displays 33 serial ports will make it difficult to accurately find the 3 valid devices when using the serial port devices in the second operating system.
[0030] To solve this problem, in the embodiments of the present application, a first configuration program can identify target serial port devices (i.e., valid devices) available for the applications of the second operating system from all serial port devices, and display the information of the target serial port devices in the interface of the first configuration program.
[0031] Specifically, in the embodiments of the present application, invalid devices (such as virtual devices) in all serial port devices can be filtered out through filtering rules, so that the remaining serial port devices can be used as valid target serial port devices. Subsequently, configuration operations in the second operating system can be performed based on the target serial port devices, enabling accurate positioning of the valid devices when using the serial port devices in the second operating system. In addition, the embodiments of the present application can also provide a relevant visual debugging interface and display the information of the target serial port devices in the interface, so that users can have an intuitive perception of the identification of the valid devices.
[0032] Step 103: In response to the triggering of a configuration control in the interface of the first configuration program, call the second configuration program of the second operating system running in the compatibility application through the first configuration program, so as to configure the device registry of the second operating system provided by the compatibility application according to the information of the target serial port device.
[0033] In the embodiment of the present application, since the compatibility application realizes the simulation of the second operating system container environment in the electronic device of the first operating system through the interfaces of the simulated second operating system, related files such as dynamic link libraries, etc., the second configuration program of the second operating system can run in the compatibility application. The second configuration program can execute the operation of configuring the device registry of the second operating system provided by the compatibility application according to the information of the target serial port device in response to the call of the first configuration program, so as to complete the registration of the effective target serial port device in the second operating system. Among them, the specific device registry configuration operations 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 allocated for the target serial port device, the device file path of the target serial port device, etc.
[0034] Among them, the compatibility application is a compatibility layer that can run application programs of the second operating system (such as the Windows operating system) on multiple first operating systems (such as Linux, Mac OS, Berkeley Software Distribution (BSD), etc.). Preferably, the first operating system may be a Linux system, and the second operating system may be a Windows system.
[0035] Specifically, the compatibility application may be a Wine (Wine Is Not an Emulator) application. Wine can run Windows application programs on multiple first operating systems (such as Linux, macOS, and BSD, etc.). Wine does not imitate the internal Windows logic like a virtual machine or an emulator, but translates the Windows interface calls into dynamic first operating system calls, eliminating the memory occupation of performance and other behaviors, so as to be able to cleanly integrate and run Windows application programs on the user devices of the first operating system.
[0036] Further, 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 the 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, while the electronic device runs the first operating system, due to the differences between the two operating systems, a second docking interface needs to be set between the program of the first operating system and the compatible application. The data conversion method between the first operating system and the second operating system can be defined in the second docking interface, so as to play the role of data format conversion.
[0037] In addition, the first configuration program of the embodiment of the present application can also provide a relevant visual debugging interface. The debugging interface has configuration controls that support human-computer interaction functions. When a trigger on the configuration control is received, the second configuration program can be called through the first configuration program to configure the device registry of the second operating system provided for the compatible application according to the information of the target serial port device. Through the interface-based configuration operation, the user's personalized configuration operation 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, reducing the configuration difficulty and improving the configuration efficiency.
[0038] Step 104, through the compatible application, based on the information in the device registry, realize the access and use of the target serial port device in the second operating system.
[0039] In the embodiment of the present application, after the configuration of the device registry of the second operating system based on the identified target serial port device is completed, since a client program of the second operating system can also run in the compatible application, the client program can be a program that has a use requirement for the serial port device. For example, the client program can be a program that uses the 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.
[0040] In summary, in the embodiment of the present application, the first configuration program of the first operating system automatically identifies the serial port devices connected to the electronic device, and identifies the target serial port devices that can be used by the application programs of the second operating system from them. Subsequently, in response to the triggering of the configuration control in the interface of the first configuration program, by calling the second configuration program running in the compatible application, the device registry provided by the compatible application can be automatically configured according to the information of the target serial port device, so as to realize the access and use of the target serial port device in the second operating system. During the whole process, the identification of the serial port device and its configuration and use in the second operating system can be realized automatically and accurately. By identifying the target serial port devices that can be used by the application programs of the second operating system, the second operating system is prevented from paying attention to invalid devices. In addition, the whole process can be automated by the program, reducing the dependence on human resources, improving the convenience of identifying and using the serial port device, and enhancing the user experience.
[0041] Figure 3 FIG. is a specific step flowchart of a method for managing serial port devices provided by an embodiment of the present application. As Figure 3 shown, the method may include: Step 201: Identify the serial port devices connected to the electronic device through the first configuration program of the first operating system.
[0042] Optionally, the first operating system is a Linux operating system, and the second operating system is a Windows operating system.
[0043] This step may specifically refer to the above step 101 and will not be elaborated here.
[0044] Step 202: Select the first serial port devices of the first target category from all the serial port devices, where the first target category is the TTY category.
[0045] Step 203: Delete the 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.
[0046] Step 204: Select the first serial port devices of the third target category from the remaining first serial port devices as the target serial port devices.
[0047] In the embodiment of the present application, for steps 202-204, the process by which the first configuration program identifies valid target serial port devices from all serial port devices may specifically first call the udev interface (when the first operating system is Linux), and enumerate all first serial port devices belonging to the first target category (teletype device category, TTY, Teletype) in the system. In the Linux operating system, the TTY category is a category of terminal devices used to connect to a computer. TTY is a traditional way for users to interact with the computer in the Linux operating system, which allows users to enter text commands on the screen and view the output results.
[0048] 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. Subsequently, the first configuration program can delete the invalid first serial port devices belonging to the second target category from all the first serial port devices; the second target category is the 8250 category; filtering out the invalid first serial port devices of the 8250 type can avoid interference caused by these devices subsequently.
[0049] Finally, among the remaining first serial port devices, the first serial port devices belonging to the third target category can be selected as the target serial port devices. The third target category includes tnt, ttyGS, and rfcomm.
[0050] Step 205, display the correspondence between the target port name and the target device file path of the target serial port device in the interface of the first configuration program.
[0051] Among them, the target port name is: the name of the serial port assigned when the target serial port device is added to the device registry.
[0052] In the 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 program (such as an operating system loader) to determine the target serial port device connected to the serial interface. The target device file path aims to make the most of the name space, and 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.
[0053] In the embodiments of the present application, the port names and device file paths of different serial port devices are different, and the serial port device can be specifically located as which device through the device file path. The first configuration program of the embodiments of the present application can display the correspondence between the target port name and the target device file path of the target serial port device in the interface. This can enable the user to perceive the target serial port device that can be accessed by the second operating system container currently, and can specifically locate the serial port device as which device through the target device file path information of the target serial port device.
[0054] For example, for a target serial port device, the correspondence 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.
[0055] Step 206, in response to the triggering of the configuration control in the interface of the first configuration program, call the second configuration program of the second operating system running in the compatible application through the first configuration program, so as 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.
[0056] This step can specifically refer to the above step 103, and will not be elaborated here.
[0057] Optionally, step 206 can specifically include sub-steps 2061-2062: Sub-step 2061, in response to the triggering of the add control in the interface of the first configuration program, display a list including the information of the target serial port device through the first configuration program, and select at least one target serial port device from the list according to the input to the list.
[0058] Sub-step 2062, call the second configuration program through the first configuration program to add the information of the selected target serial port device into the device registry.
[0059] In the embodiments of the present application, for sub-steps 2061-2062, the first configuration program of the embodiments of the present application can also provide a relevant visual debugging interface, and this debugging interface has configuration controls that support human-computer interaction functions, such as Figure 4 As shown, a query control, an add control, and a delete control are displayed in the interface of the first configuration program. When the query control, the add control, and the delete control are triggered respectively, the second configuration program is used for corresponding query operations, add operations, and delete operations.
[0060] Specifically, for the add control, its 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 the triggering of the add control in the interface of the first configuration program, a list including the information of the target serial port device can be displayed through the first configuration program, and at least one target serial port device can be selected from the list according to the input to the list. The selected target serial port device is the device that needs to be registered in the device registry.
[0061] 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 into the device registry. The target serial port device registered in the device registry can then be connected to the second operating system container and used by the application programs of the second operating system.
[0062] Optionally, 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. Sub-step 2062 can specifically include sub-steps 20621-20622: Sub-step 20621: Construct the corresponding relationship between the port number, the data type, and the target device file path of the selected target serial port device into a piece of information in the device registry.
[0063] Sub-step 20622: Add the constructed information to the device registry.
[0064] Among them, the port number in the constructed information is incremented from the port number in the previous piece of information stored in the device registry.
[0065] 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.
[0066] For example, for a target serial port device, when it is registered in the device registry, the user can trigger the add control, and a serial port with a port name of COM1 can be assigned to it. 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). Then, for this target serial port device, the information constructed for adding to the device registry can be: "COM1——REG_SZ—dev\":\" / dev / ttyS1\".
[0067] Among them, for the above example, when adding a control, the parameter passed from the first configuration program to the second configuration program can be "B.exe add "{\"coms\":[{\"name\":\"COM1\",\"dev\":\" / dev / ttyS1\"}]}", which means to notify the second configuration program to add a target serial port device with the device file path of " / dev / ttyS1\" in the device registry.
[0068] It should be noted that the port names in the information of each target serial port device already existing in the device registry are sorted in ascending order (the serial number of the port name of the serial port device added to the device registry earlier is larger). 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"... Then, for the currently added target serial port device, the port name assigned to it can be incremented from the port number in the information stored in the previous entry 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".
[0069] Of course, the port names in the device registry may not be sorted in ascending order. For example, they can also be sorted in descending order in the device registry (the serial number of the port name of the serial port device added to the device registry earlier is smaller). This application embodiment will not elaborate on this.
[0070] Optionally, step 206 may specifically include sub-steps 2063-2064: Sub-step 2063, in response to the trigger of the delete control in the interface of the first configuration program, display the device registry through the first configuration program, and call the second configuration program through the first configuration program according to the input to the device registry, so as to select the information of at least one target serial port device from the device registry for deletion.
[0071] Specifically, for the delete control, its purpose is to delete the registered target serial port device in the device registry of the second operating system provided by the compatible application program. Then, in response to the trigger of the delete control in the interface of the first configuration program, the device registry can be displayed through the first configuration program, and at least one target serial port device can be selected from the device registry according to the input to the device registry. The selected target serial port device is the device that needs to be deleted from the device registry.
[0072] After providing the deletion control, the user can delete the target serial port device that the second operating system container does not need according to actual needs, realizing convenient management of the target serial port device.
[0073] For an example, in response to the deletion control, the parameter passed by the first configuration program to the second configuration program can be "B.exe del "{\"coms\":[{\"name\":\"COM1\",\"dev\":\" / dev / ttyUSB0\"}]}")", which means notifying the second configuration program to delete the target serial port device with a port name of "COM1" from the device registry.
[0074] Sub-step 2064: In response to the triggering of the query control in the interface of the first configuration program, display the information in the device registry through the first configuration program.
[0075] Specifically, for the query control, its purpose is to display the information in the device registry. After providing the query control, the user can view the current registration status in the device registry according to actual needs, realizing convenient management of the target serial port device.
[0076] For an example, in response to the query control, the parameter passed by the first configuration program to the second configuration program can be "B.exe search", which means notifying the second configuration program to return the information recorded in the device registry for display in the interface of the first configuration program.
[0077] Step 207: Through the compatibility application, based on the information in the device registry, realize the access and use of the target serial port device in the second operating system.
[0078] This step can specifically refer to the above step 104 and will not be elaborated here.
[0079] Optionally, the method may further include: Step 208: When the compatibility application is started, identify the content in the device registry through the compatibility application to obtain an identification result.
[0080] Step 209: If the identification result is that there is information configured by the second configuration program in the device registry, then according to the target device file path and target serial port of the target serial port device recorded in the device registry, connect the target serial port device to the second operating system for use through the compatibility application.
[0081] In the embodiment of the present application, for steps 208-209, when the compatibility application is started, it is necessary to automatically start the management and configuration of the device registry. That is, when the compatibility application is started, first, the content in the device registry is identified through the compatibility application to obtain an identification result. If the identification result is that there is information previously configured by the second configuration program in the device registry, then the target serial port device can be directly connected to the second operating system through the compatibility application according to the target device file path and the target serial port of the target serial port device recorded in the device registry for use by the applications in the second operating system container.
[0082] Among them, the device registry can be stored in the path of "HKEY_LOCAL_MACHINE\Software\Wine\Ports".
[0083] Optionally, step 209 may specifically include sub-steps 2091-2092: Sub-step 2091: When it is verified according to the target device file path that the target serial port device recorded in the device registry exists, according to the target device file path and the target serial port, the target serial port device is connected to the second operating system through the compatibility application for use. According to the target device file path and the target serial port, the target serial port device is connected to the second operating system through the compatibility application for use.
[0084] 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, the compatibility application feeds back the information that the device does not exist to the first configuration program to display the information that the device does not exist in the interface of the first configuration program.
[0085] In the embodiment of the present application, for sub-steps 2091-2092, during the process of the compatibility application connecting the target serial port device to the second operating system, it can first be verified according to the target device file path whether the corresponding target serial port device recorded in the device registry exists; if it exists, the target serial port device is connected to the second operating system through the compatibility application according to the target device file path and the target serial port for use; if it does not exist, the compatibility application feeds back the information that the device does not exist to the first configuration program for display.
[0086] Specifically, to verify whether the corresponding target serial port device recorded in the device registry exists according to the target device file path, it can be achieved by executing the target device file path through a function; if the corresponding target serial port device can run 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 run 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.
[0087] Optionally, the method may further include: Step 210: If the recognition result is that the information configured by the second configuration program does not exist in the device registry, then through the second configuration program, add the information of all the target serial port devices to the device registry, or, through the second configuration program, add the information of all the serial port devices connected to the electronic device to the device registry.
[0088] In the embodiment of the present application, if the recognition result is that the information configured by the second configuration program does not exist in the device registry, then the second configuration program can implement an automated configuration process, that is, add the information of all the target serial port devices recognized by the first configuration program to the device registry.
[0089] In addition, if the recognition result is that the information configured by the second configuration program does not exist in the device registry, then the information of all the 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 result in invalid devices among the serial port devices connected to the second operating system, thereby increasing the screening and analysis costs for valid devices.
[0090] Optionally, the method may further include: Step 211: When it is detected that the information of the target serial port device changes due to a device plugging or unplugging operation, then call the second configuration program through the first configuration program to delete the old information of the target serial port device in the device registry.
[0091] Step 212: Through the second configuration program, add the new information of the changed target serial port device to the device registry.
[0092] In the embodiments 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 changes due to device plugging and unplugging operations, the content of the device registry needs to be updated, that is, the old information of the target serial port device in the device registry is deleted, and the new information after the change of the target serial port device is added to the device registry. It should be noted that when adding the new information after the change of the target serial port device to the device registry, the port number in the new information after the change of the target serial port device is a newly allocated port number. For example, before adding the new information after the change of the target serial port device to the device registry, if the port number of the previously added target serial port device is COM6, then the port number in the new information after the change of the currently added target serial port device is COM7.
[0093] For steps 208-210, during the process of starting the compatibility application, the following process can be executed as Figure 5 shown, including: S1. Start the compatibility application.
[0094] S2. Determine whether there is information configured through the second configuration program in the device registry.
[0095] If not, execute S3. Configure according to the default rules. That is, perform the operation of step 210 above.
[0096] If so, execute S4. 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.
[0097] S5. Determine whether the target serial port device exists according to the mapping result.
[0098] If it exists, execute S6. Connect the target serial port device to the second operating system.
[0099] If not, execute S7. Prompt that the target serial port device does not exist.
[0100] In summary, in the embodiment of the present application, through the first configuration program of the first operating system, the serial port devices connected to the electronic device are automatically recognized, and the target serial port devices available for the applications of the second operating system are identified therefrom. Subsequently, in response to the triggering of the configuration control in the interface of the first configuration program, by calling the second configuration program running in the compatible application, the device registry provided by the compatible application is automatically configured according to the information of the target serial port device, so as to realize the access and use of the target serial port device in the second operating system. During the whole process, the recognition and configuration and use of the serial port device in the second operating system can be realized automatically and accurately. By identifying the target serial port device available for the applications of the second operating system, the attention of the second operating system to invalid devices is avoided. In addition, the whole process can be automated by the program, reducing the dependence on human resources, improving the convenience of recognizing and using the serial port device, and enhancing the user experience.
[0101] Figure 6 FIG. 4 is a block diagram of a management device for serial port devices provided by an embodiment of the present application. The device is applied to an electronic device running a first operating system, and the device includes: A first recognition module 301, configured to recognize the serial port devices connected to the electronic device through a first configuration program of the first operating system; A second recognition module 302, configured to recognize, through the first configuration program, target serial port devices available for the applications of the second operating system from all the serial port devices, and display the information of the target serial port devices in the interface of the first configuration program; A configuration module 303, configured to, in response to the triggering of a configuration control in the interface of the first configuration program, call, through the first configuration program, a second configuration program of the second operating system running in a compatible application, so as 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; An access module 304, configured to, through the compatible application, realize the access and use of the target serial port device in the second operating system based on the information in the device registry.
[0102] Optionally, the device further includes: A start module, configured to, when the compatible application is started, recognize the content in the device registry through the compatible application to obtain a recognition result; A processing module, configured to, if the recognition result is that there is information configured by the second configuration program in the device registry, 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 of the target serial port device recorded in the device registry.
[0103] Optionally, the device further includes: A default processing module, configured to, if the recognition result indicates that the information configured by the second configuration program does not exist in the device registry, add the information of all the target serial port devices to the device registry through the second configuration program, or add the information of all the serial port devices connected to the electronic device to the device registry through the second configuration program.
[0104] Optionally, the access module 304 includes: An access sub-module, configured to, when it is verified according to the target device file path that the target serial port device recorded in the device registry exists, access 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; The device further includes: A display module, configured to, 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, feed back device non-existence information to the first configuration program through the compatible application, so as to display the device non-existence information in the interface of the first configuration program.
[0105] Optionally, the second recognition module 302 includes: A display sub-module, configured to display the correspondence between the target port name and the target device file path of the target serial port device in the interface of the first configuration program; Wherein, the target port name is the name of the serial port assigned when the target serial port device is added to the device registry.
[0106] Optionally, the second recognition module 302 includes: A first screening sub-module, configured to select a first serial port device of a first target category from all the serial port devices, where the first target category is the TTY category; A second screening sub-module, configured to delete the 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; A third screening sub-module, configured 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.
[0107] Optionally, the configuration module 303 includes: A selection sub-module, configured to, in response to a trigger on 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 an input to the list; An addition sub-module, configured 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 registry.
[0108] Optionally, the information of the target serial port device includes: the port number of a 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; The addition sub-module includes: A construction unit, configured to construct a correspondence relationship among the port number, the data type, and the target device file path of the selected target serial port device into a piece of information in the device registry; An addition unit, configured to add the constructed information to the device registry; Wherein, the port number in the constructed information is incremented from the port number in the previous piece of information stored in the device registry.
[0109] Optionally, the configuration module 303 includes: A deletion sub-module, configured to, in response to a trigger on a deletion control in the interface of the first configuration program, display the device registry through the first configuration program, and call the second configuration program through the first configuration program to select and delete information of at least one target serial port device from the device registry according to an input to the device registry; The device further includes: A query module, configured to, in response to a trigger on a query control in the interface of the first configuration program, display the information in the device registry through the first configuration program.
[0110] Optionally, the device further includes: A detection module, configured to, when detecting that the information of the target serial port device changes due to a device plugging or unplugging operation, call the second configuration program through the first configuration program to delete the old information of the target serial port device in the device registry; An update module, configured to add the new information after the change of the target serial port device to the device registry through the second configuration program.
[0111] Optionally, the first operating system is a Linux operating system, and the second operating system is a Windows operating system.
[0112] In summary, in the embodiment of the present application, the first configuration program of the first operating system automatically identifies the serial port devices connected to the electronic device, and identifies the target serial port devices that can be used by the application programs of the second operating system. Subsequently, in response to the triggering of the configuration control in the interface of the first configuration program, by calling the second configuration program running in the compatible application program, the device registry provided by the compatible application program can be automatically configured according to the information of the target serial port device, so as to realize the access and use of the target serial port device in the second operating system. During the whole process, the identification of the serial port device and its configuration and use in the second operating system can be realized automatically and accurately. By identifying the target serial port devices that can be used by the application programs of the second operating system, the second operating system is prevented from paying attention to invalid devices. In addition, the whole process can be automated by the program, reducing the dependence on human resources, improving the convenience of identifying and using the serial port device, and enhancing the user experience.
[0113] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment.
[0114] The embodiments in this specification are all described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other.
[0115] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated here.
[0116] The embodiment of the present application provides a management device for serial port devices, including a memory and more than one program. The more than one program is stored in the memory and is configured to be executed by more than one processor. The more than one program includes the method for performing the above one or more embodiments.
[0117] Figure 7 is a block diagram of a management device 800 for serial port devices shown according to an exemplary embodiment. For example, the device 800 can 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.
[0118] Referring to 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.
[0119] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing element 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-described methods. Additionally, the processing component 802 may include one or more modules to facilitate interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
[0120] The memory 804 is configured to store various types of data to support the operation of 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, and the like. The memory 804 may 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, a magnetic disk, or an optical disk.
[0121] The power component 806 provides power to the various components of the device 800. The power 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.
[0122] 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 touches, swipes, and gestures on the touch panel. The touch sensors may not only sense the boundaries of the touch or swipe actions, but also detect the duration and pressure associated with the touch or swipe 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 of the front camera and the rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0123] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), which is configured to receive external audio signals when the device 800 is in an operating mode, such as a call mode, a recording mode, and a voice message processing mode. The received audio signals can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 further includes a speaker for outputting audio signals.
[0124] The I / O interface 812 provides an interface between the processing component 802 and a peripheral interface module, and the peripheral interface module can be a keyboard, a click wheel, buttons, etc. These buttons can include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0125] The sensor component 814 includes one or more sensors for providing an assessment of various aspects of the status of the device 800. For example, the sensor component 814 can detect the on / off state of the device 800, the relative positioning of components, such as the display and keypad of the device 800. The sensor component 814 can also search for a change 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 component 814 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component 814 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 814 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0126] The communication component 816 is configured to facilitate communication between the device 800 and other devices in a wired or wireless manner. 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 further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0127] 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 for performing the above method.
[0128] 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 above instructions can be executed by a processor 820 of the apparatus 800 to complete the above method. For example, the non-transitory computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0129] Figure 8 FIG. 7 is a schematic structural diagram of a server in some embodiments of the present application. The server 1900 may vary greatly due to different configurations or performances, and may include one or more central processing units (CPUs) 1922 (for example, one or more processors) and a memory 1932, and one or more storage media 1930 (for example, one or more mass storage devices) for storing application programs 1942 or data 1944. Among them, the memory 1932 and the storage media 1930 may be transient storage or persistent storage. The program stored in the storage media 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Further, the central processor 1922 may be configured to communicate with the storage media 1930 and execute a series of instruction operations in the storage media 1930 on the server 1900.
[0130] The server 1900 may further include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input / 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.
[0131] 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 method of the above embodiment.
[0132] 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 description of the method in the above - mentioned embodiments. Therefore, the description will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated either. For the technical details not disclosed in the computer program product or computer program embodiments involved in this application, please refer to the description of the method embodiments of this application.
[0133] In addition, it should be noted that: The embodiments of this application also provide a computer program product or a computer program. The computer program product or the computer program may include computer instructions, and the computer instructions 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 can execute the computer instructions, enabling the computer device to execute the description of the method in the above - mentioned embodiments. Therefore, the description will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated either. For the technical details not disclosed in the computer program product or computer program embodiments involved in this application, please refer to the description of the method embodiments of this application.
[0134] Those skilled in the art will readily conceive of other embodiments of this application after considering the specification and practicing the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application, which follow the general principles of this application and include well - known common general knowledge or conventional technical means in the technical field not disclosed in this application. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of this application are pointed out by the following claims.
[0135] It should be understood that this application is not limited to the exact structures already described and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is only limited by the appended claims.
[0136] The above are only the preferred embodiments of this application, and are not intended to limit this application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of this application shall be included within the protection scope of this application.
[0137] The above has introduced in detail a management method, device, electronic device, and computer-readable storage medium for a serial port device. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A management method for a serial port device, applied to an electronic device running a first operating system, characterized in that, The method includes: Using the libudev interface function through the first configuration program of the first operating system to identify the serial port devices connected to the electronic device, including: detecting whether there are files in the paths of / dev / ttyS*, / dev / ttyUSB*, and / dev / ttyACM* in the first operating system, and identifying the existing files as the files of the serial port devices; the serial port devices adopt the serial communication protocol; Identifying, through the first configuration program, the target serial port devices available for the applications of the second operating system from all the serial port devices, and displaying the information of the target serial port devices in the interface of the first configuration program; In response to the triggering of the configuration control in the interface of the first configuration program, calling, through the first configuration program, the 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 devices; Based on the information in the device registry, realizing the access and use of the target serial port devices in the second operating system through the compatible application.
2. The management method of the serial port device according to claim 1, wherein, The method further includes: When the compatible application is started, identifying the content in the device registry through the compatible application to obtain an identification result; If the identification result is that there is information configured by the second configuration program in the device registry, connecting 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 of the target serial port device recorded in the device registry.
3. The management method of the serial port device according to claim 2, characterized in that, The method further includes: If the identification result is that there is no information configured by the second configuration program in the device registry, adding the information of all the target serial port devices to the device registry through the second configuration program, or adding the information of all the serial port devices connected to the electronic device to the device registry through the second configuration program.
4. The management method of the serial port device according to claim 2, characterized in that, The connecting 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 of the target serial port device recorded in the device registry includes: When it is verified that the target serial port device recorded in the device registry exists according to the target device file path, connecting 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; The method further includes: When it is verified that the target serial port device recorded in the device registry does not exist according to the target device file path, feeding back the information that the device does not exist to the first configuration program through the compatible application to display the information that the device does not exist in the interface of the first configuration program.
5. The management method of the serial port device according to claim 1, characterized in that The displaying the information of the target serial port devices 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. Among them, 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 management method of the serial port device according to claim 1, characterized in that, The identifying, by the first configuration program, a target serial port device available for an application of the second operating system from all the serial port devices includes: Selecting a first serial port device of a first target category from all the serial port devices, where the first target category is the TTY category; Deleting, from all the first serial port devices, invalid first serial port devices of a second target category; the second target category is the 8250 category; Selecting a first serial port device of a third target category from the remaining first serial port devices as the target serial port device.
7. The management method of the serial port device according to claim 1, wherein The responding to the triggering of a configuration control in the interface of the first configuration program and calling, by the first configuration program, a second configuration program of the second operating system running in a compatible application includes: In response to the triggering of an add control in the interface of the first configuration program, display, by the first configuration program, a list including information of the target serial port device, and select at least one target serial port device from the list according to the input to the list. Call, by the first configuration program, the second configuration program to add the information of the selected target serial port device to the device registry.
8. The management method of the serial port device according to claim 7, characterized in that 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. The adding the information of the selected target serial port device to the device registry includes: Constructing the correspondence between the port number, the data type, and the target device file path of the selected target serial port device into a piece of information in the device registry; Adding the constructed information to the device registry; Among them, the port number in the constructed information is incremented from the port number in the previous piece of information stored in the device registry.
9. The management method of the serial port device according to claim 1, characterized in that The responding to the triggering of a configuration control in the interface of the first configuration program and calling, by the first configuration program, a second configuration program of the second operating system running in a compatible application includes: In response to the triggering of a delete control in the interface of the first configuration program, display, by the first configuration program, the device registry, and call, by the first configuration program, the second configuration program according to the input to the device registry to select and delete the information of at least one target serial port device from the device registry. The method further includes: In response to the triggering of a query control in the interface of the first configuration program, display the information in the device registry by the first configuration program.
10. The management method of the serial port device according to claim 1, wherein The method further includes: In the case where the information of the target serial port device changes due to device plugging or unplugging operations, the second configuration program is called through the first configuration program to delete the old information of the target serial port device in the device registry. The new information of the target serial port device after the change is added to the device registry through the second configuration program.
11. The management method of the serial port device according to any one of claims 1-10, characterized in that, The first operating system is a Linux operating system, and the second operating system is a Windows operating system.
12. A management device for a serial port device, which is applied to an electronic device running a first operating system, and is characterized in that The device includes: A first identification module, configured to identify the serial port devices connected to the electronic device through the first configuration program of the first operating system using the libudev interface function, including: detecting whether there are files in the paths of / dev / ttyS*, / dev / ttyUSB*, and / dev / ttyACM* in the first operating system, and identifying the existing files as the files of the serial port devices; the serial port devices adopt the serial communication protocol. A second identification module, configured to identify the target serial port devices available for the applications of the second operating system from all the serial port devices through the first configuration program, and display the information of the target serial port devices in the interface of the first configuration program. A configuration module, configured to, in response to the triggering of the configuration control in the interface of the first configuration program, call the second configuration program of the second operating system running in the compatible application through the first configuration program, so as to configure the device registry of the second operating system provided by the compatible application according to the information of the target serial port devices. An access module, configured to realize the access and use of the target serial port device in the second operating system through the compatible application based on the information in the device registry.
13. An electronic device, characterized in that, Includes: A processor; A memory for storing the executable instructions of the processor; Wherein, the processor is configured to execute the instructions to implement the method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Data response method and device in system platform and electronic equipment
CN115705212A
Serial port switching method, chip and serial port switching system
CN116302141A
Updating method and device of executable file, electronic equipment and storage medium
CN118672610A
Equipment information acquisition method and device of access equipment, equipment and storage medium
CN119166555A
Device unlocking method and apparatus, electronic device and computer-readable storage medium
WO2023142743A1