Device serial port configuration method, system, electronic device and storage medium

By using the visual interface to generate serial port configuration instructions in Android devices and using symlink for binding, it solves the problem that users have difficulty in flexibly modifying the binding relationship of serial port devices, realizing intuitive serial port configuration and improving user experience.

CN113836066BActive Publication Date: 2024-12-13QINGDAO WINTEC SYSTEM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110959162.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-20
Publication Date
2024-12-13
Estimated Expiration
2041-08-20

AI Technical Summary

Technical Problem

In the prior art, it is difficult for users to flexibly modify the binding relationship between the serial port device and the serial port number, and they need to make cumbersome customization modifications in the system source code, which lacks intuition and flexibility.

Method used

Provides a device serial port configuration method and system, configures the required serial port number through the visual interface, generates serial port configuration instructions, and uses symlink to bind to avoid re-modifying the source code, and realizes flexible configuration of the serial port number and device binding.

Benefits of technology

Users can intuitively configure serial port numbers according to their needs, avoiding the tedious steps of source code modification, improving user experience and saving costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113836066B_ABST
    Figure CN113836066B_ABST
Patent Text Reader

Abstract

The present invention proposes a device serial port configuration method, system, electronic device and storage medium, and the method and technical scheme thereof include a configuration instruction output step, configuring the required serial port number of the serial port device in a visual interface, and generating a serial port configuration instruction according to the required serial port number; a configuration comparison judgment step, receiving the serial port configuration instruction, judging whether the required serial port number in the serial port configuration instruction is consistent with the existing serial port number; a serial port rebinding step, if the required serial port number is inconsistent with the existing serial port number, clearing the original binding configuration, and then rebinding using symlink according to the serial port configuration instruction. The present application solves the problem that users cannot flexibly modify the binding relationship between the serial port and the serial port device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of serial port configuration, and in particular relates to a device serial port configuration method, system, electronic device and storage medium. Background Art

[0002] When users use Android devices, the correspondence between serial port devices and serial port numbers is generally configured by default, one-to-one; when users want to reassign serial port numbers to serial port devices, they need to find the manufacturer again, which is troublesome, and there is no intuitive modification method. In the prior art, the binding relationship between the serial port and the serial port device is usually reconfigured in the system source code, but when users need to customize the binding relationship between the serial port and the serial port device, they need to modify the configuration in the system source code again, which is cumbersome and inflexible. Summary of the invention

[0003] The embodiments of the present application provide a device serial port configuration method, system, electronic device and storage medium to at least solve the problem that a user cannot flexibly modify the binding relationship between a serial port and a serial port device.

[0004] In the first aspect, an embodiment of the present application provides a device serial port configuration method, including: a configuration instruction output step, configuring the required serial port number of the serial port device in a visual interface, and generating a serial port configuration instruction according to the required serial port number; a configuration comparison and judgment step, receiving the serial port configuration instruction, and judging whether the required serial port number in the serial port configuration instruction is consistent with the existing serial port number; a serial port rebinding step, if the required serial port number is inconsistent with the existing serial port number, clearing the original binding configuration, and then rebinding using symlink according to the serial port configuration instruction.

[0005] Preferably, the serial port configuration instruction includes an array in a one-to-one correspondence form of key-value pairs.

[0006] Preferably, the configuration instruction output step further comprises: displaying a current free serial port number in the visual interface according to a current configuration of the serial port device, and configuring the required serial port number of the serial port device according to the current free serial port number.

[0007] Preferably, the serial port rebinding step further comprises: firstly releasing the original binding configuration of the serial port device by using unlink, and then rebinding by using symlink according to the required serial port number.

[0008] In the second aspect, an embodiment of the present application provides a device serial port configuration system, which is applicable to the above-mentioned device serial port configuration method, including: a configuration instruction output module, which configures the required serial port number of the serial port device in a visual interface, and generates a serial port configuration instruction according to the required serial port number; a configuration comparison and judgment module, which receives the serial port configuration instruction, and determines whether the required serial port number in the serial port configuration instruction is consistent with the existing serial port number; a serial port re-binding module, which clears the original binding configuration if the required serial port number is inconsistent with the existing serial port number, and then rebinds using symlink according to the serial port configuration instruction.

[0009] In some of the embodiments, the serial port configuration instruction includes an array in a one-to-one correspondence form of key-value pairs.

[0010] In some embodiments, the configuration instruction output module further includes: displaying a current free serial port number in the visual interface according to a current configuration of the serial port device, and configuring the required serial port number of the serial port device according to the current free serial port number.

[0011] In some embodiments, the serial port rebinding module further includes: firstly releasing the original binding configuration of the serial port device by using unlink, and then rebinding by using symlink according to the required serial port number.

