Port multiplexing method and device, equipment and storage medium

By binding the target port to the target channel, multiple logical port functions are reused, which solves the problem of multiple port types and different functions in the existing technology, and improves the ease of use and security of the device.

CN118689796APending Publication Date: 2024-09-24FIBOCOM WIRELESS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410737399.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

In the existing technology, a device needs to enumerate multiple ports to implement different functions, resulting in complex development and maintenance, low applicability, low operational convenience, and low security because multiple ports are exposed to the operating system.

Method used

By receiving the mode parameters generated by user calls, the target port is bound to the target channel, which realizes the reuse of multiple logical port functions, reduces the device's demand for multiple ports, and improves the ease of use and security of accessing the target device. .

Benefits of technology

It realizes multiple functions through one target port, simplifies the development and maintenance of the device, and improves the applicability and security of the device in various application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118689796A
    Figure CN118689796A
Patent Text Reader

Abstract

The embodiment of the invention provides a port multiplexing method and device, equipment and a storage medium. The method comprises: receiving a mode parameter generated in response to an operation of calling a preset first command by a user, the preset first command being used for setting a use mode of a target port; binding the target port with the target channel based on the mode parameter; and in response to an operation of calling a preset second command by the user, transmitting the target data to the target equipment through the target channel. By adopting the embodiment of the invention, the first equipment can realize functions corresponding to various logic ports through one target port, so that the capability of accessing the target equipment by software of the first equipment in various application scenes is improved, and the difficulty of accessing the target equipment by the first equipment is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for port multiplexing. Background Art

[0002] When the first device accesses the target device, for example, when the first device implements a corresponding function by accessing the target device, generally, the driver layer of the software part of the first device needs to have a port corresponding to the above function, so as to establish a connection with the target device through the port. In addition, the user layer of the first device also needs to have an application corresponding to the above function to control the corresponding port in the driver layer to implement the corresponding function.

[0003] That is to say, in order to realize the above functions, it is necessary not only to develop multiple drivers in the driver layer of the first device to respectively enumerate the corresponding ports, but also to develop multiple applications in the user layer of the first device to respectively control the ports in the driver layer. However, the multiple drivers and multiple applications are limited in development, application and maintenance due to the number of drivers and applications, resulting in low applicability and low convenience of operation for accessing the target device through the port on the first device. Summary of the invention

[0004] The embodiments of the present application provide a method, apparatus, device and storage medium for port multiplexing. A first device can implement functions corresponding to multiple logical ports through one target port, without the need to develop port applications separately, thereby improving the usability, stability and adaptability of the first device in accessing the target device in various application scenarios.

[0005] In a first aspect, an embodiment of the present application provides a method for port multiplexing, the method comprising:

[0006] Receiving a mode parameter generated in response to a user calling a preset first command, wherein the preset first command is used to set a usage mode of the target port;

[0007] Binding the target port to a target channel based on the mode parameter, wherein the target channel corresponds to the mode parameter;

[0008] In response to a user's operation of invoking a preset second command, the target data is transmitted to the target device through the target channel.

[0009] In the above method, after determining the usage mode of the target port, the target port is bound to the target channel corresponding to the mode parameter. Therefore, the driver of the first device can be bound to different target channels of the target device according to the different usage modes of the target port to realize different functions. The first device can realize the functions of multiple logical ports through one target port. Compared with the existing scheme, the first device needs to enumerate multiple different ports to correspond to different functions respectively. The embodiment of the present application can meet multiple different functional requirements through one target port. The ability of the first device to access the target device in multiple application scenarios is improved, and the difficulty of the first device to access the target device is reduced. At the same time, the multiple ports enumerated by the first device in the existing scheme are simultaneously exposed to the operating system of the first device, and the security is low. The target port used to realize multiple functions in the embodiment of the present application is not exposed to the user layer, which shields the differences in the user layer and improves security.

[0010] In an optional solution of the first aspect, binding the target port to the target channel based on the mode parameter includes:

[0011] generating a control command based on the mode parameters;

[0012] The control command is sent to the target device, so that the target device opens the target channel for binding with the target port.

[0013] In the above method, the target channel is opened according to the mode parameter of the target port, so as to be bound to the target port, thereby ensuring that the target channel connected to the target port meets the functional requirements to be implemented by the first device.

[0014] In an optional solution of the first aspect, before binding the target port to the target channel based on the mode parameter, the method includes:

[0015] In response to the user's operation of calling the preset third command, the driver is reloaded.

[0016] In a second aspect, an embodiment of the present application provides a method for port multiplexing, the method comprising:

[0017] generating a mode parameter in response to a user calling a preset first command operation; wherein the preset first command is used to set a usage mode of the target port;

[0018] Sending the mode parameter to a driver so that the driver binds a target port to a target channel based on the mode parameter, wherein the target channel corresponds to the mode parameter;

[0019] In response to a user's operation of calling a preset second command, the target data is sent to the driver, so that the driver transmits the target data to the target device through the target channel.

[0020] In the above method, the first device sends the mode parameter to the driver layer, and the driver layer determines the usage mode of the target port according to the mode parameter. Therefore, determining the usage mode of the target port through the driver layer can make the way for the software of the first device to establish a connection with the software of the target device more convenient, and improve the portability of the solution. The state value of the target port is determined through the user layer of the first device because the user layer of the first device can interact with the user. Therefore, the first state value determined by the user layer better meets the user's requirements.

[0021] In an optional solution of the second aspect, the generating mode parameter in response to the user calling the operation of the preset first command includes:

[0022] In response to a user's operation of calling the preset first command through a preset application, the mode parameter generated by the preset application is acquired, wherein the preset application is an application based on a preset framework linked to a target device.

[0023] In the above method, an application based on the preset framework of the target device link can communicate with the target port based on the preset framework, which is equivalent to that no matter what state the target port is in, the application of the first device can control the target port to interact with the target device, thereby realizing the corresponding function. Therefore, the first device opens up the communication between the user layer and the driver layer of the first device and reaches the device layer of the target device through the preset framework. The purpose of multiplexing the functions of multiple logical ports through one target port is achieved.

[0024] In an optional solution of the second aspect, before receiving the mode parameter generated in response to the user invoking the preset first command, the method further includes:

[0025] Registration is based on the target port within the preset framework.

[0026] In the above method, the target port is a port based on a preset framework, and the first device can realize the functions of multiple logical ports through the target port. The first device does not need to enumerate multiple types of ports at the driver layer, so there is no need to develop multiple drivers at the driver layer of the first device to support multiple types of ports. The existing solution solves the problems of different types of ports, poor portability, and inconvenient operation.

