Connection control method, device, equipment and storage medium for external device
Through the coordinated work of the USB hub and controller, the detection, reset, allocate address and power supply configuration are solved, and the communication abnormality of USB connected devices when the number of external devices increases, improving the connection success rate and optimizing the power use.
Patent Information
- Application Number
- CN202310335678.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2043-03-29
AI Technical Summary
When the number of external devices reaches a certain level, the connection communication will be abnormal and the communication will not be smooth.
The USB hub detects the plug-in of the external device, obtains the insertion signal and delays the preset time, and then sends it to the USB controller. The USB controller issues a reset command and assigns the device address, reads the configuration information to determine the power supply configuration parameters, and the USB hub supplies power to the external device according to the power supply configuration parameters.
While ensuring communication quality, it improves the success rate of connections of multiple external devices and avoids power loss.
Smart Images

Figure CN116340225B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a connection control method, apparatus, device and storage medium for external devices. Background Art
[0002] USB (Universal Serial Bus) is an emerging data communication method that is gradually replacing other interface standards. As a high-speed serial bus, USB has extremely high transmission speeds that can meet the application environment requirements of high-speed data transmission. It is used in many devices to realize data information transmission.
[0003] A USB hub is a device that expands one USB port into multiple ones, allowing them to be used simultaneously. However, in actual use, the more external devices connected, the less power the hub provides to the external devices. When the number of connected external devices reaches a certain level, connection and communication anomalies may occur, preventing smooth communication. Summary of the Invention
[0004] The embodiments of the present invention provide a connection control method, apparatus, device and storage medium for external devices, aiming to solve the problem of existing USB connection devices that when a certain number of external devices are connected, connection communication abnormalities will occur and smooth connection communication cannot be achieved.
[0005] In a first aspect, an embodiment of the present invention provides a connection control method for an external device, the method being applied to a USB connection device, the USB connection device comprising a USB controller, a USB hub, and a plurality of USB interfaces; the plurality of USB interfaces being respectively connected to the USB hub, the USB controller being in communication with the USB hub to implement data information transmission, the method comprising:
[0006] If the USB hub detects that a USB plug connector of an external device is plugged into any of the USB interfaces and a USB connection is established, it obtains an insertion signal and sends it to the USB controller after a preset delay;
[0007] The USB controller issues a corresponding reset instruction according to the insertion signal, and transmits the reset instruction to the target USB interface via the USB hub, so that the external device performs a reset operation after responding to the reset instruction; wherein the target USB interface is the USB interface to which the external device is plugged;
[0008] The USB controller assigns a unique device address to the external device and sends the address to the external device via the USB hub, so that the external device enters an addressed state;
[0009] The USB controller reads configuration information from the external device through the target USB interface, determines power supply configuration parameters corresponding to the configuration information, and sends the parameters to the USB hub;
[0010] The USB hub supplies power to the external device according to the received power supply configuration parameters.
[0011] In a second aspect, an embodiment of the present invention further provides a connection control device for an external device, the device being configured in a USB connection device, the USB connection device comprising a USB controller, a USB hub, and a plurality of USB interfaces; the plurality of USB interfaces being respectively connected to the USB hub, the USB controller being in communication with the USB hub to implement data information transmission, the device comprising:
[0012] a first processing unit configured to obtain an insertion signal and send it to the USB controller after a preset delay if the USB hub detects that a USB plug connector of an external device is plugged into any of the USB interfaces and a USB connection is established;
[0013] a second processing unit, configured for the USB controller to issue a corresponding reset instruction according to the insertion signal, and transmit the reset instruction to a target USB interface via the USB hub, so that the external device performs a reset operation after responding to the reset instruction; wherein the target USB interface is the USB interface to which the external device is plugged;
[0014] a third processing unit, configured for the USB controller to assign a unique device address to the external device and send the address to the external device via the USB hub, so that the external device enters an addressed state;
[0015] a fourth processing unit, configured for the USB controller to read configuration information from the external device through the target USB interface, and to determine power supply configuration parameters corresponding to the configuration information and send them to the USB hub;
[0016] A fifth processing unit is configured to enable the USB hub to supply power to the external device according to the received power supply configuration parameters.
[0017] In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0018] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method described in the first aspect can be implemented.
[0019] Embodiments of the present invention provide a connection control method, apparatus, device, and storage medium for an external device, which are used for a USB connection device. The USB connection device includes a USB controller, a USB hub, and multiple USB interfaces; the multiple USB interfaces are respectively connected to the USB hub, and the USB controller communicates with the USB hub to achieve data information transmission. The method includes: if the USB hub detects that the USB plug connector of the external device is plugged into any of the USB interfaces and a USB connection is established, obtaining an insertion signal and sending it to the USB controller after a preset delay; the USB controller sends a corresponding reset instruction according to the insertion signal, and transmits it to the target USB interface via the USB hub, so that the external device performs a reset operation after responding to the reset instruction; wherein the target USB interface is the USB interface to which the external device is plugged; the USB controller assigns a unique device address to the external device and sends it to the external device via the USB hub, so that the external device enters an addressing state; the USB controller reads configuration information from the external device through the target USB interface, determines power supply configuration parameters corresponding to the configuration information, and sends them to the USB hub; the USB hub supplies power to the external device according to the received power supply configuration parameters. In the embodiment of the present invention, during the connection process with the external device, by reading device information and configuring the external device according to the read device information, the communication quality is ensured while improving the success rate of connecting multiple external devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0021] Figure 1 A schematic diagram of a flow chart of a method for controlling connection of an external device provided in an embodiment of the present invention;
[0022] Figure 2 A schematic diagram of a sub-flow diagram of a connection control method for an external device provided in an embodiment of the present invention;
[0023] Figure 3A schematic diagram of another sub-flow diagram of the connection control method for an external device provided by an embodiment of the present invention;
[0024] Figure 4 A schematic block diagram of a connection control apparatus for an external device provided in an embodiment of the present invention;
[0025] Figure 5 A schematic block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0027] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0028] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the present invention. As used in the specification and appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0029] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0030] See also Figure 1 , Figure 1 This is a flow chart of a method for controlling the connection of an external device provided in an embodiment of the present invention. This method is applied to a USB connection device, which includes a USB controller, a USB hub, and multiple USB interfaces; the multiple USB interfaces are respectively connected to the USB hub, and the USB controller communicates with the USB hub to achieve data information transmission.
[0031] Figure 1 Schematic diagram of a flow chart of a connection control method for an external device provided in an embodiment of the present invention. Figure 1As shown, the method includes the following steps S110-S150.
[0032] S110: If the USB hub detects that a USB plug connector of an external device is plugged into any of the USB interfaces and a USB connection is established, an insertion signal is obtained and sent to the USB controller after a preset delay.
[0033] In this embodiment, the external device can establish a connection with the USB connection device by plugging a USB cable into any of the USB interfaces. Multiple USB interfaces are respectively connected to the USB hub, and the USB hub can power the external device via the USB interfaces. If the USB hub receives an insertion signal, it needs to delay for 0.1 seconds to allow the insertion operation to complete and the USB hub to be in normal operation before sending the insertion signal to the USB controller. The delay period can be set according to usage requirements and must be greater than 0.1 seconds.
[0034] In one embodiment, after step S110, the method further includes:
[0035] If the USB hub detects that the USB plug connector of the external device is disconnected from the USB connection device, a disconnection signal is obtained and sent to the USB controller; the USB controller receives the disconnection signal and updates the topology information according to the disconnection signal.
[0036] In this embodiment, the plurality of USB interfaces are respectively connected to the USB hub. If the USB plug connector of the external device is disconnected from the USB connection device, the USB hub obtains a disconnection signal. At this time, the USB hub stops supplying power to the USB interface disconnected from the external device and sends the disconnection signal to the USB controller. The USB controller can update the topology information according to the received disconnection signal, thereby effectively avoiding power loss.
[0037] S120. The USB controller issues a corresponding reset instruction according to the insertion signal, and transmits the reset instruction to the target USB interface via the USB hub, so that the external device performs a reset operation after responding to the reset instruction; wherein, the target USB interface is the USB interface to which the external device is plugged.
[0038] In this embodiment, the USB controller issues a corresponding reset instruction based on the insertion signal and sends it to the USB hub. The USB hub receives the reset instruction and transmits the reset instruction to the target USB interface. The reset signal transmitted to the target USB interface is maintained for 0.01 seconds, so that the external device can successfully respond to the reset instruction and successfully perform the reset operation. The target USB interface is the USB interface to which the external device is plugged. If the external device successfully performs the reset operation, it enters the default state, and the external device can respond to the default address. After the external device responds to the reset instruction and before performing the reset operation, the USB hub can power the external device through the USB interface, but the power provided is less than 100mA. At this time, the external device is in the powered state.
[0039] In one embodiment, after step S120, the method further includes:
[0040] The USB controller monitors the reset result of the external device after performing the reset operation through the target USB interface, and determines whether the external device needs to perform the reset operation again according to the reset result.
[0041] In this embodiment, the USB controller monitors the reset result of the external device after performing the reset operation through the target USB interface. If the USB controller detects that the external device fails to successfully perform the reset operation, the USB controller reissues the corresponding reset instruction and transmits it to the target USB interface via the USB hub. The USB hub transmits the reset signal to the target USB interface for 0.01 seconds so that the external device can successfully respond to the reset instruction and perform the reset operation.
[0042] S130: The USB controller assigns a unique device address to the external device and sends the address to the external device via the USB hub, so that the external device enters an addressed state.
[0043] In this embodiment, the USB controller issues a reset instruction, which is transmitted to the target USB interface via the USB hub, so that the external device performs a reset operation in response to the reset instruction. If the external device successfully performs the reset operation, it enters the default state. At this time, the USB controller can assign a unique device address to the external device to cause the external device to enter the addressed state.
[0044] S140: The USB controller reads configuration information from the external device through the target USB interface, determines power supply configuration parameters corresponding to the configuration information, and sends the parameters to the USB hub.
[0045] In this embodiment, the external device enters the addressing state, and the USB controller can read configuration information from the external device through the target USB interface. When the number of configurations is n, the configuration information is read from configuration 0 to configuration n-1. By analyzing the read configuration information, the power supply configuration parameters required by the external device are determined, and the power supply configuration parameters are sent to the USB hub.
[0046] In one embodiment, the configuration information includes a device descriptor, a configuration descriptor, an interface descriptor, and an endpoint descriptor, such as Figure 2 As shown, step S140 includes:
[0047] S1401: The USB controller reads a device descriptor from the external device; wherein the device descriptor defines multiple configurations;
[0048] S1402: The USB controller reads a configuration descriptor from the device descriptor; wherein the configuration descriptor defines multiple interfaces;
[0049] S1403. The USB controller reads an interface descriptor from the configuration descriptor; wherein the interface descriptor defines multiple endpoints in the interface;
[0050] S1404: The USB controller reads an endpoint descriptor from the interface descriptor.
[0051] In this embodiment, the configuration information includes a device descriptor, a configuration descriptor, an interface descriptor and an endpoint descriptor. The device descriptor describes the overall information of the external device and corresponds one-to-one to the external device itself. An external device can have only one device descriptor. An external device can have multiple configurations, different configurations correspond to different working states, and each configuration must have a configuration descriptor. The interface descriptor is used to describe an interface and includes the characteristics of the interface, such as the number of endpoints. The endpoint descriptor is used to describe the endpoint number, direction, endpoint transmission type, etc. The reading of the descriptors in the device information is progressive. The configuration descriptor can be known through the device descriptor, the interface descriptor can be known through the configuration descriptor, and the endpoint descriptor can be known through the interface descriptor.
[0052] In one embodiment, if Figure 3 As shown, step S140 also includes:
[0053] S1411, determining the actual net data load corresponding to the target USB interface according to the device descriptor;
[0054] S1412, determining power supply matching information corresponding to the target USB interface according to the parameters in the configuration descriptor;
[0055] S1413, determining the endpoint transmission information corresponding to the target USB interface according to the interface descriptor;
[0056] S1414: According to the actual net data load, the power supply matching information, and the endpoint transmission information, matching power supply configuration parameters are obtained from a preset power supply strategy table and sent to the USB hub.
[0057] In this embodiment, the configuration information includes a device descriptor, a configuration descriptor, an interface descriptor and an endpoint descriptor. The device descriptor describes the overall information of the external device and corresponds one-to-one to the external device itself. An external device can have only one device descriptor. An external device can have multiple configurations, different configurations correspond to different working states, and each configuration must have a configuration descriptor. The interface descriptor is used to describe an interface and includes the characteristics of the interface, such as the number of endpoints. The endpoint descriptor is used to describe the endpoint number, direction, endpoint transmission type, etc. The reading of the descriptor is progressive. The configuration descriptor can be known through the device descriptor, the interface descriptor can be known through the configuration descriptor, and the endpoint descriptor can be known through the interface descriptor.
[0058] The USB controller reads a device descriptor from the external device and determines the actual net data load corresponding to the target USB interface based on the device descriptor; the USB controller reads a configuration descriptor from the device descriptor and determines the power supply matching information corresponding to the target USB interface based on parameters in the configuration descriptor, wherein the power supply matching information includes the power supply mode and current requirement of the external device; the USB controller reads an interface descriptor from the configuration descriptor and determines the endpoint transmission information corresponding to the target USB interface based on the interface descriptor, that is, reads the endpoint descriptor from the interface descriptor.
[0059] In one embodiment, the power supply configuration parameters further include an interface type, and after step S1411, the following steps are further included:
[0060] The USB controller determines an interface type corresponding to the target USB interface according to the actual net data load.
[0061] In this embodiment, the external device can be connected to the USB controller via the USB interface to achieve data information transmission. The USB interface types include USB 1.0, USB 2.0 and USB 3.0. The data information transmission rate of USB 1.0 is 12Mbps, the data information transmission rate of USB 2.0 is 480Mbps, and the data information transmission rate of USB 3.0 is 5.0Gbps. The USB controller reads a device descriptor from the external device and determines the actual net data load corresponding to the target USB interface based on the device descriptor. Since the data information transmission rates of USB 1.0, USB 2.0 and USB 3.0 are different, the USB controller can determine the interface type corresponding to the target USB interface based on the actual net data load.
[0062] In one embodiment, after step S1413, the method further includes:
[0063] According to the actual net data load, the power supply matching information, the interface type, and the endpoint transmission information, matching power supply configuration parameters are obtained from a preset power supply strategy table and sent to the USB hub.
[0064] In this embodiment, the interface types are different, and the current requirements corresponding to the interface types are also different. According to the actual net data load, the power supply matching information, the interface type, and the endpoint transmission information, the matching power supply configuration parameters can be obtained from the preset power supply strategy table. For example, if the power supply mode of the external device is self-powered, the interface type is USB2.0, and the transmission type of the endpoint is isochronous, the power supply configuration parameters matched from the power supply strategy table are 4V, 350mA.
[0065] S150: The USB hub supplies power to the external device according to the received power supply configuration parameters.
[0066] In this embodiment, the USB controller obtains power supply configuration parameters by reading configuration information and sends the power supply parameters to the USB hub. The USB hub can power the external device according to the received power supply configuration parameters. The USB controller can also monitor the external device through the USB interface. If a problem in the communication of the external device is detected, the USB controller can stop powering the external device by sending an instruction to the USB hub, thereby achieving an evasive effect, effectively avoiding power loss, and improving the success rate of connecting multiple external devices while ensuring communication quality.
[0067] In summary, in the process of connecting with external devices, the embodiments of the present invention read device information and configure the external devices according to the read device information, thereby ensuring communication quality while improving the success rate of connecting multiple external devices.
[0068] Figure 4 FIG is a schematic block diagram of a connection control device for an external device provided by an embodiment of the present invention. Figure 4 As shown, corresponding to the above connection control method for external devices, the present invention also provides a connection control device for external devices. The connection control device for external devices includes a unit for executing the above connection control method for external devices. The device can be configured in a USB connection device, wherein the USB connection device includes a USB controller, a USB hub, and a plurality of USB interfaces; the plurality of USB interfaces are respectively connected to the USB hub, and the USB controller communicates with the USB hub to realize the transmission of data information. Specifically, please refer to Figure 4 The connection control device 700 for an external device includes a first processing unit 701 , a second processing unit 702 , a third processing unit 703 , a fourth processing unit 704 and a fifth processing unit 705 .
[0069] The first processing unit 701 is configured to, if the USB hub detects that a USB plug connector of an external device is plugged into any of the USB interfaces and a USB connection is established, obtain an insertion signal and send it to the USB controller after a preset delay;
[0070] The second processing unit 702 is configured to cause the USB controller to issue a corresponding reset instruction according to the insertion signal, and transmit the reset instruction to a target USB interface via the USB hub, so that the external device performs a reset operation after responding to the reset instruction; wherein the target USB interface is the USB interface to which the external device is plugged;
[0071] The third processing unit 703 is configured to allocate a unique device address to the external device via the USB controller and send the address to the external device via the USB hub, so that the external device enters an addressing state.
[0072] a fourth processing unit 704, configured for the USB controller to read configuration information from the external device through the target USB interface, and to determine power supply configuration parameters corresponding to the configuration information and send the parameters to the USB hub;
[0073] The fifth processing unit 705 is configured to enable the USB hub to supply power to the external device according to the received power supply configuration parameters.
[0074] In some embodiments, after executing the step of: if the USB hub detects that a USB plug connector of an external device is plugged into any of the USB interfaces and a USB connection is established, obtaining an insertion signal and sending the signal to the USB controller after a preset delay, the first determining unit 701 is further configured to:
[0075] If the USB hub detects that the USB plug connector of the external device is disconnected from the USB connection device, a disconnection signal is obtained and sent to the USB controller; the USB controller receives the disconnection signal and updates the topology information according to the disconnection signal.
[0076] In some embodiments, after executing the step of causing the USB controller to issue a corresponding reset instruction according to the insertion signal and transmitting the reset instruction to the target USB interface via the USB hub, the second processing unit 702 is further configured to:
[0077] The USB controller monitors the reset result of the external device after performing the reset operation through the target USB interface, and determines whether the external device needs to perform the reset operation again according to the reset result.
[0078] In some embodiments, the configuration information includes a device descriptor, a configuration descriptor, an interface descriptor, and an endpoint descriptor. When executing the step of the USB controller reading the configuration information from the external device through the target USB interface, the fourth processing unit 704 is specifically configured to:
[0079] The USB controller reads a device descriptor from the external device; wherein the device descriptor defines multiple configurations; the USB controller reads a configuration descriptor from the device descriptor; wherein the configuration descriptor defines multiple interfaces; the USB controller reads an interface descriptor from the configuration descriptor; wherein the interface descriptor defines multiple endpoints in the interface; the USB controller reads an endpoint descriptor from the interface descriptor.
[0080] In some embodiments, when executing the step of determining the power supply configuration parameters corresponding to the configuration information, the fourth processing unit 704 is specifically configured to:
[0081] Determine the actual net data load corresponding to the target USB interface according to the device descriptor; determine the power supply matching information corresponding to the target USB interface according to the parameters in the configuration descriptor; determine the endpoint transmission information corresponding to the target USB interface according to the interface descriptor; obtain matching power supply configuration parameters from a preset power supply strategy table according to the actual net data load, the power supply matching information, and the endpoint transmission information, and send them to the USB hub.
[0082] In some embodiments, the power supply configuration parameter further includes an interface type. After executing the step of determining the actual net data load corresponding to the target USB interface according to the configuration descriptor, the fourth processing unit 704 is further configured to:
[0083] The USB controller determines an interface type corresponding to the target USB interface according to the actual net data load.
[0084] In some embodiments, after executing the step of determining the endpoint transmission information corresponding to the target USB interface according to the interface descriptor, the fourth processing unit 704 is further configured to:
[0085] According to the actual net data load, the power supply matching information, the interface type, and the endpoint transmission information, matching power supply configuration parameters are obtained from a preset power supply strategy table and sent to the USB hub.
[0086] It should be noted that technicians in the relevant field can clearly understand that the specific implementation process of the above-mentioned connection control device for external equipment and each unit can refer to the corresponding description in the aforementioned method embodiment. For the convenience and brevity of description, it will not be repeated here.
[0087] The above-mentioned connection control device for external devices can be implemented in the form of a computer program. The computer program can be used in Figure 5 Runs on the computer equipment shown.
[0088] See also Figure 5 , Figure 5 This is a schematic block diagram of an electronic device provided by an embodiment of the present invention. The electronic device 800 may be a USB connection device, comprising a USB controller, a USB hub, and multiple USB interfaces; the multiple USB interfaces are respectively connected to the USB hub, and the USB controller communicates with the USB hub to enable data transmission.
[0089] See Figure 5 The electronic device 800 includes a processor 802 , a memory, and a network interface 805 connected via a system bus 801 , wherein the memory may include a non-volatile storage medium 803 and an internal memory 804 .
[0090] The non-volatile storage medium 803 can store an operating system 8031 and a computer program 8032. The computer program 8032 includes program instructions, which, when executed, can cause the processor 802 to execute a connection control method for an external device.
[0091] The processor 802 is used to provide computing and control capabilities to support the operation of the entire electronic device 800.
[0092] The internal memory 804 provides an environment for the operation of the computer program 8032 in the non-volatile storage medium 803. When the computer program 8032 is executed by the processor 802, the processor 802 can execute a connection control method for an external device.
[0093] The network interface 805 is used to communicate with other devices over the network. Figure 5 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention, and does not constitute a limitation on the electronic device 800 to which the solution of the present invention is applied. The specific electronic device 800 may include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0094] The processor 802 is configured to execute a computer program 8032 stored in the memory to implement the following steps:
[0095] If the USB hub detects that the USB plug connector of the external device is plugged into any of the USB interfaces and a USB connection is established, it obtains an insertion signal and sends it to the USB controller after a preset delay; the USB controller issues a corresponding reset instruction based on the insertion signal, and transmits it to the target USB interface via the USB hub, so that the external device performs a reset operation after responding to the reset instruction; wherein, the target USB interface is the USB interface to which the external device is plugged; the USB controller assigns a unique device address to the external device and sends it to the external device via the USB hub, so that the external device enters an addressed state; the USB controller reads configuration information from the external device through the target USB interface, determines power supply configuration parameters corresponding to the configuration information, and sends them to the USB hub; the USB hub powers the external device according to the received power supply configuration parameters.
[0096] In some embodiments, after implementing the step of: if the USB hub detects that a USB plug connector of an external device is plugged into any of the USB interfaces and a USB connection is established, obtaining an insertion signal and sending it to the USB controller after a preset delay, the processor 802 further implements the following steps:
[0097] If the USB hub detects that the USB plug connector of the external device is disconnected from the USB connection device, a disconnection signal is obtained and sent to the USB controller; the USB controller receives the disconnection signal and updates the topology information according to the disconnection signal.
[0098] In some embodiments, after implementing the step of causing the USB controller to issue a corresponding reset instruction according to the insertion signal and transmitting the reset instruction to the target USB interface via the USB hub, the processor 802 further implements the following steps:
[0099] The USB controller monitors the reset result of the external device after performing the reset operation through the target USB interface, and determines whether the external device needs to perform the reset operation again according to the reset result.
[0100] In some embodiments, the configuration information includes a device descriptor, a configuration descriptor, an interface descriptor, and an endpoint descriptor. When implementing the step of the USB controller reading the configuration information from the external device through the target USB interface, the processor 802 specifically implements the following steps:
[0101] The USB controller reads a device descriptor from the external device; wherein the device descriptor defines multiple configurations; the USB controller reads a configuration descriptor from the device descriptor; wherein the configuration descriptor defines multiple interfaces; the USB controller reads an interface descriptor from the configuration descriptor; wherein the interface descriptor defines multiple endpoints in the interface; the USB controller reads an endpoint descriptor from the interface descriptor.
[0102] In some embodiments, when implementing the step of determining the power supply configuration parameters corresponding to the configuration information, the processor 802 specifically implements the following steps:
[0103] Determine the actual net data load corresponding to the target USB interface according to the device descriptor; determine the power supply matching information corresponding to the target USB interface according to the parameters in the configuration descriptor; determine the endpoint transmission information corresponding to the target USB interface according to the interface descriptor; obtain matching power supply configuration parameters from a preset power supply strategy table according to the actual net data load, the power supply matching information, and the endpoint transmission information, and send them to the USB hub.
[0104] In some embodiments, the power supply configuration parameter further includes an interface type. After implementing the step of determining the actual net data load corresponding to the target USB interface according to the configuration descriptor, the processor 802 further implements the following steps:
[0105] The USB controller determines an interface type corresponding to the target USB interface according to the actual net data load.
[0106] In some embodiments, after implementing the step of determining the endpoint transmission information corresponding to the target USB interface according to the interface descriptor, the processor 802 further implements the following steps:
[0107] According to the actual net data load, the power supply matching information, the interface type, and the endpoint transmission information, matching power supply configuration parameters are obtained from a preset power supply strategy table and sent to the USB hub.
[0108] It should be understood that in the embodiment of the present invention, the processor 802 may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0109] Those skilled in the art will appreciate that all or part of the steps in the method of the above-described embodiment can be implemented by instructing the relevant hardware through a computer program. The computer program includes program instructions, which can be stored in a storage medium that is computer-readable. The program instructions are executed by at least one processor in the computer system to implement the steps in the method of the above-described embodiment.
[0110] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor performs the following steps:
[0111] If the USB hub detects that the USB plug connector of the external device is plugged into any of the USB interfaces and a USB connection is established, it obtains an insertion signal and sends it to the USB controller after a preset delay; the USB controller issues a corresponding reset instruction based on the insertion signal, and transmits it to the target USB interface via the USB hub, so that the external device performs a reset operation after responding to the reset instruction; wherein, the target USB interface is the USB interface to which the external device is plugged; the USB controller assigns a unique device address to the external device and sends it to the external device via the USB hub, so that the external device enters an addressed state; the USB controller reads configuration information from the external device through the target USB interface, determines power supply configuration parameters corresponding to the configuration information, and sends them to the USB hub; the USB hub powers the external device according to the received power supply configuration parameters.
[0112] In one embodiment, after executing the program instructions to implement the step of obtaining an insertion signal and sending it to the USB controller after a preset delay if the USB hub detects that a USB plug connector of an external device is plugged into any of the USB interfaces and establishes a USB connection, the processor further implements the following step:
[0113] If the USB hub detects that the USB plug connector of the external device is disconnected from the USB connection device, a disconnection signal is obtained and sent to the USB controller; the USB controller receives the disconnection signal and updates the topology information according to the disconnection signal.
[0114] In one embodiment, after the processor executes the program instructions to implement the step of causing the USB controller to issue a corresponding reset instruction according to the insertion signal and transmit the reset instruction to the target USB interface via the USB hub, the processor further implements the following steps:
[0115] The USB controller monitors the reset result of the external device after performing the reset operation through the target USB interface, and determines whether the external device needs to perform the reset operation again according to the reset result.
[0116] In one embodiment, the configuration information includes a device descriptor, a configuration descriptor, an interface descriptor, and an endpoint descriptor. When the processor executes the program instructions to implement the step of the USB controller reading the configuration information from the external device through the target USB interface, the processor specifically implements the following steps:
[0117] The USB controller reads a device descriptor from the external device; wherein the device descriptor defines multiple configurations; the USB controller reads a configuration descriptor from the device descriptor; wherein the configuration descriptor defines multiple interfaces; the USB controller reads an interface descriptor from the configuration descriptor; wherein the interface descriptor defines multiple endpoints in the interface; the USB controller reads an endpoint descriptor from the interface descriptor.
[0118] In one embodiment, when the processor executes the step of determining the power supply configuration parameters corresponding to the configuration information, the processor specifically implements the following steps:
[0119] Determine the actual net data load corresponding to the target USB interface according to the device descriptor; determine the power supply matching information corresponding to the target USB interface according to the parameters in the configuration descriptor; determine the endpoint transmission information corresponding to the target USB interface according to the interface descriptor; obtain matching power supply configuration parameters from a preset power supply strategy table according to the actual net data load, the power supply matching information, and the endpoint transmission information, and send them to the USB hub.
[0120] In one embodiment, the power supply configuration parameter further includes an interface type. After executing the program instructions to implement the step of determining the actual net data load corresponding to the target USB interface according to the configuration descriptor, the processor further implements the following steps:
[0121] The USB controller determines an interface type corresponding to the target USB interface according to the actual net data load.
[0122] In one embodiment, after executing the step of determining the endpoint transmission information corresponding to the target USB interface according to the interface descriptor, the processor further implements the following steps:
[0123] According to the actual net data load, the power supply matching information, the interface type, and the endpoint transmission information, matching power supply configuration parameters are obtained from a preset power supply strategy table and sent to the USB hub.
[0124] The storage medium may be any computer-readable storage medium that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk.
[0125] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0126] In the several embodiments provided herein, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the various units is merely a logical functional division, and actual implementation may employ other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be omitted or not implemented.
[0127] The steps in the methods of the embodiments of the present invention may be adjusted in order, combined, or deleted as needed. The units in the devices of the embodiments of the present invention may be combined, divided, or deleted as needed. Furthermore, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit.
[0128] If this integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the existing technology, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, terminal, or network device, etc.) to execute all or part of the steps of the method described in various embodiments of the present invention.
[0129] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and such modifications or substitutions are intended to be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.
Claims
1. A method for controlling the connection of an external device, the method being applied to a USB connection device, wherein the USB connection device comprises a USB controller, a USB hub, and a plurality of USB interfaces; the plurality of USB interfaces are respectively connected to the USB hub, and the USB controller communicates with the USB hub to achieve data information transmission, wherein: The method comprises: If the USB hub detects that a USB plug connector of an external device is plugged into any of the USB interfaces and a USB connection is established, it obtains an insertion signal and sends it to the USB controller after a preset delay; The USB controller issues a corresponding reset instruction according to the insertion signal, and transmits the reset instruction to the target USB interface via the USB hub, so that the external device performs a reset operation after responding to the reset instruction; wherein the target USB interface is the USB interface to which the external device is plugged; The USB controller assigns a unique device address to the external device and sends the address to the external device via the USB hub, so that the external device enters an addressed state; The USB controller reads configuration information from the external device through the target USB interface, determines power supply configuration parameters corresponding to the configuration information, and sends the parameters to the USB hub; The USB hub supplies power to the external device according to the received power supply configuration parameters; The configuration information includes a device descriptor, a configuration descriptor, an interface descriptor, and an endpoint descriptor, and the USB controller reads the configuration information from the external device through the target USB interface, including: The USB controller reads a device descriptor from the external device; wherein the device descriptor defines multiple configurations; The USB controller reads a configuration descriptor from the device descriptor; wherein the configuration descriptor defines multiple interfaces; The USB controller reads an interface descriptor from the configuration descriptor; wherein the interface descriptor defines a plurality of endpoints in the interface; The USB controller reads the endpoint descriptor from the interface descriptor; The determining of the power supply configuration parameters corresponding to the configuration information includes: Determine the actual net data load corresponding to the target USB interface according to the device descriptor; Determine the power supply matching information corresponding to the target USB interface according to the parameters in the configuration descriptor; Determine endpoint transmission information corresponding to the target USB interface according to the interface descriptor; According to the actual net data load, the power supply matching information, and the endpoint transmission information, matching power supply configuration parameters are obtained from a preset power supply strategy table and sent to the USB hub.
2. The connection control method for external devices according to claim 1, characterized in that: If the USB hub detects that a USB plug connector of an external device is plugged into any of the USB interfaces and a USB connection is established, after obtaining an insertion signal and sending it to the USB controller after a delay of a preset time, the method further includes: If the USB hub detects that the USB plug connector of the external device is disconnected from the USB connection device, obtaining a disconnection signal and sending it to the USB controller; The USB controller receives the disconnection signal and updates topology information according to the disconnection signal.
3. The connection control method for external devices according to claim 1, characterized in that: The USB controller issues a corresponding reset instruction according to the insertion signal, and transmits the reset instruction to the target USB interface via the USB hub, further comprising: The USB controller monitors the reset result of the external device after performing the reset operation through the target USB interface, and determines whether the external device needs to perform the reset operation again according to the reset result.
4. The connection control method for external devices according to claim 1, characterized in that: The power supply configuration parameter also includes an interface type. After determining the actual net data load corresponding to the target USB interface according to the configuration descriptor, the method further includes: The USB controller determines an interface type corresponding to the target USB interface according to the actual net data load.
5. The connection control method for external devices according to claim 4, characterized in that: After determining the endpoint transmission information corresponding to the target USB interface according to the interface descriptor, the method further includes: According to the actual net data load, the power supply matching information, the interface type, and the endpoint transmission information, matching power supply configuration parameters are obtained from a preset power supply strategy table and sent to the USB hub.
6. A connection control device for an external device, the device being configured on a USB connection device, the USB connection device comprising a USB controller, a USB hub, and a plurality of USB interfaces; the plurality of USB interfaces being respectively connected to the USB hub, the USB controller communicating with the USB hub to achieve data information transmission, characterized in that: The device comprises: a first processing unit configured to obtain an insertion signal and send it to the USB controller after a preset delay if the USB hub detects that a USB plug connector of an external device is plugged into any of the USB interfaces and a USB connection is established; a second processing unit, configured for the USB controller to issue a corresponding reset instruction according to the insertion signal, and transmit the reset instruction to a target USB interface via the USB hub, so that the external device performs a reset operation after responding to the reset instruction; wherein the target USB interface is the USB interface to which the external device is plugged; a third processing unit, configured for the USB controller to assign a unique device address to the external device and send the address to the external device via the USB hub, so that the external device enters an addressed state; a fourth processing unit, configured for the USB controller to read configuration information from the external device through the target USB interface, and to determine power supply configuration parameters corresponding to the configuration information and send them to the USB hub; a fifth processing unit, configured for the USB hub to supply power to the external device according to the received power supply configuration parameters; The configuration information includes a device descriptor, a configuration descriptor, an interface descriptor, and an endpoint descriptor. The fourth processing unit is further configured to enable the USB controller to read the device descriptor from the external device; wherein the device descriptor defines multiple configurations; The USB controller reads a configuration descriptor from the device descriptor; wherein the configuration descriptor defines multiple interfaces; The USB controller reads an interface descriptor from the configuration descriptor; wherein the interface descriptor defines a plurality of endpoints in the interface; The USB controller reads the endpoint descriptor from the interface descriptor; The fourth processing unit is further configured to determine an actual net data load corresponding to the target USB interface according to the device descriptor; Determine the power supply matching information corresponding to the target USB interface according to the parameters in the configuration descriptor; Determine endpoint transmission information corresponding to the target USB interface according to the interface descriptor; According to the actual net data load, the power supply matching information, and the endpoint transmission information, matching power supply configuration parameters are obtained from a preset power supply strategy table and sent to the USB hub.
7. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 5 can be implemented.
Citation Information
Patent Citations
Two-stage control systems and methods for economical optimization of an electrical system
CA3213351A1
Automatically configuring a universal serial bus (USB) type-c port of a computing device
US20180060270A1