[0012] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a device serial port configuration method as described in the first aspect above is implemented.

[0013] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a device serial port configuration method as described in the first aspect above.

[0014] Compared with the related art, the device serial port configuration method provided in the embodiment of the present application avoids the tedious steps of re-modifying the source code customization. The user can freely configure the serial port according to his own needs intuitively, and can also view the current serial port configuration information, which greatly saves costs and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0016] Figure 1It is a flow chart of the device serial port configuration method of the present invention;

[0017] Figure 2 A framework diagram of a device serial port configuration system of the present invention;

[0018] Figure 3 A framework diagram of an electronic device of the present invention;

[0019] In the above picture:

[0020] 1. Configuration instruction output module; 2. Configuration comparison and judgment module; 3. Serial port rebinding module; 60. Bus; 61. Processor; 62. Memory; 63. Communication interface. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0022] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.

[0023] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0024] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a kind of", "the" and the like involved in this application do not indicate a quantitative limitation and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices.

[0025] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings:

[0026] Figure 1 For the flow chart of the device serial port configuration method of the present invention, please refer to Figure 1 The device serial port configuration method of the present invention comprises the following steps:

[0027] S1: configuring a required serial port number of a serial port device in a visual interface, and generating a serial port configuration instruction according to the required serial port number.

[0028] Optionally, the serial port configuration instruction includes an array in a one-to-one correspondence form of key-value pairs. Optionally, the visual interface displays the current free serial port number according to the current configuration of the serial port device, and configures the required serial port number of the serial port device according to the current free serial port number.

[0029] In a specific implementation, a unified interface for configuring the serial port function is implemented in the source code and can be called by the upper layer. Optionally, it can be specified that only applications with system signatures can call it. The upper layer implements the operation logic of configuring the serial port by calling the interface.

[0030] In a specific implementation, the upper layer implements a user operation interface. When the user operation interface is configured, the operation logic is triggered to implement the configuration of the serial port.

[0031] In the specific implementation, when the user configures the binding relationship, the serial port number and the serial port device are one-to-one corresponding. One serial port number cannot correspond to more than one serial port device, and more than one serial port number cannot correspond to the same device. The key-value pairs are transmitted in an array in a one-to-one correspondence.

[0032] This application provides a specific embodiment for a visualization interface to be described in detail. The visualization interface includes five areas:

[0033] Area 1 includes the display and editing of the correspondence between all current serial port devices and serial port numbers. The device column is not editable, and the serial port number column changes with the state of the interface switching. The devices in the device column and the serial ports in the serial port number column are in a one-to-one correspondence.

[0034] In area 2, the current available serial port numbers are displayed in real time. This area is for viewing only and will list the current available serial port numbers in real time according to the user's configuration.

[0035] In area 3, you can switch the serial port configuration interface state. When you click the control to switch to "view state", the serial port number in area 1 is displayed as uneditable, which can only be viewed but not modified; when area 3 is switched to "edit interface", the serial port number column in area 1 is editable. At this time, users can customize the binding relationship between the serial port number and the serial port device by modifying the serial port number column. Optionally, each time you re-enter the user operation interface, the default is "view state".

[0036] Area 4 includes confirmation to save the serial port configuration information and cancellation to save. In the specific implementation, Area 4 is only displayed when the interface status in Area 3 is in the editing status. This area consists of a "Confirm Save" control and a "Cancel Save" control. When the control in Area 4 is in the editing status, after the user customizes the binding relationship between the serial port number and the serial port device, he can click the "Confirm Save" control to save the configuration, or click the "Cancel Save" control to cancel the current user configuration. When the user clicks Confirm Save, the configuration information Info operated by the user on the interface will be passed to the unified interface, and then the interface will implement the specific reset serial port configuration function, refresh the current configuration when it expires, and at the same time, the control in Area 3 changes to the viewing status.

[0037] In area five, the function of restoring the default configuration is included.

[0038] S2: Receive the serial port configuration instruction, and determine whether the required serial port number in the serial port configuration instruction is consistent with the existing serial port number.

[0039] In a specific implementation, when the interface is called, it is first determined whether the transmitted user configuration information is consistent with the original configuration.

[0040] S3: If the required serial port number is inconsistent with the existing serial port number, clear the original binding configuration, and then rebind using symlink according to the serial port configuration instruction. Optionally, first use unlink to release the original binding configuration of the serial port device, and then rebind using symlink according to the required serial port number.

[0041] In the specific implementation, if they are consistent, no processing will be done and true will be returned to indicate success; if they are inconsistent, unlink will be used to undo the original binding configuration, and then symlink will be used to rebind one by one according to the passed user configuration information. If the binding is successful, true will be returned to indicate success.