[0027] In an optional solution of the second aspect, binding the target port to the target channel based on the mode parameter includes:

[0028] Determine the target channel from one or more channels based on the mode parameter, wherein the multiple channels correspond to one usage mode of the target port, or the channels correspond to multiple usage modes of the target port;

[0029] Bind the target port to the target channel.

[0030] In the above method, the target device may correspond to one function through multiple channels, or may correspond to multiple functions through one channel. Therefore, the first device determines the target channel from the target device according to the mode parameter of the target port, and may determine the channel corresponding to the mode parameter from multiple channels. It is also possible to determine the function corresponding to the mode parameter from one channel of the target device, ensuring that the connection established between the target port and the target channel meets the corresponding functional requirements. By binding or switching the target channel connected to the target port, the first device can improve the ability of the first device to access the target device in different application scenarios.

[0031] In a third aspect, an embodiment of the present application provides a device for port multiplexing, the device comprising:

[0032] A communication unit, configured to receive a mode parameter generated in response to a user invoking a preset first command, wherein the preset first command is used to set a usage mode of a target port;

[0033] a processing unit, configured to bind the target port to a target channel based on the mode parameter, wherein the target channel corresponds to the mode parameter;

[0034] The communication unit is further used to transmit the target data to the target device through the target channel in response to the user's operation of calling a preset second command.

[0035] In an optional solution of the third aspect, the processing unit, specifically configured to bind the target port to the target channel based on the mode parameter, includes:

[0036] generating a control command based on the mode parameters;

[0037] The control command is sent to the target device, so that the target device opens the target channel for binding with the target port.

[0038] In an optional solution of the third aspect, the processing unit, specifically configured to, before binding the target port to the target channel based on the mode parameter, includes:

[0039] In response to the user's operation of calling the preset third command, the driver is reloaded.

[0040] In an optional solution of the third aspect, the method includes:

[0041] A processing unit, configured to generate a mode parameter in response to a user calling a preset first command; wherein the preset first command is used to set a usage mode of a target port;

[0042] a processing unit, configured to send the mode parameter to a driver, so that the driver binds a target port to a target channel based on the mode parameter, wherein the target channel corresponds to the mode parameter;

[0043] The communication unit is used to send the target data to the driver in response to the user's operation of calling the preset second command, so that the driver transmits the target data to the target device through the target channel.

[0044] In an optional solution of the third aspect, the processing unit is specifically configured to generate the mode parameter in response to the operation of the user calling the preset first command, including:

[0045] In response to a user's operation of calling the preset first command through a preset application, the mode parameter generated by the preset application is acquired, wherein the preset application is an application based on a preset framework linked to a target device.

[0046] In an optional solution of the third aspect, the communication unit, specifically used for receiving the mode parameter generated in response to the user calling the preset first command, further includes:

[0047] Registration is based on the target port within the preset framework.

[0048] In an optional solution of the third aspect, the processing unit, specifically configured to bind the target port to the target channel based on the mode parameter, includes:

[0049] Determine the target channel from one or more channels based on the mode parameter, wherein the multiple channels correspond to one usage mode of the target port, or the channels correspond to multiple usage modes of the target port;

[0050] Bind the target port to the target channel.

[0051] In a fourth aspect, an embodiment of the present application provides a computer device, comprising a processor and a memory; the processor is coupled to the memory, the memory is used to store a computer program, and the processor is used to call and run the computer program so that the computer device executes the method described in any one of the first aspects above.

[0052] Optionally, the computer device further comprises a communication interface, wherein the communication interface is used to receive and / or send data, and / or the communication interface is used to provide input and / or output for the processor.

[0053] It should be noted that the above embodiment is described by taking a processor (or general-purpose processor) that executes the method by calling a computer specification as an example. In the specific implementation process, the processor can also be a dedicated processor, in which case the computer instructions have been pre-loaded in the processor. Optionally, the processor can also include both a dedicated processor and a general-purpose processor.

[0054] Optionally, the processor and the memory may also be integrated into one device, that is, the processor and the memory may also be integrated together.

[0055] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer or a processor, the method described in any one of the first or second aspects above is implemented.

[0056] The beneficial effects of the technical solutions provided in the third to fifth aspects of the present application can refer to the beneficial effects of the technical solutions in the first and second aspects, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] The following is a brief introduction to the drawings required for describing the embodiments.

[0058] Figure 1 is a schematic diagram of enumerating multiple ports provided in an embodiment of the present application;

[0059] Figure 2 This is a schematic diagram of a system architecture for port multiplexing provided in an embodiment of the present application;

[0060] Figure 3 This is a flow chart of a method for port multiplexing provided in an embodiment of the present application;

[0061] Figure 4 is a schematic diagram of a target device provided in an embodiment of the present application;

[0062] Figure 5 is a schematic diagram of another target device provided in an embodiment of the present application;

[0063] Figure 6 It is a schematic diagram of a process of setting a target port provided by an embodiment of the present application;

[0064] Figure 7 It is a flowchart of binding a target channel provided by an embodiment of the present application;

[0065] Figure 8 It is a schematic diagram of a process of obtaining data from a target device provided by an embodiment of the present application;

[0066] Fig. 9 It is a schematic diagram of a process of restoring a normal port provided by an embodiment of the present application;

[0067] Fig.10 This is a block diagram of the functional units of a port multiplexing device provided in an embodiment of the present application;

[0068] Fig.11 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0069] The embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0070] The terms "first", "second", "third" and "fourth" etc. in the specification and claims of the present application and the drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.

[0071] In order to facilitate the understanding of the embodiments of the present application, the technical problems that the present application specifically aims to solve are analyzed and proposed below.

[0072] At present, the mobile broadband (Wireless Wide Area Network, WWAN) devices used on the personal computer (PC) are usually devices based on the universal serial bus (USB) interface and / or the high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express, PCIe) interface. Among them, the high-speed devices in the mobile broadband devices are mainly devices based on the PCIe interface.

[0073] When the first device needs to access the target device, for example, the first device is the above-mentioned computer and the target device is a device based on the PCIe interface, the driver for the target device in the driver layer of the software part of the first device usually enumerates multiple port forms. The above-mentioned multiple port forms are used by the operating system of the first device to access the target device in different application scenarios to achieve different functions. For example, when a firmware upgrade is required, the first device enumerates the burning port, and the burning port is used to transmit data related to the firmware upgrade to the target device. When it is necessary to collect a dump log, the first device enumerates a dump port for dumping the log of the target device. When it is necessary to capture the log of the target device, the first device enumerates a log port for capturing the log of the target device.

[0074] However, each port needs to be supported by a corresponding driver program in the driver layer of the first device, and also needs to be supported by a corresponding application program in the user layer of the first device. In other words, it is necessary to develop multiple driver programs in the driver layer of the first device to enumerate the corresponding ports respectively. It is also necessary to develop multiple application programs in the user layer of the first device to control the ports in the driver layer respectively to realize the corresponding functions.

[0075] For example, see Figure 1 , Figure 1 is a schematic diagram of enumerating multiple ports provided in an embodiment of the present application. Figure 1 As shown, a Linux system is deployed in the first device, and there are a driver layer and a user layer in the operating system (OS) of the Linux system. When the first device accesses the target device in different application scenarios, the first device usually issues a control command through a control channel provided by the driver of the target device in the driver layer, thereby triggering the driver of the target device in the driver layer to re-enumerate different ports to correspond to different application scenarios. For example, Figure 1 Port A, port B and port C etc. enumerated in the driver layer of the first device in the control channel. The control channel includes but is not limited to an AT channel, a Mobile Broadband Interface Model (MBIM) channel, a Qualcomm Mobile Interface (QMI) channel etc.

[0076] like Figure 1As shown, the user layer includes multiple applications (Program), such as application A, application B and application C. The user layer is used to deploy application software (Application, APP), and the user can control the first device to implement the corresponding function through the application software. The operating system of the first device controls the ports in the driver layer respectively through different applications in the user layer, so as to implement different functions through different ports. Among them, application A is used to control port A, application B is used to control port B, application C is used to control port C, and so on.

[0077] For example, if the first device wants to implement the function corresponding to application A, the first device can control port A through application A to perform data transmission with the target device, thereby implementing the function corresponding to application A.

[0078] As can be seen from the above, when the first device implements a certain function by accessing the target device, the driver layer of the first device needs to have a port corresponding to the above function to establish a connection with the target device. The user layer of the first device also needs to have an application corresponding to the above function to control the corresponding port in the driver layer to implement the corresponding function. This will cause the following problems:

[0079] Problem 1: Since the ports of the first device are of many types and have different functions, it is necessary to develop drivers corresponding to these ports in the driver layer of the first device. When using the ports, the first device enumerates the required ports through the corresponding drivers.

[0080] Question 2: For the functions of the ports, corresponding applications need to be developed to handle the corresponding business, so corresponding applications are required for the specific functions of multiple ports.

[0081] Question 3: Since the ports used by different platform manufacturers are not unified, different target devices need to be independently installed and used with different applications to access different target devices.

[0082] Therefore, each port used by the first device needs to have a corresponding driver and application, which leads to the need to develop multiple drivers and multiple applications. However, multiple drivers and multiple applications are limited in number in terms of development, application, and maintenance. As a result, the applicability of accessing the target device through the port on the first device is not high and the operation convenience is low.

[0083] In summary, the embodiment of the present application provides a method for port multiplexing, wherein the driver layer of the software part of the first device receives the mode parameter generated in response to the operation of the user calling the preset first command, and binds the target port of the driver layer to the target channel of the software part of the target device based on the mode parameter. Since the preset first command corresponds to the usage mode of the target port, in the above usage mode, the driver layer of the first device can transmit the target data to the target device through the target channel in response to the operation of the user calling the preset second command, thereby realizing the function corresponding to the usage mode of the target port. Compared with the existing scheme, the embodiment of the present application binds the target port to the target channel through the usage mode of the target port selected by the user to realize the function corresponding to the usage mode. Instead of generating a port according to the function required by the first device, the embodiment of the present application can realize the purpose of the functions corresponding to different usage modes through one target port, thereby enhancing the applicability of the first device to access the target device.

[0084] In order to more clearly describe the solution of the present application, some of the terms involved in the present application are explained below.

[0085] Device Link (Device Link, Devlink) is an association mechanism between an operating system and a hardware device. Through device drivers and device links, the system can communicate and control the hardware device. For example, in the embodiment of the present application, the operating system of the first device establishes a connection with the target device through the target port under the preset framework of Devlink, and the first device controls the target port to communicate and control the target device through the application under the preset framework of Devlink.

[0086] The following is an introduction to the system architecture of the embodiment of the present application. It should be noted that the system architecture and business scenarios described in this application are intended to more clearly illustrate the technical solution of this application, and do not constitute a limitation on the technical solution provided by this application. It is known to those skilled in the art that with the evolution of the system architecture and the emergence of new business scenarios, the technical solution provided by this application is also applicable to similar technical problems.

[0087] See also Figure 2 , Figure 2 Schematic diagram of a system architecture of port multiplexing provided in an embodiment of the present application. Figure 2As shown, the port multiplexing system includes a first device 20 and a target device 21. The target device 21 can be integrated in the first device 20 or outside the first device 20. When the target device 21 is integrated in the first device 20, the target device 21 establishes a physical connection with the first device 20 through a hardware interface on the first device 20. When the target device 21 is outside the first device 20, the first device 20 and the target device 21 are connected through a bus. The bus can be a PCIe bus.

[0088] The first device 20 is a device with data processing and communication capabilities, and may include but is not limited to: a computer, a desktop computer, a laptop computer, a mobile device, a communication platform, etc. The first device 20 is equipped with a Linux system, and the operating system (OS) of the Linux system includes a driver layer and a user layer.

[0089] The driver layer of the first device 20 includes a driver program related to the target device 21. The driver program related to the target device 21 can register a target port based on a preset framework, such as a Devlink port. The Devlink port is a logical port based on the Devlink framework, corresponding to Figure 2 The destination port in .

[0090] The user layer of the first device 20 is used to interact with the user. For example, the first device 20 generates a mode parameter through the user layer in response to the user's operation of calling a preset first command. The preset first command is used to set the use mode of the target port. The user layer of the first device 20 is also used to send the target data to the driver layer of the first device 20 in response to the user's operation of calling a preset second command. Therefore, the user layer of the first device 20 can determine the use mode of the target port in response to the user's operation, and the user layer of the first device 20 can also implement the function corresponding to the use mode of the target port in response to the user's operation.

[0091] The user layer of the first device 20 also includes an application program, and the first device 20 controls the target port through the application program to implement the corresponding function. For example, the user layer of the first device 20 obtains the mode parameters generated by the preset application program in response to the user calling the preset first command through the preset application program. Among them, the application program is an application program based on the preset framework of the target device link, such as an application program based on the Devlink framework. Exemplarily, the application program can be a Devlink program. Since the Devlink program can directly call the driver program based on the Devlink framework, the application APP in the user layer of the first device 20, such as the Devlink application, can realize function multiplexing by controlling the target port.

[0092] The target device 21 is a device based on a PCIe interface. For example, the target device 21 may be a high-speed mobile broadband device, a network card, a data card, an Internet access module, and the like.

[0093] Exemplarily, the first device 20 generates a mode parameter through the user layer in response to the user calling the preset first command operation, and then the first device 20 sends the mode parameter to the driver layer through the user layer. The driver layer binds the target port to the target channel based on the mode parameter. The first device 20 sends the target data to the driver layer through the user layer in response to the user calling the preset second command operation. The driver layer transmits the target data to the target device 21 through the target channel.

[0094] It is understandable that, since the application based on the Devlink framework can communicate with the target port based on the Devlink framework, it is equivalent to that no matter what use mode the target port is in, the application of the first device 20 can control the target port to interact with the target device 21, thereby realizing the corresponding function. Therefore, the first device 20 opens up the communication between the user layer and the driver layer of the first device 20 and reaches the device layer of the target device 21 through the Devlink framework. The purpose of multiplexing the functions of multiple logical ports through one target port is achieved.

[0095] In addition, Figure 1 compared to, Figure 1 The first device needs to enumerate the corresponding ports for each usage mode, and also needs to set the corresponding application for each port to realize different functions. However, the embodiment of the present application can realize multiple functions through one target port and one application, which brings convenience to the development and maintenance of drivers and applications. In addition, Figure 1 Multiple ports in the first device are simultaneously exposed to the operating system of the first device, which has low security. In the embodiment of the present application, the target port for realizing multiple functions is not exposed to the user layer, which shields the difference of the user layer and improves security.

[0096] See also Figure 3 , Figure 3 is a flow chart of a method for port multiplexing provided in an embodiment of the present application, and the method is applied to Figure 2 The driver layer of the first device shown. Figure 3 As shown, the method includes but is not limited to the following steps:

[0097] Step S301: receiving a mode parameter generated in response to a user invoking a preset first command.

[0098] Specifically, in order to realize different functions, the driver layer of the first device needs to communicate with the software of the target device through the corresponding port. Therefore, before establishing a connection between the software of the first device and the software of the target device, the use mode of the target port can be determined according to the function to be realized.

[0099] Since the target port used in the embodiment of the present application can reuse functions corresponding to multiple logical ports, that is, the target port has multiple different usage modes, the driver layer of the first device can first determine the required usage mode from the multiple usage modes of the target port.

[0100] Furthermore, since the function to be implemented by the first device can be determined according to the needs of the user, the driver layer of the first device can determine the usage mode of the target port according to the specific needs of the user. Specifically, the driver layer of the first device receives the mode parameter generated in response to the user's operation of calling the preset first command. Among them, the preset first command can correspond to the usage mode of the target port, and the user selects the required usage mode of the target port by calling the preset first command. The driver layer of the first device can determine the usage mode of the target port selected by the user by receiving the mode parameter generated in response to the user's operation of calling the preset first command.

[0101] For example, a user wants to upgrade the firmware of a target device through a first device. And the first device can implement the firmware upgrade of the target device by sending firmware data to the target device. Therefore, the user can set the use mode of the target port to firmware upgrade by calling the operation of the preset first command. The first device generates a mode parameter corresponding to the firmware upgrade in response to the operation of the preset first command called by the user. The driver layer of the first device can receive the mode parameter corresponding to the firmware upgrade.

[0102] For example, a user wants to capture the log of a target device through a first device, so the user can set the usage mode of the target port to capture logs by calling the operation of a preset first command. The first device generates a mode parameter corresponding to the capture log in response to the operation of the preset first command called by the user. The driver layer of the first device can receive the mode parameter corresponding to the capture log.

[0103] Step S302: Bind the target port to the target channel based on the mode parameter.

[0104] Specifically, the driver layer of the first device can bind the target port to the target channel based on the mode parameter. Since the target port corresponds to multiple usage modes, that is, the target port corresponds to the functions of multiple logical ports. Therefore, the mode parameter can be used to determine the usage mode of the target port. Since the first device needs to bind the target port in the driver layer of the first device and the target channel in the software of the target device to implement the corresponding function, the mode parameter is also used to determine the target channel in the software of the target device.

[0105] In a possible implementation, the driver layer of the first device generates a control command based on the mode parameter and sends the control command to the target device. The driver layer of the first device enables the target device to open the target channel through the control command for binding with the target port.

[0106] Specifically, the driver layer of the first device generates a control command based on the mode parameter, and then the driver layer of the first device sends the control command to the target device through the internal control channel, so that the target device opens the target channel. After the driver layer of the first device opens the target channel corresponding to the target device, the driver layer of the first device can also establish a connection for the driver layer of the first device and the software of the target device to perform data transmission by controlling the read / write input / output (IO) processing method of the target channel. That is, the first device can bind the target port to the read / write IO processing method of the target channel. By controlling the read / write IO processing method of the target channel, the driver layer of the first device can receive data from the target device through the target channel based on the target port, and the first device can also send data to the target device through the target channel based on the target port.

[0107] In a possible implementation, before the driver layer of the first device binds the target port to the target channel based on the mode parameter, the driver layer of the first device reloads the driver in response to the user's operation of calling a preset third command.

[0108] Specifically, the first device reloads the driver corresponding to the target device in the driver layer through the user layer. After reloading the driver corresponding to the target device, the driver layer of the first device can enable the target device to open the target channel through a control command.

[0109] Exemplarily, the driver layer of the first device may execute a Devlink Reload command through the user layer to reload the driver corresponding to the target device in the driver layer. The Devlink Reload command is used to reload or refresh the status of a device link.

[0110] In a possible implementation, the driver layer of the first device determines a target channel from one or more channels based on the mode parameter, and then binds the target port to the target channel.

[0111] The multiple channels of the target device respectively correspond to a usage mode of the target port, or the channels correspond to multiple usage modes of the target port.

[0112] Specifically, since a certain function is implemented by accessing the software of the target device through the software of the first device, in addition to the target port of the first device needing to support the above function, the target channel of the target device also needs to support the above function. Therefore, the driver layer of the first device can determine the target channel that supports the above function from one or more channels of the target device based on the mode parameter to establish a connection with the target port of the first device.

[0113] In a possible implementation, the target device includes a plurality of channels, and the plurality of channels respectively correspond to a usage mode of the target port, that is, the plurality of channels are respectively used to implement different functions.

[0114] Specifically, the channels of the target device can be multiple ports enumerated in the target device. Among them, the target device can enumerate the corresponding ports according to the functions to be implemented, that is, the target device can enumerate multiple ports to correspond to different functions. Therefore, at this time, each port of the target device corresponds to a function. If the first device wants to implement a certain function, it can establish a connection with a port of the target device, or simultaneously establish connections with multiple ports of the target device. That is, the driver layer of the first device can determine one or more target channels from multiple channels of the target device, and then bind the target port to the above one or more target channels.

[0115] For example, the target device may enumerate multiple ports such as a port corresponding to a burning function and a port corresponding to a logging function, and each port corresponds to a function of a logical port.

[0116] The first device establishes a connection with the port of the target device through the target port, which can be understood as the first device establishes a connection with the functional channel or logical channel (i.e., target channel) of the target device through the target port. The first device can bind the functional channel or logical channel of the target device through the target port. After the first device binds with the functional channel or logical channel of the target device through the target port, the first device can also switch to other functional channels or logical channels for binding through the target port.

[0117] For example, see Figure 4 , Figure 4 is a schematic diagram of a target device provided in an embodiment of the present application, such as Figure 4As shown, the target device can enumerate multiple ports, such as Figure 4 Port A, port B and port C in the target device, etc. The driver layer of the first device can establish a connection with one or more ports in the target device through the target port.

[0118] For example, Figure 4 In the example, the first device can establish a connection with port B in the target device through the target port, thereby binding the target port to the target channel, and the first device can implement the corresponding function based on the target port and port B. The first device can also establish connections with multiple ports simultaneously through the target port, for example, the first device establishes connections with port B and port C simultaneously through the target port. Therefore, the first device can implement the corresponding function through the connection established between the target port and port B, and the connection established between the target port and port C at the same time.

[0119] In a possible implementation, the target device includes a channel, and the channel corresponds to multiple usage modes of the target port, that is, the channel is used to implement multiple different functions.

[0120] Specifically, the channel of the target device may be a port enumerated in the target device. This port may correspond to the functions of multiple logical ports, that is, this port corresponds to multiple functional channels. The driver layer of the first device may determine the corresponding functional channel from the multiple functional channels of this port according to the mode parameter of the target port, and then establish a connection between the target port of the first device and the target channel of the target device through the determined functional channel.

[0121] Specifically, the target device itself only embodies one port in the driver, and the target device can realize the functions of multiple logical ports through this port. If the first device wants to realize a certain function, it can establish a connection with this port.

[0122] For example, this port in the target device may correspond to the function of a burning port, may correspond to the function of a log port, or may correspond to the function of other logical ports, which is not limited here.

[0123] For example, see Figure 5 , Figure 5 is a schematic diagram of another target device provided in an embodiment of the present application. Figure 5 As shown, the target device includes a port, and the port can correspond to the functions of multiple logical ports. For example, the port can correspond to the function of port A, the port can correspond to the function of port B, the port can correspond to the function of port C, or the port can also correspond to the functions of other ports, and so on.

[0124] The driver layer of the first device can establish a connection with the port in the target device through the target port. Figure 5 The ports in the target port can correspond to the functions of multiple logical ports. Therefore, the first device communicates with the target port through the target port. Figure 5 When establishing a connection with the port in Figure 5 The ports in the table need to have corresponding logical port functions. Figure 5 A connection is established between the function channel of the corresponding port A, the function channel of the corresponding port B, the function channel of the corresponding port C, or the function channel of other corresponding ports.

[0125] In a possible implementation, the driver layer registration of the first device is based on a target port within a preset framework.

[0126] Exemplarily, the preset framework may be a device link Devlink framework, so the target port may be a Devlink port based on the device link Devlink framework. Furthermore, based on the device link Devlink framework, the driver layer of the first device may implement a multiplexing state machine. The driver layer of the first device dynamically binds or switches with the functional channel of the target device according to the mode parameter of the target port through the multiplexing state machine.

[0127] For example, when the mode parameter of the target port is the first mode parameter, the driver layer of the first device binds or switches the target port with the target channel corresponding to the first mode parameter in the target device through the multiplexing state machine.

[0128] Step S303: in response to the user invoking the preset second command, the target data is transmitted to the target device through the target channel.

[0129] Specifically, after the target port and the target channel are bound, the driver layer of the first device can access the target device through the target channel to implement certain functions. The driver layer of the first device triggers the function of the target port in response to the user's operation of calling the preset second command, thereby implementing the function corresponding to the preset second command through the target channel.

[0130] Exemplarily, in the use mode where the target port is a download port, the driver layer of the first device reads the firmware data transmitted from the user layer to the target port and then sends the firmware data to the target device through the target channel. The target channel here can be determined based on the internal download logic channel of the target device.

[0131] Among them, the preset second command for downloading can be a Devlink Flash command, which is used to control or manage flash memory devices in computer systems. In many embedded systems and IoT devices, flash memory devices are often used to store firmware, file systems, or other critical data. By using the Devlink Flash command, the first device can perform various operations, such as erasing, writing, or reading the contents of the flash memory device. It can also be used for operations such as updating firmware, restoring factory settings, and backing up data. The first device can send firmware data to the driver of the driver layer through the Devlink Flash command.

[0132] Exemplarily, when the target port is a dump port, the driver layer of the first device obtains the dump information from the target device through the target port, and then the first device reads the dump information from the IO port inside the driver layer through the user layer based on a preset second command, and then saves the dump information in a file in the user layer.

[0133] The preset second command for the Dump information may be a Devlink Region command. The Devlink Region command is used to manage resource allocation, and the Devlink Region command stores the resources after applying for them. For example, the user layer of the first device reads the Dump information through the Devlink Region command, and then saves the Dump information in a file of the user layer.

[0134] The above embodiment is a method for implementing port multiplexing based on the driver layer of the first device. The port multiplexing method based on the first device will be specifically introduced below.

[0135] In a possible implementation, the first device generates a mode parameter in response to a user calling a preset first command, and then sends the mode parameter to a driver, so that the driver binds the target port to the target channel based on the mode parameter. Finally, the first device sends target data to the driver in response to a user calling a preset second command, so that the driver transmits the target data to the target device through the target channel.

[0136] In a possible implementation, the first device generates corresponding mode parameters by responding to the user's operation of calling a preset first command through the user layer, wherein the preset first command is used to set the use mode of the target port.

[0137] Specifically, since the target port can reuse the functions corresponding to multiple logical ports, the target port includes multiple different usage modes, each usage mode corresponding to a different function. The first device generates a mode parameter in response to the user calling the operation of the preset first command, which is equivalent to the first device determining the usage mode corresponding to the preset first command from the multiple usage modes of the target port.

[0138] Among them, the usage mode of the target port can be a usage mode corresponding to the specific form of the target port. For example, when a firmware upgrade is required, the usage mode of the target port can be a usage mode corresponding to the form of a burning port, and the burning port is used to transmit data related to the firmware upgrade to the target device. When it is necessary to collect dump logs, the usage mode of the target port can be a usage mode corresponding to the form of a dump port, which is used to dump the logs of the target device. When it is necessary to capture the logs of the target device, the usage mode of the target port can be a usage mode corresponding to the form of a log port, which is used to capture the logs of the target device.

[0139] Exemplarily, after determining the mode parameters of the target port, the first device configures the target port through the driver layer.

[0140] For example, after the first device determines the mode parameters of the target port through the user layer, the first device configures the target port according to the mode parameters of the target port through the driver layer. For example, the first device determines through the user layer that the user needs to realize the function of grabbing the log of the target device. After the first device determines the mode parameters of the target port according to the function that the user needs to realize, the first device sends a command to set the port form to the driver layer through the user layer. After receiving the command to set the port form, the driver layer can configure the target port according to the mode parameters of the target port so that the form of the target port meets the functional requirements of the user.

[0141] The first device configures the state of the target port by calling the Devlink Param command through the user layer. The Devlink Param command is used to manage the parameters of the device link in the Linux system.

[0142] In a possible implementation, the first device obtains a mode parameter generated by a preset application in response to a user calling a preset first command through a preset application. Specifically, the user layer in the first device includes an application, and the first device controls the target port through the application to implement a corresponding function. The application is an application based on a preset framework for linking the target device. For example, the application may be an application based on a Devlink framework. Exemplarily, the application may be a Devlink program. Since the Devlink program can directly call a driver based on the Devlink framework, the application APP in the user layer of the first device, such as the Devlink application, can implement function multiplexing by controlling the target port.

[0143] Exemplarily, the user may call the preset first command through a preset application. The first device may respond to the user's operation of calling the preset first command through the preset application, and the first device may generate the mode parameter through the preset application.

[0144] For example, see Figure 6 , Figure 6 is a flow chart of setting a target port provided by an embodiment of the present application, such as Figure 6 As shown, the first device includes a user space and a kernel space, the user space is the user layer in the embodiment of the present application, and the kernel space is the driver layer in the embodiment of the present application. Figure 6 As shown, the process of setting the target port includes but is not limited to the following steps:

[0145] S601: An instruction for setting a target port form. The first device sends an instruction for setting a target port form to the kernel space through the user space, wherein the instruction may be Devlink Param Set Port Function.

[0146] S602: Setting success signal: The kernel space in the first device sets the form of the target port according to the instruction from the user space. After the setting is completed, the first device sends a setting success signal to the user space through the kernel space.

[0147] In a possible implementation, the first device sends the mode parameter to the driver of the driver layer through the user layer, so that the driver binds the target port to the target channel based on the mode parameter, wherein the target channel corresponds to the mode parameter.

[0148] For example, see Figure 7 , Figure 7 FIG. 1 is a flow chart of binding a target channel provided in an embodiment of the present application. Figure 7As shown, the first device includes a user space and a kernel space, the user space is the user layer in the embodiment of the present application, and the kernel space is the driver layer in the embodiment of the present application. Figure 7 As shown, the process of binding the target channel includes but is not limited to the following steps:

[0149] S603: Re-adapt the port command. The first device sends a re-adapt the port command to the kernel space through the user space. Specifically, the re-adapt the port command is used to reload the driver corresponding to the target device in the kernel space. The re-adapt the port command may be Devlink Dev Reload.

[0150] S604: Command to bind the target channel. After receiving the command to re-adapt the port, the kernel space of the first device sends a command to bind the target channel to the target device through the kernel space. The command to bind the target channel is used to open the target channel corresponding to the target device, that is, to open the corresponding functional channel or logical channel in the target device.

[0151] S605: Channel establishment message: After the target port and the target channel are bound, the target device sends a channel binding message to the kernel space of the first device.

[0152] S606: Internal channel binding message. After receiving the channel binding message from the target device, the kernel space of the first device sends an internal channel binding message to the user space of the first device, thus completing the binding of the target port and the target channel.

[0153] In a possible implementation, the first device sends the target data to the driver of the driver layer through the user layer in response to the user calling the preset second command operation. The driver transmits the target data to the target device through the target channel. For example, see Figure 8 , Figure 8 FIG. 1 is a flow chart of obtaining data from a target device provided by an embodiment of the present application. Figure 8 As shown, the first device includes a user space and a kernel space, the user space is the user layer in the embodiment of the present application, and the kernel space is the driver layer in the embodiment of the present application. Figure 8 As shown, the process of obtaining data from the target device includes but is not limited to the following steps:

[0154] S607: Sending a function instruction about the target port. When the first device needs to obtain data from the target device, the first device sends a function instruction about the target port to the kernel space through the user space. The function instruction about the target port may be a Devlink Flash command or a Devlink Region command.

[0155] S608: The first data is transmitted to the target device. After the kernel space of the first device receives the function instruction, the first data is generated based on the function instruction. The first device sends the first data to the target device through the target port of the kernel space, for example, the first device sends the first data to the modem of the target device, and the first data is used to request the second data from the target device.

[0156] S609: Transmitting the second data to the driver. After receiving the first data, the target device sends the second data to the driver in the kernel space of the first device through the target channel. At this time, the second data from the target device is transmitted from the target device to the driver of the first device.

[0157] S610: The second data is transmitted to the user space. The kernel space of the first device then sends the second data to the user space, so that the user space receives the second data, thereby completing the function of the first device acquiring data from the target device.

[0158] In a possible implementation, after the first device implements the corresponding function through the target port, the first device can set the usage mode of the target port to the usage mode of a normal port, wherein the usage mode of a normal port means that the target port in a normal port state has basic functions but does not have the functions of a special port.

[0159] Specifically, the first device determines the mode parameters of the target port as the mode parameters corresponding to the normal port through the user layer. Then, the mode parameters of the normal port are sent to the driver layer of the first device. The driver of the first device configures the target port according to the mode parameters of the normal port. After the configuration is completed, the user layer of the first device reloads the driver, and the target port is bound to the normal target channel in the target device. Among them, the normal target channel refers to a target channel that has basic functions and does not have the functions of a special channel.

[0160] Exemplarily, the first device calls the Devlink Param command through the user layer to configure the usage mode of the target port, and configures the usage mode of the target port to the usage mode of a normal port. The first device can execute the Devlink Reload command through the user layer to reload the driver corresponding to the target device in the driver layer, so that the target port is bound to the normal target channel of the target device.

[0161] For example, see Fig. 9 , Fig. 9 FIG. 1 is a flow chart of restoring a normal port provided by an embodiment of the present application. Fig. 9 As shown, the first device includes a user space and a kernel space, the user space is the user layer in the embodiment of the present application, and the kernel space is the driver layer in the embodiment of the present application. Fig. 9As shown, the process of restoring a normal port includes but is not limited to the following steps:

[0162] S611: A command for setting a normal port. The first device sends a command for setting a normal port to the kernel space through the user space, wherein the command for setting a normal port may be Devlink Param Set Port Function.

[0163] S612: Setting success signal: The kernel space in the first device sets the usage mode of the target port according to the command from the user space. After the setting is completed, the first device sends a setting success signal to the user space through the kernel space.

[0164] S613: Re-adapt the normal port command. The first device sends a re-adapt the normal port command to the kernel space through the user space. Specifically, the re-adapt the normal port command is used to reload the driver corresponding to the target device in the kernel space. The re-adapt the normal port command may be Devlink Dev Reload.

[0165] S614: Command to set a normal channel. After receiving the command to re-adapt the normal port, the kernel space of the first device sends a command to set a normal channel to the target device through the kernel space. The command to set a normal channel is used to open the normal channel corresponding to the target device.

[0166] S615: Normal channel establishment message: After the target port is bound to the normal target channel of the target device, the target device sends a normal channel establishment message to the kernel space of the first device.

[0167] S616: Normal channel enumeration message. After receiving the normal channel establishment message from the target device, the kernel space of the first device sends a normal channel enumeration message to the user space of the first device to wait for the next setting of the target port usage mode by the first device.

[0168] The method of the embodiment of the present application is described in detail above, and the device of the embodiment of the present application is provided below.

[0169] See also Fig.10 , Fig.10 1 is a block diagram of the functional units of a port multiplexing device provided in an embodiment of the present application. The port multiplexing device 100 may include a communication unit 1001 and a processing unit 1002. The port multiplexing device 100 is used to implement the aforementioned port multiplexing method, for example Figure 3 The port multiplexing method shown.

[0170] It should be noted that the division of the above multiple units is only a logical division based on function, and does not limit the specific structure of the port multiplexing device 100. In a specific implementation, some functional modules may be subdivided into more small functional modules, and some functional modules may also be combined into one functional module.

[0171] In a possible implementation, the communication unit 1001 is used to receive a mode parameter generated in response to a user calling a preset first command, wherein the preset first command is used to set a usage mode of a target port;

[0172] The processing unit 1002 is configured to bind the target port to the target channel based on the mode parameter, wherein the target channel corresponds to the mode parameter;

[0173] The communication unit 1001 is further configured to transmit the target data to the target device through the target channel in response to the user invoking the preset second command.

[0174] In an optional solution of the third aspect, the processing unit 1002 is specifically configured to bind the target port to the target channel based on the mode parameter, including:

[0175] generating control commands based on mode parameters;

[0176] The control command is sent to the target device so that the target device opens the target channel for binding with the target port.

[0177] In an optional solution of the third aspect, the processing unit 1002 is specifically configured to, before binding the target port to the target channel based on the mode parameter, include:

[0178] In response to the user's operation of calling the preset third command, the driver is reloaded.

[0179] In an optional solution of the third aspect, the method includes:

[0180] The processing unit 1002 is used to generate a mode parameter in response to a user calling a preset first command operation; wherein the preset first command is used to set a usage mode of a target port;

[0181] A processing unit 1002 is configured to send a mode parameter to a driver, so that the driver binds a target port to a target channel based on the mode parameter, wherein the target channel corresponds to the mode parameter;

[0182] The communication unit 1001 is used to send target data to the driver in response to the user's operation of calling the preset second command, so that the driver transmits the target data to the target device through the target channel.

[0183] In an optional solution of the third aspect, the processing unit 1002 is specifically configured to generate a mode parameter in response to a user invoking an operation of a preset first command, including:

[0184] In response to a user's operation of calling a preset first command through a preset application, a mode parameter generated by the preset application is obtained, wherein the preset application is an application based on a preset framework linked to a target device.

[0185] In an optional solution of the third aspect, the communication unit 1001 is specifically configured to receive a mode parameter generated in response to a user invoking a preset first command, and further includes:

[0186] Registration is based on the target port inside the preset framework.

[0187] In an optional solution of the third aspect, the processing unit 1002 is specifically configured to bind the target port to the target channel based on the mode parameter, including:

[0188] Determine a target channel from one or more channels based on the mode parameter, wherein the multiple channels correspond to a usage mode of the target port, or the channels correspond to multiple usage modes of the target port;

[0189] Bind the destination port to the destination channel.

[0190] It should be noted that in the embodiments of the present application, the specific implementation and technical effects of each unit can also refer to Figure 3 The corresponding description of the method embodiment shown in .

[0191] See also Fig.11 , Fig.11 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.11 As shown, the computer device 110 may include: one or more processors 1101, one or more memories 1102, and one or more communication interfaces 1103. These components may be connected via a bus 1104 or other means. Fig.11 Take the connection via bus 1104 as an example.

[0192] The communication interface 1103 may be used for the computer device 110 to communicate with other communication devices, such as other computer devices. Specifically, the communication interface 1103 may be a wired interface.

[0193] The memory 1102 can be coupled to the processor 1101 through the bus 1104 or the input and output ports, and the memory 1102 can also be integrated with the processor 1101. The memory 1102 is used to store various software programs and / or multiple sets of instructions or data. Specifically, the memory 1102 can be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 1102 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices or other non-volatile solid-state storage devices. The memory 1102 may store an operating system (hereinafter referred to as system), such as an embedded operating system such as uCOS, VxWorks, RTLinux, etc. The memory 1102 may also store a network communication program, which may be used to communicate with one or more additional devices, one or more user devices, or one or more terminals. The memory 1102 may be independent and connected to the processor 1101 via a bus 1104. The memory 1102 may also be integrated with the processor 1101.

[0194] The memory 1102 is used to store application code for executing the above solution, and the execution is controlled by the processor 1101. The processor 1101 is used to execute the application code stored in the memory 1102.

[0195] Processor 1101 may be a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. Processor 1101 may also be a combination that implements a certain function, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like.

[0196] In the embodiment of the present application, the processor 1101 may be used to read and execute computer-readable instructions. Specifically, the processor 1101 may be used to call a program stored in the memory 1102 to perform the following operations:

[0197] Receiving, through the communication interface 1103, a mode parameter generated in response to a user calling a preset first command, wherein the preset first command is used to set a usage mode of the target port;

[0198] Binding a target port to a target channel based on a mode parameter, wherein the target channel corresponds to the mode parameter;

[0199] In response to a user's operation of invoking a preset second command, the target data is transmitted to the target device through the target channel.

[0200] In a possible implementation manner, the processor 1101 is specifically configured to:

[0201] generating control commands based on mode parameters;

[0202] The control command is sent to the target device through the communication interface 1103, so that the target device opens the target channel for binding with the target port.

[0203] In a possible implementation manner, the processor 1101 is specifically configured to:

[0204] In response to the user's operation of calling the preset third command, the driver is reloaded.

[0205] In a possible implementation manner, the processor 1101 is specifically configured to:

[0206] generating a mode parameter in response to a user calling a preset first command operation; wherein the preset first command is used to set a usage mode of the target port;

[0207] Sending the mode parameter to the driver through the communication interface 1103, so that the driver binds the target port to the target channel based on the mode parameter, wherein the target channel corresponds to the mode parameter;

[0208] In response to the user's operation of calling the preset second command, the target data is sent to the driver through the communication interface 1103, so that the driver transmits the target data to the target device through the target channel.

[0209] In a possible implementation manner, the processor 1101 is specifically configured to:

[0210] In response to a user's operation of calling a preset first command through a preset application, a mode parameter generated by the preset application is obtained, wherein the preset application is an application based on a preset framework linked to a target device.

[0211] In a possible implementation manner, the processor 1101 is specifically configured to:

[0212] Registration is based on the target port inside the preset framework.

[0213] In a possible implementation manner, the processor 1101 is specifically configured to:

[0214] Determine a target channel from one or more channels based on the mode parameter, wherein the multiple channels correspond to a usage mode of the target port, or the channels correspond to multiple usage modes of the target port;

[0215] Bind the destination port to the destination channel.

[0216] It should be noted that in the embodiments of the present application, the specific implementation and technical effects of each unit can also refer to Figure 3 The corresponding description of the method embodiment shown in .

[0217] The present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on at least one processor, the aforementioned port multiplexing method is implemented, for example Figure 3 method.

[0218] The present application also provides a computer program product, which includes computer instructions, and when executed by a computing device, implements the aforementioned port multiplexing method, for example Figure 3 method.

[0219] In the embodiments of the present application, the words "for example" or "such as" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "such as" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the words "for example" or "such as" is intended to present related concepts in a specific way.

[0220] The "at least one" mentioned in the embodiments of the present application refers to one or more, and "plurality" refers to two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can be represented by: a, b, c, (a and b), (a and c), (b and c), or (a and b and c), where a, b, c can be single or multiple. "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can be represented by: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0221] Furthermore, unless otherwise specified, the ordinal numbers such as "first" and "second" used in the embodiments of the present application are used to distinguish multiple objects, and are not used to limit the order, timing, priority or importance of multiple objects. For example, the first device and the second device are only for the convenience of description, and do not represent the difference in structure, importance, etc. between the first device and the second device. In some embodiments, the first device and the second device can also be the same device.

[0222] In the above embodiments, the term "when..." can be interpreted as meaning "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the concept and principle of the present application shall be included in the protection scope of the present application.

[0223] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0224] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A port multiplexing method, characterized in that: The method comprises: Receiving a mode parameter generated in response to a user calling a preset first command, wherein the preset first command is used to set a usage mode of the target port; Binding the target port to a target channel based on the mode parameter, wherein the target channel corresponds to the mode parameter; In response to a user's operation of invoking a preset second command, the target data is transmitted to the target device through the target channel.

2. The method according to claim 1, characterized in that The step of binding the target port to the target channel based on the mode parameter comprises: generating a control command based on the mode parameters; The control command is sent to the target device, so that the target device opens the target channel for binding with the target port.

3. The method according to claim 1 or 2, characterized in that: Before binding the target port to the target channel based on the mode parameter, the method includes: In response to the user's operation of calling the preset third command, the driver is reloaded.

4. A port multiplexing method, characterized in that: The method comprises: generating a mode parameter in response to a user calling a preset first command operation; wherein the preset first command is used to set a usage mode of the target port; Sending the mode parameter to a driver so that the driver binds a target port to a target channel based on the mode parameter, wherein the target channel corresponds to the mode parameter; In response to a user's operation of invoking a preset second command, the target data is sent to the driver, so that the driver transmits the target data to the target device through the target channel.

5. The method according to claim 4, characterized in that The generating mode parameter in response to the user calling the preset first command operation includes: In response to a user's operation of calling the preset first command through a preset application, the mode parameter generated by the preset application is acquired, wherein the preset application is an application based on a preset framework linked to a target device.

6. The method according to claim 1, characterized in that Before receiving the mode parameter generated in response to the user calling the preset first command, the method further includes: Registration is based on the target port within the preset framework.

7. The method according to claim 1, characterized in that The step of binding the target port to the target channel based on the mode parameter comprises: Determine the target channel from one or more channels based on the mode parameter, wherein the multiple channels correspond to one usage mode of the target port, or the channels correspond to multiple usage modes of the target port; Bind the target port to the target channel.

8. A port multiplexing device, characterized in that: The device comprises: A communication unit, configured to receive a mode parameter generated in response to a user invoking a preset first command, wherein the preset first command is used to set a usage mode of a target port; a processing unit, configured to bind the target port to a target channel based on the mode parameter, wherein the target channel corresponds to the mode parameter; The communication unit is further used to transmit the target data to the target device through the target channel in response to the user's operation of calling a preset second command.

9. A computer device, characterized in that: The method comprises a processor coupled to a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program, so that the computer device executes the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes instructions for executing the method according to any one of claims 1 to 7.