CN114328325A - USB port management method and device and computer readable storage medium - Google Patents

USB port management method and device and computer readable storage medium Download PDF

Info

Publication number
CN114328325A
CN114328325A CN202111605175.1A CN202111605175A CN114328325A CN 114328325 A CN114328325 A CN 114328325A CN 202111605175 A CN202111605175 A CN 202111605175A CN 114328325 A CN114328325 A CN 114328325A
Authority
CN
China
Prior art keywords
usb
usb port
request
configuration
port
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111605175.1A
Other languages
Chinese (zh)
Inventor
唐雨松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Spreadtrum Communications Shanghai Co Ltd
Original Assignee
Spreadtrum Communications Shanghai Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Spreadtrum Communications Shanghai Co Ltd filed Critical Spreadtrum Communications Shanghai Co Ltd
Priority to CN202111605175.1A priority Critical patent/CN114328325A/en
Publication of CN114328325A publication Critical patent/CN114328325A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Systems (AREA)

Abstract

A management method and device of a USB port and a computer readable storage medium are provided, the method comprises the following steps: acquiring a USB port request, wherein the USB port request is used for requesting to configure a USB port meeting the request; inquiring the configuration file of the USB port meeting the request through a USB configuration manager; when the configuration file of the USB port meeting the request is inquired, the configuration file is imported through the configuration manager to complete the configuration of the USB port meeting the request. Therefore, the configuration work of the USB port can be regularly managed, and the configuration requirement can be flexibly met.

Description