[0042] In the specific implementation, the interface function is supported by the underlying implementation and provides interface methods to the upper layer.

[0043] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0044] The present application embodiment provides a device serial port configuration system, which is applicable to the above-mentioned device serial port configuration method. As used below, the terms "unit", "module", etc. can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware or a combination of software and hardware is also possible and conceivable.

[0045] Figure 2 For a framework diagram of the device serial port configuration system according to the present invention, see Figure 2 ,include:

[0046] Configuration instruction output module 1: configures the required serial port number of the serial port device in a visual interface, and generates a serial port configuration instruction according to the required serial port number.

[0047] Optionally, the serial port configuration instruction includes an array in a one-to-one correspondence form of key-value pairs. Optionally, the visual interface displays the current free serial port number according to the current configuration of the serial port device, and configures the required serial port number of the serial port device according to the current free serial port number.

[0048] In a specific implementation, a unified interface for configuring the serial port function is implemented in the source code and can be called by the upper layer. Optionally, it can be specified that only applications with system signatures can call it. The upper layer implements the operation logic of configuring the serial port by calling the interface.

[0049] In a specific implementation, the upper layer implements a user operation interface. When the user operation interface is configured, the operation logic is triggered to implement the configuration of the serial port.

[0050] In the specific implementation, when the user configures the binding relationship, the serial port number and the serial port device are one-to-one corresponding. One serial port number cannot correspond to more than one serial port device, and more than one serial port number cannot correspond to the same device. The key-value pairs are transmitted in an array in a one-to-one correspondence.

[0051] This application provides a specific embodiment for a visualization interface to be described in detail. The visualization interface includes five areas:

[0052] Area 1 includes the display and editing of the correspondence between all current serial port devices and serial port numbers. The device column is not editable, and the serial port number column changes with the state of the interface switching. The devices in the device column and the serial ports in the serial port number column are in a one-to-one correspondence.

[0053] In area 2, the current available serial port numbers are displayed in real time. This area is for viewing only and will list the current available serial port numbers in real time according to the user's configuration.

[0054] In area 3, you can switch the serial port configuration interface state. When you click the control to switch to "view state", the serial port number in area 1 is displayed as uneditable, which can only be viewed but not modified; when area 3 is switched to "edit interface", the serial port number column in area 1 is editable. At this time, users can customize the binding relationship between the serial port number and the serial port device by modifying the serial port number column. Optionally, each time you re-enter the user operation interface, the default is "view state".

[0055] Area 4 includes confirmation to save the serial port configuration information and cancellation to save. In the specific implementation, Area 4 is only displayed when the interface status in Area 3 is in the editing status. This area consists of a "Confirm Save" control and a "Cancel Save" control. When the control in Area 4 is in the editing status, after the user customizes the binding relationship between the serial port number and the serial port device, he can click the "Confirm Save" control to save the configuration, or click the "Cancel Save" control to cancel the current user configuration. When the user clicks Confirm Save, the configuration information Info operated by the user on the interface will be passed to the unified interface, and then the interface will implement the specific reset serial port configuration function, refresh the current configuration when it expires, and at the same time, the control in Area 3 changes to the viewing status.

[0056] In area five, the function of restoring the default configuration is included.

[0057] Configuration comparison and judgment module 2: receiving the serial port configuration instruction, and judging whether the required serial port number in the serial port configuration instruction is consistent with the existing serial port number.

[0058] In a specific implementation, when the interface is called, it is first determined whether the transmitted user configuration information is consistent with the original configuration.

[0059] Serial port rebinding module 3: If the required serial port number is inconsistent with the existing serial port number, clear the original binding configuration, and then rebind using symlink according to the serial port configuration instruction. Optionally, first use unlink to undo the original binding configuration of the serial port device, and then rebind using symlink according to the required serial port number.

[0060] In the specific implementation, if they are consistent, no processing will be done and true will be returned to indicate success; if they are inconsistent, unlink will be used to undo the original binding configuration, and then symlink will be used to rebind one by one according to the passed user configuration information. If the binding is successful, true will be returned to indicate success.

[0061] In the specific implementation, the interface function is supported by the underlying implementation and provides interface methods to the upper layer.

[0062] In addition, combined Figure 1 The described device serial port configuration method can be implemented by an electronic device. Figure 3 It is a framework diagram of the electronic device of the present invention.

[0063] The electronic device may include a processor 61 and a memory 62 storing computer program instructions.

[0064] Specifically, the processor 61 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0065] Among them, the memory 62 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 62 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 62 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 62 may be inside or outside the data processing device. In a specific embodiment, the memory 62 is a non-volatile memory. In a specific embodiment, the memory 62 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (Programmable Read-Only Memory, PROM for short), an erasable PROM (Erasable ProgrammableRead-Only Memory, EPROM for short), an electrically erasable PROM (Electrically Erasable ProgrammableRead-Only Memory, EEPROM for short), an electrically alterable ROM (Electrically Alterable Read-Only Memory, EAROM for short) or a flash memory (FLASH) or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.

[0066] The memory 62 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 61 .

[0067] The processor 61 implements any one of the device serial port configuration methods in the above embodiments by reading and executing computer program instructions stored in the memory 62 .

[0068] In some of the embodiments, the electronic device may further include a communication interface 63 and a bus 60. Figure 3 As shown, the processor 61, the memory 62, and the communication interface 63 are connected via a bus 60 and communicate with each other.

[0069] The communication port 63 can realize data communication with other components such as external devices, image / data acquisition devices, databases, external storage, and image / data processing workstations.

[0070] The bus 60 includes hardware, software or both, and couples the components of the electronic device to each other. The bus 60 includes but is not limited to at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 60 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, bus 60 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.

[0071] The electronic device can execute a device serial port configuration method in an embodiment of the present application.

[0072] In addition, in combination with a device serial port configuration method in the above embodiment, the present application embodiment can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any device serial port configuration method in the above embodiment is implemented.

[0073] The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes.

[0074] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0075] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A device serial port configuration method, characterized in that: It is used to configure the serial port device and the serial port number when using the Android device. The device serial port configuration method includes: A configuration instruction output step, configuring a required serial port number of a serial port device in a visual interface, and generating a serial port configuration instruction according to the required serial port number; A configuration comparison and judgment step, receiving the serial port configuration instruction, and judging whether the required serial port number in the serial port configuration instruction is consistent with the existing serial port number; A serial port rebinding step, if the required serial port number is inconsistent with the existing serial port number, clearing the original binding configuration, and then rebinding using symlink according to the serial port configuration instruction; The configuration instruction output step further includes: providing a visual interface, wherein the visual interface includes five areas: In area 1, the corresponding relationship between all current serial port devices and serial port numbers is displayed and edited; In area 2, the current available serial port number is displayed in real time; In area 3, you can switch the serial port configuration interface status, which includes viewing status and editing status; Area 4 includes confirmation to save the serial port configuration information and cancellation to save; In area five, the function of restoring the default configuration is included.

2. The device serial port configuration method according to claim 1, characterized in that: The serial port configuration instruction includes an array in a one-to-one correspondence form of key-value pairs.

3. The device serial port configuration method according to claim 1, characterized in that: The configuration instruction output step further includes: displaying a current free serial port number in the visual interface according to a current configuration of the serial port device, and configuring the required serial port number of the serial port device according to the current free serial port number.

4. The device serial port configuration method according to claim 1, characterized in that: The serial port rebinding step further includes: firstly releasing the original binding configuration of the serial port device by using unlink, and then rebinding by using symlink according to the required serial port number.

5. A device serial port configuration system, characterized in that: Used to configure serial port devices and serial port numbers when using Android devices, the device serial port configuration system includes: A configuration instruction output module configures a required serial port number of a serial port device in a visual interface and generates a serial port configuration instruction according to the required serial port number; A configuration comparison and judgment module receives the serial port configuration instruction and judges whether the required serial port number in the serial port configuration instruction is consistent with the existing serial port number; A serial port rebinding module, if the required serial port number is inconsistent with the existing serial port number, clears the original binding configuration, and then rebinds using symlink according to the serial port configuration instruction; The configuration instruction output module further includes: providing a visual interface, the visual interface including five areas: In area 1, the corresponding relationship between all current serial port devices and serial port numbers is displayed and edited; In area 2, the current available serial port number is displayed in real time; In area 3, you can switch the serial port configuration interface status, which includes viewing status and editing status; Area 4 includes confirmation to save the serial port configuration information and cancellation to save; In area five, the function of restoring the default configuration is included.

6. The device serial port configuration system according to claim 5, characterized in that: The serial port configuration instruction includes an array in a one-to-one correspondence form of key-value pairs.

7. The device serial port configuration system according to claim 5, characterized in that: The configuration instruction output module further includes: displaying a current free serial port number in the visual interface according to the current configuration of the serial port device, and configuring the required serial port number of the serial port device according to the current free serial port number.

8. The device serial port configuration system according to claim 5, characterized in that: The serial port rebinding module further comprises: firstly releasing the original binding configuration of the serial port device by using unlink, and then rebinding by using symlink according to the required serial port number.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the device serial port configuration method according to any one of claims 1 to 4 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the device serial port configuration method according to any one of claims 1 to 4 is implemented.