USB port management method and device and computer readable storage medium
Technical Field
The present invention relates to the field of embedded device technologies, and in particular, to a method and an apparatus for managing a USB port, and a computer-readable storage medium.
Background
At present, the variety of the internet of things equipment is more and more, and when a manufacturer needs to support various kinds of equipment, the various kinds of equipment can be adapted on the basis of a general software platform in order to save research and development cost. The requirements for Universal Serial Bus (USB) port combinations may also be different for each device under different scenarios. A large number of USB port combinations are placed on a common software platform and corresponding management methods must be designed to correctly configure and use these combinations.
Therefore, how to provide a management method for USB ports, which can regularly manage the configuration of USB ports and flexibly meet the configuration requirements, is a problem that needs to be solved at present.
Disclosure of Invention
The technical problem solved by the invention is how to regularly manage the configuration work of the USB port and flexibly meet the configuration requirement.
In order to solve the above problem, an embodiment of the present invention provides a method for managing a USB port, where the method includes: acquiring a USB port request, wherein the USB port request is used for requesting to configure a USB port meeting the request; inquiring the configuration file of the USB port meeting the request through a USB configuration manager; when the configuration file of the USB port meeting the request is inquired, the configuration file is imported through the configuration manager to complete the configuration of the USB port meeting the request.
Optionally, the USB port request includes a requested USB type and a USB port number of the requested USB type, and the querying, by the USB configuration manager, the configuration file of the USB port that satisfies the request includes: and inquiring whether the requested USB type exists or not through the USB configuration manager, and if so, inquiring a configuration file of a USB port meeting the request in the requested USB type through the USB configuration manager.
Optionally, the ordering of the types of the requested USB is consistent with the ordering of the USB types managed by the USB configuration manager.
Optionally, the USB port meeting the request includes a combination of multiple USB ports, a configuration file of the combination of the multiple USB ports is stored in a preset location, and querying, by the USB configuration manager, the configuration file of the USB port meeting the request includes: and determining the preset position through the USB configuration manager, and acquiring a configuration file of the combination of the plurality of USB ports from the preset position.
Optionally, the method further includes: when the USB flash drive is started, acquiring a configuration file of a default USB port, and completing the configuration of the default USB port; after the acquiring the USB port request, the method further includes: detecting whether the USB port meeting the request only corresponds to the default USB port; if the request-satisfying USB port only corresponds to the default USB port, determining to complete the configuration of the request-satisfying USB port; and if the USB port meeting the request not only corresponds to the default USB port, inquiring the configuration file of the unfinished USB port in the USB port meeting the request through the USB configuration manager, and finishing the configuration of the unfinished USB port in the USB port meeting the request.
Optionally, after the importing, by the configuration manager, the configuration file completes the configuration of the USB port that satisfies the request, the method further includes: and returning confirmation information to the terminal corresponding to the USB port request.
Optionally, the method further includes: when the configuration file of the USB port meeting the request is not inquired or the configuration of the USB port meeting the request is not finished, determining that the USB port request is not met; and returning error information to the terminal corresponding to the USB port request.
An embodiment of the present invention further provides a management apparatus for a USB port, including: a request acquisition module, configured to acquire a USB port request, where the USB port request is used to request configuration of a USB port that satisfies the request; the query module is used for querying the configuration file of the USB port meeting the request through a USB configuration manager; and the configuration model is used for importing the configuration file to complete the configuration of the USB port meeting the request when the configuration file of the USB port meeting the request is inquired.
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, performs the steps of any one of the USB port management methods.
The embodiment of the present invention further provides a management apparatus for a USB port, including a memory and a processor, where the memory stores a computer program that can be run on the processor, and the processor executes the steps of any one of the management methods for the USB port when running the computer program. The management means of the USB port may be executed by an embedded device.
Compared with the prior art, the technical scheme of the embodiment of the application has the following beneficial effects:
the management method of the USB port of the embodiment of the invention comprises the following steps: acquiring a USB port request, wherein the USB port request is used for requesting to configure a USB port meeting the request; inquiring the configuration file of the USB port meeting the request through a USB configuration manager; when the configuration file of the USB port meeting the request is inquired, the configuration file is imported through the configuration manager to complete the configuration of the USB port meeting the request. Compared with the prior art, in the scheme provided by the embodiment of the invention, the USB configuration manager can perform centralized management on the configuration process of the USB port on the embedded device side, and after the USB port request is obtained, the USB configuration manager can configure the managed USB port based on the request. Therefore, the configuration requirements can be flexibly met, and the USB port on the embedded equipment side can be intensively used by other services.
Further, when the USB port request can be satisfied or cannot be satisfied, the USB configuration manager may send feedback information to the service corresponding to the USB port request, so as to notify the service corresponding to the USB port request whether it can use the USB port on the device side. Optionally, the device may also record the obtained request of each USB port and a result of whether the request can be satisfied in a system log, so as to facilitate viewing.
Further, the embedded device, the USB configuration manager and the service corresponding to the USB port request can determine the information carried in the USB port request through a plurality of USB types managed by the USB configuration manager, so that a USB port information description mode with clear rules is provided, the data volume carried in the USB port request is reduced, and the communication efficiency is improved.
Further, the USB configuration manager stores, queries and imports configuration files of USB ports of various USB types based on the arrangement sequence of the USB types managed by the USB configuration manager, and the USB configuration management method with clear rules and high matching efficiency is realized.
Drawings
Fig. 1 is a flowchart illustrating a method for managing a USB port according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a USB configuration method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating a USB configuration method of a Linux embedded device according to the prior art;
FIG. 4 is a schematic diagram illustrating a USB configuration method of a Linux embedded device according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a USB configuration execution method according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a management device of a USB port according to an embodiment of the present invention.
Detailed Description
Android (Android) devices use the Android Initialization Language (AIL) to describe init.rc files, where the USB port combinations that the device needs to enumerate are selected by matching triggering of specific strings. But the speed of string matching is slow and in the case of too many matching elements, this phenomenon is exacerbated. When the new matching element and the old matching element are similar, the string meanings of the two are easily confused. In addition, many non-android devices cannot utilize AIL due to anti-fragmentation protocol limitations.
The current practice of non-android devices only describes limited USB port combinations in the device, and cannot support the above-described scenarios well.
As background, conventional USB port management methods cannot regularly manage different types of USB ports.
To solve the above problem, an embodiment of the present invention provides a method for managing a USB port, including: a method of managing USB ports, the method comprising: acquiring a USB port request, wherein the USB port request is used for requesting to configure a USB port meeting the request; inquiring the configuration file of the USB port meeting the request through a USB configuration manager; when the configuration file of the USB port meeting the request is inquired, the configuration file is imported through the configuration manager to complete the configuration of the USB port meeting the request. Therefore, the configuration work of the USB port can be regularly managed, and the configuration requirement can be flexibly met.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
Referring to fig. 1, fig. 1 is a schematic flowchart of a method for managing a USB port according to an embodiment of the present invention, where the method may be executed by an embedded device, and the embedded device may be applied to a device with a computing function, such as a smart phone, a computer, a tablet computer, a smart watch, a server, or a server cluster. The method includes steps S101 to S103, which are described in detail below.
Step S101, a USB port request is obtained, and the USB port request is used for requesting to configure a USB port meeting the request.
Optionally, the USB port request may carry information of a USB port that meets the request, so that the embedded device identifies the USB port to be configured, that is, the USB port that meets the request. Further, the information of the USB port satisfying the request may include a USB type of the USB port satisfying the request and the number of each type of USB port (the number may be one or more), a port number (PID) of the USB port satisfying the request, and the like. The USB type of the USB port that satisfies the request may include one or more USB types.
Optionally, the USB port request may be a request input by a user at the embedded device, or may be a request sent by another service to the embedded device. Optionally, the USB port request may also be used to request to use a USB port that satisfies the request, and after completing configuration of the USB port that satisfies the request, the embedded device establishes an occupation relationship between a service that sends the USB port request and the configured USB port that satisfies the request.
Specifically, after the USB configuration manager constructs an occupation relationship between one or more USB ports of a certain service, the service may use the one or more USB ports occupied by the service. Other services cannot use the occupied USB port, and a user can check the occupation state of each USB port on the device side through the USB configuration manager, wherein the occupation state can comprise states such as 'occupied' and 'unoccupied'. Further, after the USB configuration manager constructs the occupation relationship between a certain service and one or more USB ports, the USB configuration manager may send a notification of successful occupation to the service to prompt that the service is successfully occupied by the one or more USB ports.
The service may be a service provided on the embedded device, and the service may also be a service provided on another device (such as a computer, a mobile phone, and the like).
Step S102, inquiring the configuration file of the USB port meeting the request through the USB configuration manager.
In a specific embodiment, the USB port request includes a requested USB type and a USB port number of the requested USB type, and the querying, by the USB configuration manager in step S102 in fig. 1, the configuration file of the USB port that satisfies the request may include: and inquiring whether the requested USB type exists or not through the USB configuration manager, and if so, inquiring a configuration file of a USB port meeting the request in the requested USB type through the USB configuration manager.
The USB type is obtained by classifying USB ports (or USB interfaces). Optionally, the USB ports may be classified according to their models to obtain USB types. For example, USB ports can be classified into general serial ports, virtual network cards, storage devices, and multimedia devices according to their functional classification. Some specific types such as GenericSerial, RemoteNDIS, UsbMassStorage, MediaTransferProtocol, etc., the USB type in this embodiment may follow the specific types derived from the above, and the specific type is referred to as A, B, C below. Optionally, the USB port request carries one or more USB types as USB types of the USB port that satisfies the request.
The USB configuration manager is a program installed on the embedded device, and is configured to manage information of all USB ports on the embedded device side and configure the USB ports. The USB configuration manager is realized through an Application program (APP for short) and a shell script.
After the USB configuration manager is started, the information of all USB ports on the embedded equipment side can be checked, and the USB ports are configured. The embedded device side may have only one physical USB port, and the embedded device multiplexes the physical USB port into multiple USB ports of multiple USB types in a port multiplexing manner. Optionally, when each USB port is connected to the embedded device, information of the connected USB port is recorded in the USB configuration manager. Optionally, when the embedded device is started, information of all USB ports that need to be provided by the service on the embedded device is detected and recorded in the USB configuration manager. And the USB configuration manager manages the information of all recorded USB ports according to the USB types and counts the port number corresponding to each managed USB type.
The information of the USB port may include at least one of: port Identification number (PID) of the USB Port, USB type (such as type a) of the USB Port, device name corresponding to the USB Port, configuration status of each USB Port, and so on.
Optionally, in step S102, if the embedded device detects, through the USB configuration manager, that all USB ports of the embedded device side include a USB type of a USB port that meets the request, and the number of USB pair ports of the USB type managed by the USB configuration manager is greater than or equal to the number of ports of the USB type carried in the USB port request, it is determined that the USB port request can be met; otherwise, it is determined that the USB port request cannot be satisfied. For example, the USB port request includes the requested USB type-a type and the number of ports corresponding to the requested USB type-a type, which is 5, and if the embedded device detects that the embedded device side includes 10 available a-type USB ports through the USB port manager, the embedded device determines that the USB port request can be satisfied.
Optionally, if it is determined that the USB port request can be satisfied, configuration is started, and the USB configuration manager queries a configuration file of the USB port satisfying the request.
Step S103, when the configuration file of the USB port meeting the request is inquired, importing the configuration file through the configuration manager to complete the configuration of the USB port meeting the request.
The USB configuration manager may manage storage locations of the configuration files, and when it is necessary to configure a USB port of one or more USB types, the configuration file may be obtained from the corresponding storage location to complete configuration.
Optionally, the USB port manager may display the configuration status of each USB port it manages, and the configuration status may include "configured", "configuring", and "unconfigured" status. After the USB port manager completes configuring a certain USB port, the configuration status of the USB port may be updated to "configured". The configuration condition of each USB port is convenient for a user to inquire.
Through the method shown in fig. 1, the USB configuration manager can centrally manage the configuration process of USB ports (which may include different types of USB ports) on the embedded device side, and after acquiring the USB port request, the USB configuration manager can configure the managed USB port based on the USB port request. Therefore, the configuration requirements can be flexibly met, and the USB port on the embedded equipment side can be intensively used by other services.
Further, the USB configuration manager can perform centralized statistics on USB types on the embedded device side and the port number of each type of USB port, so as to regularly manage different types of USB ports.
Optionally, the USB port management method in fig. 1 may be applied to a general Linux platform, where when the Linux platform is used as a terminal and device end product, different products may have different requirements for the types of USB ports to be enumerated, so that multiple USB combinations need to be added to the same platform, and when the types of combinations are more and more, how to manage the combinations is a problem. By the method shown in fig. 1, the problem of how to regularly manage configuration files of USB ports of different device products and flexibly configure the configuration files on a general Linux platform can be solved.
In one embodiment, referring again to fig. 1, after determining that the USB port request can be satisfied in step S103, the method may further include: and sending a corresponding service return confirmation message to the USB port.
The service corresponding to the USB port request is the service for sending the USB port request or the service determined by the service and used by the USB port to be allocated to the service
The confirmation message is used to inform the USB port to request the corresponding service: the embedded device can provide the USB type carried in the USB port request and the port number corresponding to the USB type.
In one embodiment, the method for managing a USB port may further include: when the configuration file of the USB port meeting the request is not inquired or the configuration of the USB port meeting the request is not finished, determining that the USB port request is not met; and requesting the corresponding service to the USB port and returning error information.
Wherein, the error message is used to inform the USB port to request the corresponding service: the USB type carried in the USB port request does not exist in the embedded equipment of the USB configuration manager, or the configuration of the USB port meeting the request cannot be completed.
Optionally, after receiving the error information, the service corresponding to the USB port request may send help information to the USB configuration manager, so that the USB configuration manager notifies the software service provider to add the USB port connected to the device side, so as to satisfy the USB port request.
With the above embodiment, when the USB port request can be satisfied or cannot be satisfied, the USB configuration manager may send feedback information (including the above confirmation information or error information) to the service corresponding to the USB port request to notify the USB port that whether the service corresponding to the USB port request can use the USB port on the device side. Optionally, the device may also record the obtained request of each USB port and a result of whether the request can be satisfied in a system log, so as to facilitate viewing.
In one embodiment, the ordering of the types of USB requested is consistent with the ordering of the USB types managed by the USB configuration manager.
Specifically, the USB type of the USB port satisfying the request may not be directly carried in the USB port request, but the USB type carried in the USB port request is determined by the arrangement order of the respective default USB types (i.e. the arrangement order of the plurality of USB types managed by the USB configuration manager).
Referring to table 1 below, table 1 provides an example of an ordering of USB types managed by a USB configuration manager.
TABLE 1
Figure BDA0003433455390000091
In this example, the USB types managed in the USB configuration manager are arranged in the order: type a-type B-type C-type-new port type. If the information carried in the USB port request is the number "abc 0", it indicates that the USB type carried in the USB port request and the port number corresponding to each type are: a type USB ports are a, B type USB ports are B, and C type USB ports are C. If the information carried in the USB port request is number "1000", it indicates that the USB type carried in the USB port request and the port number corresponding to each type are: type a USB port is 1.
In this embodiment, the embedded device, the USB configuration manager, and the service corresponding to the USB port request may all determine information carried in the USB port request through a plurality of USB types managed by the USB configuration manager, thereby providing a USB port information description mode with a clear rule, reducing data volume carried in the USB port request, and improving communication efficiency.
In one embodiment, the configuration files of USB ports of multiple USB types may be merged into one file and stored in a certain location, and the configuration file may be named according to the arrangement order of multiple managed USB types to obtain the file name of the configuration file. With respect to step S102 in fig. 1, the USB configuration manager may query the configuration file of the USB port satisfying the request based on the file name corresponding to the USB port satisfying the request.
For example, if the information carried in the USB port request is number "1000", it indicates that the type of USB carried in the USB configuration request and the port number corresponding to each type are: type a USB port is 1. The corresponding configuration file stored on the embedded device side may also be named using "1000". The USB configuration manager determines the storage position of the configuration parameter named '1000', acquires the configuration parameter named '1000' from the determined storage position, and completes the configuration of the 1 class A USB port.
Optionally, configuration parameters corresponding to USB ports of multiple USB types that are commonly used may be obtained according to historical requirements of each service on the USB ports, and a corresponding configuration file generated from the configuration parameters is stored in a certain storage location. The USB configuration manager can acquire the configuration parameters of various USB ports by importing a configuration file, complete corresponding configuration and improve query speed and configuration efficiency.
In this embodiment, the USB configuration manager stores, queries, and imports configuration files of USB ports of multiple USB types based on the arrangement order of multiple USB types managed by the USB configuration manager, thereby implementing a USB configuration management method with a clear rule and high matching efficiency.
In one embodiment, the requesting USB port includes a combination of USB ports, the configuration file of the combination of USB ports is stored in a preset location, and the querying, by the USB configuration manager, the configuration file of the requesting USB port in step S102 in fig. 1 may include: and determining the preset position through the USB configuration manager, and acquiring a configuration file of the combination of the plurality of USB ports from the preset position.
A Composite device, or referred to as a USB Composite device, refers to a device that implements functions of multiple USB computing ports on a single USB device, and a Composite configuration of multiple USB refers to a configuration of a USB Composite device. The USB port request may be used to request configuration of a plurality of USB port combinations, and the USB configuration manager may allocate USB combination devices that satisfy the USB port request to terminal occupation corresponding to the USB port request.
The preset position is a storage position for storing configuration files of various USB port combinations. The USB configuration manager can acquire configuration parameters of the combined configuration of various USB ports from a preset position so as to complete the configuration of the USB combined equipment.
It should be noted that, the naming, querying, and importing processes of configuration files of a combination of multiple USB ports may refer to the relevant descriptions of the configuration files of the USB ports of multiple USB types in the previous embodiment, and are not described herein again.
In an embodiment, please refer to fig. 2, fig. 2 is a flowchart illustrating a USB configuration method according to an embodiment of the present invention, where the USB configuration method may include the following steps S201 to S204, which are described in detail below.
Step S201, when the computer is started, a configuration file of the default USB configuration is obtained, and the default USB configuration is completed.
Wherein the default USB configuration is a USB configuration commonly used by the embedded device. That is, when the embedded device is powered on, it will automatically complete the default USB configuration.
After the embedded device executes the request for acquiring the USB port in step S101 in fig. 1, the method further includes: step S202, detecting whether the USB port meeting the request only corresponds to the default USB port.
If the detection result in the step S202 is yes, that is, it is detected that the USB port satisfying the request only corresponds to the default USB port, go to step S203, and determine to complete the configuration of the USB port satisfying the request; if the detection result in the step S202 is negative, that is, it is detected that the USB port satisfying the request not only corresponds to the default USB port, the process jumps to a step S204, queries, by using the USB configuration manager, a configuration file of an unfinished USB port in the USB port satisfying the request, and finishes the configuration of the unfinished USB port in the USB port satisfying the request.
Specifically, in step S203, if all the USB ports satisfying the request have already completed configuration at the time of booting, it is directly determined that the configuration of the USB ports satisfying the request is completed, and no additional configuration is required.
For step S204, if the USB port satisfying the request corresponds to not only the default USB port, which means that there are USB ports that have not been configured yet in the USB ports satisfying the request, the USB configuration manager may configure the USB ports that have not been configured yet. At this time, the unfinished configured USB ports may be used as the ports to be configured, and the configuration of the USB ports may be finished according to the scheme of steps S102 and S103 in fig. 1.
In this embodiment, when the USB configuration manager manages multiple types of USB devices, it may perform some common USB configurations (i.e. default USB port configurations) by itself when the USB configuration manager is powered on. After the USB configuration manager obtains the USB port request, it may first detect whether the configuration of the USB port satisfying the request is completed, and if so, no further configuration is needed.
Referring to fig. 3, fig. 3 is a schematic diagram illustrating a USB configuration method of a Linux embedded device in the prior art. The Linux operating system is run on the embedded device, and when the embedded device is booted (i.e., the booting step in fig. 3), step S301 is executed to mount the memory-based file system configfs to support configuration of the kernel object in the user space. Continuing to step S302, a USB instance is created under the USB drive framework USB _ gadget. In step S302, the embedded device automatically creates a default USB configuration instance when it is powered on. Step S303 is executed to import the USB configuration corresponding to the created USB instance and connect the corresponding instance. Step S304 is continuously executed to trigger a USB Device Controller (Device Controller). Therefore, USB enumeration is completed, the bottom layer writes the port descriptor and the endpoint descriptor well, configuration of bottom layer drive is completed, and therefore USB configuration corresponding to the created USB instance is completed. The foregoing steps S301 to S304 complete the step of step S201 in fig. 2. In addition, if the USB requirement of the embedded device changes during the operation of the embedded device, that is, the embedded device obtains the USB port request in step S305, step S306 is executed, the USB device controller is closed, and according to the USB instance (not shown in the figure) that is not configured in the USB port request creation request, step S303 is skipped to, the USB configuration corresponding to the created USB instance is imported and the corresponding instance is connected, and step S304 is executed continuously.
Referring to fig. 4, fig. 4 is a schematic diagram illustrating a USB configuration method of a Linux embedded device according to an embodiment of the present invention. The Linux operating system is run on the embedded device, and when the embedded device is booted (i.e., the booting step in fig. 3), step S401 is executed to mount the memory-based file system configfs, so as to support the configuration of the kernel object in the user space. Continuing to step S402, a USB instance is created under the USB drive framework USB _ gadget. In step S402, the embedded device automatically creates an instance of the default USB port configuration when it is powered on. Continuing to execute step S403, the USB configuration manager acquires a corresponding configuration file according to the USB port request (in this case, acquiring the configuration file of the default USB port), and imports the configuration parameters into the configuration behavior. Continuing to execute step S404, completing the target USB configuration according to the imported parameters and connecting the corresponding USB instance. Step S405 is continuously executed to trigger a USB Device Controller (Device Controller). Therefore, USB enumeration is completed, the bottom layer writes the port descriptor and the endpoint descriptor well, configuration of bottom layer drive is completed, and therefore USB configuration corresponding to the created USB instance is completed. In addition, if the USB requirement of the embedded device changes during the operation of the embedded device, that is, if the USB port request is obtained in step S406, step S407 is executed, the USB device controller is closed, an instance (not shown in the figure) of the USB port configuration that is not configured is created according to the USB port request, and then step S403 is skipped, the USB configuration manager obtains a corresponding configuration file (in this case, the configuration file of the USB port that is not configured) according to the USB port request, imports configuration parameters into the configuration behavior, and step S404 is continuously executed.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating a USB configuration executed by a USB configuration manager according to an embodiment of the present invention, which may specifically include: step S501, a USB configuration manager provides a software interface to acquire a USB port request; step S502, the USB configuration manager identifies the number (e.g., "abc 0") carried in the USB port request; step S503, the USB configuration manager acquires the configuration file corresponding to the serial number (for example, acquires the parameter file named "abc 0"); step S504, importing the parameters in the acquired configuration file into a configuration behavior, and completing the USB port configuration that meets the request.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a management device 60 of a USB port according to an embodiment of the present invention, where the management device 60 of the USB port may include: a request obtaining module 601, configured to obtain a USB port request, where the USB port request is used to request a configuration of a USB port that meets the request; a query module 602, configured to query, by a USB configuration manager, a configuration file of the USB port that satisfies the request; a configuration module 603, configured to import the configuration file through the configuration manager to complete configuration of the USB port that meets the request.
In an embodiment, the USB port request includes a requested USB type and a USB port number of the requested USB type, and the query module 602 is further configured to query, by the USB configuration manager, whether the requested USB type exists, and if the requested USB type exists, query, by the USB configuration manager, a configuration file of a USB port that satisfies the requested USB port in the requested USB type.
In one embodiment, the ordering of the types of USB requested is consistent with the ordering of the USB types managed by the USB configuration manager.
In an embodiment, the USB port satisfying the request includes a combination of multiple USB ports, a configuration file of the combination of the multiple USB ports is stored in a preset location, and the query module 602 may be further configured to determine the preset location through the USB configuration manager, and obtain the configuration file of the combination of the multiple USB ports from the preset location.
In one embodiment, the management apparatus 60 of the USB port may further include: the default configuration module is used for acquiring a configuration file of a default USB port when the computer is started and completing the configuration of the default USB port; after the acquiring the USB port request, the method further includes: the detection module is used for detecting whether the USB port meeting the request only corresponds to the default USB port; a determining module, configured to determine to complete the configuration of the request-satisfying USB port if the request-satisfying USB port only corresponds to the default USB port; and the supplementary configuration module is used for inquiring the configuration file of the unfinished USB port in the USB ports meeting the request through the USB configuration manager and finishing the configuration of the unfinished USB port in the USB ports meeting the request if the USB ports meeting the request not only correspond to the default USB port.
In one embodiment, after the configuration manager imports the configuration file to complete the configuration of the USB port satisfying the request, the USB port management apparatus 60 may further include: and the confirmation message returning module is used for returning confirmation information to the service corresponding to the USB port request.
In one embodiment, the management apparatus 60 of the USB port may further include: the unsatisfied module is used for determining that the USB port request is not satisfied when the configuration file of the USB port satisfying the request is not inquired or the configuration of the USB port not satisfying the request is not completed; and the error prompt module is used for requesting the corresponding service to the USB port and returning error information.
For more details of the operation principle and the operation mode of the management apparatus 60 for USB ports, reference may be made to the above description of the management method for USB ports in fig. 1 to 5, which is not repeated herein.
In a specific implementation, the management device 60 of the USB port may correspond to a Chip having a port management function in the terminal, or correspond to a Chip having a data processing function, such as a System-On-a-Chip (SOC), a radio frequency Chip, or the like; or the terminal comprises a chip module with a port management function; or to a chip module having a chip with a data processing function, or to a terminal.
Each module/unit included in each apparatus and product described in the above embodiments may be a software module/unit, or may also be a hardware module/unit, or may also be a part of a software module/unit and a part of a hardware module/unit. For example, for each device or product applied to or integrated into a chip, each module/unit included in the device or product may be implemented by hardware such as a circuit, or at least a part of the module/unit may be implemented by a software program running on a processor integrated within the chip, and the rest (if any) part of the module/unit may be implemented by hardware such as a circuit; for each device or product applied to or integrated with the chip module, each module/unit included in the device or product may be implemented by using hardware such as a circuit, and different modules/units may be located in the same component (e.g., a chip, a circuit module, etc.) or different components of the chip module, or at least some of the modules/units may be implemented by using a software program running on a processor integrated within the chip module, and the rest (if any) of the modules/units may be implemented by using hardware such as a circuit; for each device and product applied to or integrated in the terminal, each module/unit included in the device and product may be implemented by using hardware such as a circuit, and different modules/units may be located in the same component (e.g., a chip, a circuit module, etc.) or different components in the terminal, or at least part of the modules/units may be implemented by using a software program running on a processor integrated in the terminal, and the rest (if any) part of the modules/units may be implemented by using hardware such as a circuit.
An embodiment of the present invention further provides a storage medium, on which a computer program is stored, where the computer program, when executed by a processor, performs the steps of the USB port management method shown in fig. 1 to 5. The storage medium may be a computer-readable storage medium, and may include, for example, a non-volatile (non-volatile) or non-transitory (non-transitory) memory, and may further include an optical disc, a mechanical hard disk, a solid state hard disk, and the like.
An embodiment of the present invention further provides a management apparatus for a USB port, which may include a memory and a processor, where the memory stores a computer program that can be executed on the processor, and the processor executes the steps of the management method for the USB port shown in fig. 1 to 5 when executing the computer program. The management device of the USB port can be arranged in the embedded equipment.
Specifically, in the embodiment of the present invention, the processor may be a Central Processing Unit (CPU), and the processor may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will also be appreciated that the memory in the embodiments of the subject application can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The nonvolatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash memory. Volatile memory can be Random Access Memory (RAM), which acts as external cache memory. By way of example and not limitation, many forms of Random Access Memory (RAM) are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (enhanced SDRAM), SDRAM (SLDRAM), synchlink DRAM (SLDRAM), and direct bus RAM (DR RAM).
It should be understood that the term "and/or" herein is merely one type of association relationship that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" in this document indicates that the former and latter related objects are in an "or" relationship.
The "plurality" appearing in the embodiments of the present application means two or more.
The descriptions of objects, second, etc. appearing in the embodiments of the present application are only for the purpose of illustrating and differentiating the objects, and do not represent a particular limitation to the number of devices in the embodiments of the present application, and do not constitute any limitation to the embodiments of the present application.
The term "connect" in the embodiments of the present application refers to various connection manners, such as direct connection or indirect connection, to implement communication between devices, which is not limited in this embodiment of the present application.
Although the present invention is disclosed above, the present invention is not limited thereto. Various changes and modifications may be effected therein by one skilled in the art without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A method for managing USB ports, the method comprising:
acquiring a USB port request, wherein the USB port request is used for requesting to configure a USB port meeting the request;
inquiring the configuration file of the USB port meeting the request through a USB configuration manager;
when the configuration file of the USB port meeting the request is inquired, the configuration file is imported through the configuration manager to complete the configuration of the USB port meeting the request.
2. The method of claim 1, wherein the USB port request includes a requested USB type and a USB port number of the requested USB type, and wherein querying, by the USB configuration manager, the configuration file of the USB port that satisfies the request comprises:
and inquiring whether the requested USB type exists or not through the USB configuration manager, and if so, inquiring a configuration file of a USB port meeting the request in the requested USB type through the USB configuration manager.
3. The method of claim 2, wherein the requested USB types are arranged in an order consistent with an order of USB types managed by the USB configuration manager.
4. The method according to claim 1, wherein the requesting USB port comprises a plurality of USB port combinations, the profiles of the plurality of USB port combinations are stored in a preset location, and the querying, by the USB configuration manager, the requesting USB port profiles comprises:
and determining the preset position through the USB configuration manager, and acquiring a configuration file of the combination of the plurality of USB ports from the preset position.
5. The method of claim 1, further comprising:
when the USB flash drive is started, acquiring a configuration file of a default USB port, and completing the configuration of the default USB port;
after the acquiring the USB port request, the method further includes:
detecting whether the USB port meeting the request only corresponds to the default USB port;
if the request-satisfying USB port only corresponds to the default USB port, determining to complete the configuration of the request-satisfying USB port;
and if the USB port meeting the request not only corresponds to the default USB port, inquiring the configuration file of the unfinished USB port in the USB port meeting the request through the USB configuration manager, and finishing the configuration of the unfinished USB port in the USB port meeting the request.
6. The method according to any of claims 1 to 5, wherein the importing, by the configuration manager, the configuration file completes configuration of the USB port satisfying the request, further comprises:
and sending a corresponding service return confirmation message to the USB port.
7. The method according to any one of claims 1 to 5, further comprising: when the configuration file of the USB port meeting the request is not inquired or the configuration of the USB port meeting the request is not finished, determining that the USB port request is not met;
and requesting the corresponding service to the USB port and returning error information.
8. An apparatus for managing USB ports, comprising:
a request acquisition module, configured to acquire a USB port request, where the USB port request is used to request configuration of a USB port that satisfies the request;
the query module is used for querying the configuration file of the USB port meeting the request through a USB configuration manager;
and the configuration module is used for importing the configuration file through the configuration manager to complete the configuration of the USB port meeting the request when the configuration file of the USB port meeting the request is inquired.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
10. An apparatus for managing USB ports, comprising a memory and a processor, the memory having stored thereon a computer program operable on the processor, wherein the processor, when executing the computer program, performs the steps of the method according to any one of claims 1 to 7.
CN202111605175.1A 2021-12-24 2021-12-24 USB port management method and device and computer readable storage medium Pending CN114328325A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111605175.1A CN114328325A (en) 2021-12-24 2021-12-24 USB port management method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111605175.1A CN114328325A (en) 2021-12-24 2021-12-24 USB port management method and device and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114328325A true CN114328325A (en) 2022-04-12

Family

ID=81013925

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111605175.1A Pending CN114328325A (en) 2021-12-24 2021-12-24 USB port management method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114328325A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7965630B1 (en) * 2009-09-08 2011-06-21 Southern Company Services, Inc. Load balancing port proxy for dynamically controlling routing of query requests
CN111262737A (en) * 2020-01-16 2020-06-09 Tcl移动通信科技(宁波)有限公司 Port configuration management method and device, storage medium and terminal
CN111866850A (en) * 2020-06-28 2020-10-30 深圳市广和通无线股份有限公司 Configuration file switching method and device, computer equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7965630B1 (en) * 2009-09-08 2011-06-21 Southern Company Services, Inc. Load balancing port proxy for dynamically controlling routing of query requests
CN111262737A (en) * 2020-01-16 2020-06-09 Tcl移动通信科技(宁波)有限公司 Port configuration management method and device, storage medium and terminal
CN111866850A (en) * 2020-06-28 2020-10-30 深圳市广和通无线股份有限公司 Configuration file switching method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2018149221A1 (en) Device management method and network management system
CN108462760B (en) Electronic device, automatic cluster access domain name generation method and storage medium
US9813423B2 (en) Trust-based computing resource authorization in a networked computing environment
CN101650660B (en) Booting a computer system from central storage
EP3547112A1 (en) System and method for out-of-the-box solution-level management via logical architecture awareness
CN109995814B (en) Cloud host resource migration method and device, communication equipment and storage medium
US20160352821A1 (en) Method and system for allocating resources for virtual hosts
CN113835644B (en) Complete machine migration method, device, equipment and storage medium
US11190599B2 (en) Method and system for cloud service pre-provisioning
WO2018192478A1 (en) Cloud management platform, virtual machine management method, system thereof
CN114531477B (en) Method and device for configuring functional components, computer equipment and storage medium
US11861577B2 (en) System and method for distributed enforcement of configuration limitations
CN111582824B (en) Cloud resource synchronization method, device, equipment and storage medium
CN116028455A (en) Data processing method and device, storage medium and electronic equipment
US11321109B2 (en) Container engine for selecting driver based on container metadata
CN116360918A (en) Modeling data processing method, modeling data processing device, computer equipment and storage medium
US20150127916A1 (en) Dynamic memory allocation
WO2019201248A1 (en) Re-bootstrap method and device in lightweight machine to machine system
US11075925B2 (en) System and method to enable component inventory and compliance in the platform
CN111382141B (en) Master-slave architecture configuration method, device, equipment and computer readable storage medium
WO2019001280A1 (en) Heterogeneous virtual computing resource management method, related device, and storage medium
US10366224B2 (en) System and method for securing secure memory allocations in an information handling system
US20210240368A1 (en) Automatically Determining Sizing Configurations for Storage Components Using Machine Learning Techniques
US11252457B2 (en) Multimedia streaming and routing apparatus and operation method of the same
US10528397B2 (en) Method, device, and non-transitory computer readable storage medium for creating virtual machine

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination