USB interface control method and system and readable storage medium
By detecting the device type and working frequency connected to the USB interface in the device and controlling the corresponding USB interface working mode, the problem of interference between USB3.0 and USB3.2 working modes and wireless communication is solved, and the stability of wireless communication data transmission is improved.
Patent Information
- Application Number
- CN202311090948.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2025-02-28
AI Technical Summary
Due to the higher working frequency bands, USB3.0 and USB3.2 operating modes may interfere with wireless communications of electronic devices, resulting in abnormal data transmission of wireless communications.
By obtaining the device type of the device that has been connected to the first USB interface, if it is a wireless device, it is determined whether there is a second USB interface. If there is and the distance from the first USB interface is less than the preset distance threshold, the working frequency of the wireless device is obtained, and the second USB interface is controlled to stop running in the target working mode with the working frequency difference from the wireless device is less than the preset difference threshold.
The risk of interference caused by the second USB interface to the devices connected to the first USB interface is effectively reduced, thereby reducing the risk of abnormal data transmission of wireless communications and improving the stability of data transmission of wireless communications.
Smart Images

Figure CN119545534A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a USB interface control method and system, and a readable storage medium. Background Art
[0002] With the development of electronic technology, more and more electronic devices and peripherals use USB (Universal Serial Bus) for data transmission, and the demand for USB data transmission is also increasing.
[0003] The traditional USB 2.0 working mode cannot meet the increasing demand for USB data transmission due to its low data transmission rate. Therefore, the USB 3.0 working mode and USB 3.2 working mode with higher data transmission rate have gradually emerged.
[0004] However, the USB 3.0 and USB 3.2 working modes use a higher working frequency band, which may interfere with the wireless communication of electronic devices, thereby causing abnormal data transmission in wireless communication. Summary of the invention
[0005] The present application aims to provide a USB interface control method and system, and a readable storage medium, which can reduce the risk of abnormal data transmission in wireless communication and improve the stability of data transmission in wireless communication.
[0006] To achieve the above-mentioned purpose, in a first aspect, the present application provides a USB interface control method, which is applied to a device including at least two USB interfaces, including: obtaining a device type of a device that has been connected to a first USB interface, where the first USB interface is one of at least two USB interfaces; if the device type is a wireless device, determining whether there is a second USB interface, where the second USB interface is a USB interface among the at least two USB interfaces whose distance from the first USB interface is less than a preset distance threshold; if the second USB interface exists, obtaining an operating frequency of the wireless device; controlling the second USB interface to stop operating in a target operating mode, wherein the target operating mode is: a mode corresponding to a target frequency band among the operating modes supported by the second USB interface; and a frequency in the target frequency band whose difference with the operating frequency of the wireless device is less than a preset difference threshold.
[0007] In an optional manner, controlling the second USB interface to stop operating in the target working mode includes: controlling a driver program for the second USB interface to execute the target working mode to stop operating, so as to control the second USB interface to stop operating in the target working mode.
[0008] In an optional manner, controlling the second USB interface to stop operating in the target working mode includes: cutting off a loop for the second USB interface to execute the target working mode, so as to control the second USB interface to stop operating in the target working mode.
[0009] In an optional manner, obtaining the device type of the device connected to the first USB interface includes: obtaining a device descriptor of the device; and determining the device type according to the obtained device descriptor.
[0010] In an optional manner, controlling the second USB interface to stop operating in the target working mode includes: if the operating frequency of the wireless device is 2.4 GHz, controlling the second USB interface to stop operating in the USB 3.0 working mode.
[0011] In an optional manner, controlling the second USB interface to stop operating in the target working mode includes: if the operating frequency of the wireless device is 5 GHz, controlling the second USB interface to stop operating in the USB3.2 working mode.
[0012] In a second aspect, the present application provides a USB interface control system, which is applied to a device including at least two USB interfaces, including: a first acquisition module, used to acquire the type of device that has been connected to the first USB interface, the first USB interface being one of the at least two USB interfaces; a judgment module, used to determine whether there is a second USB interface if the device type is a wireless device, the second USB interface being a USB interface of the at least two USB interfaces whose distance from the first USB interface is less than a preset distance threshold; a second acquisition module, used to acquire the operating frequency of the wireless device if the second USB interface exists; and an operating mode control module, used to control the second USB interface to stop operating in a target operating mode, wherein the target operating mode is: a mode corresponding to a target frequency band in the operating modes supported by the second USB interface; and a frequency in the target frequency band whose difference with the operating frequency of the wireless device is less than a preset difference threshold.
[0013] In a third aspect, the present application provides a USB interface control system, comprising: at least two USB interfaces; a control processing unit for controlling the working mode of the USB interface, the control processing unit comprising: at least one processor and a memory communicatively connected to the at least one processor, the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute the method in the first aspect.
[0014] In an optional manner, the USB interface control system also includes a switch unit; the switch unit is respectively connected to at least two USB interfaces and the control processing unit; the switch unit is controlled by the control processing unit and is used to cut off or connect the circuit for the USB interface to execute the working mode.
[0015] In a fourth aspect, the present application provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the processor executes the method in the first aspect.
[0016] The beneficial effect of the present application is that after determining that the device connected to the first USB interface is a wireless device, the USB interface control method provided by the present application controls the second USB interface (a USB interface whose distance from the first USB interface is less than a preset distance threshold) to stop operating in the target working mode. Wherein, the target working mode is a mode corresponding to the target frequency band in the working mode supported by the second USB interface. There is a frequency in the target frequency band whose difference with the working frequency of the wireless device is less than the preset difference threshold. It can be seen that the control method provided by the present application controls the second USB to stop operating in the target working mode after determining that the distance between the second USB interface and the first USB interface is small, and there is a frequency in the target working mode supported by the second USB interface whose difference with the working frequency of the wireless device is small, so that the device connected to the second USB interface cannot operate in the target working mode, which can effectively reduce the risk of the second USB interface interfering with the device connected to the first USB interface, thereby reducing the risk of abnormal data transmission of wireless communication, which is conducive to improving the stability of data transmission of wireless communication. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0018] Figure 1 A flowchart of a USB interface control method provided in Embodiment 1 of the present application;
[0019] Figure 2 A schematic diagram of a USB interface provided in Example 1 of the present application;
[0020] Figure 3 A schematic diagram of the structure of a USB interface control system provided in Example 1 of the present application;
[0021] Figure 4 A schematic diagram of the structure of a USB interface control system provided in Example 2 of the present application;
[0022] Figure 5 This is a schematic diagram of the structure of the USB interface control system provided in Example 3 of the present application. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] In the related art, in daily use of personal computers (PCs) and other consumer electronic products, when two USB ports are respectively connected to a wireless device and a non-wireless device (such as a USB flash drive, and the USB flash drive is taken as an example in the subsequent embodiments of this application), if the distance between the two USB ports is close, it may cause both the wireless device and the USB flash drive to fail to work properly.
[0025] Take the USB3.0 interface as an example. At present, when the USB flash drive can support the USB3.0 protocol, the transmission rate of the USB flash drive working in the USB3.0 working mode is 5Gbps. Since the USB3.0 encoding adopts 8b / 10b encoding, and the encoding rules are to minimize continuous 0 or 1, the direct consequence of such encoding is to generate a non-periodic transmission frequency lower than the bandwidth / 2. Depending on the content of the transmission, the transmission frequency is usually between 625MHz-2.5GHz. Then, when one of the two USB3.0 interfaces is connected to a wireless device with an operating frequency of 2.4GHz and the other is connected to a USB flash drive, there are close or even overlapping parts in the frequencies of the transmission signals of the two, which will cause both the wireless device and the USB flash drive to be unable to be used normally, and then cause both the wireless device and the USB flash drive to be unable to be used normally.
[0026] Based on this, an embodiment of the present application provides a USB interface control method. When the two USB interfaces are close to each other and are respectively connected to a wireless device and a USB flash drive, the method can disable an operating mode of the USB flash drive that may produce a frequency that interferes with the wireless device, so as to achieve normal use of the wireless device and the USB flash drive.
[0027] Please refer to Figure 1 , Figure 1 Flow chart of the USB interface control method provided in the embodiment of the present application. The USB interface control method is applied to a device including at least two USB interfaces. Figure 1 As shown, the USB interface control method includes the following steps:
[0028] Step 11: Obtain a device type of a device that has been connected to a first USB interface, where the first USB interface is one of at least two USB interfaces.
[0029] The first USB interface is any USB interface. The device type includes wireless devices, USB flash drives and other devices that can be connected to the USB interface.
[0030] In some embodiments, if the USB interface control method is applied to a personal computer, the specific process of obtaining the device type of the device connected to the first USB interface in step 11 may include the following steps: obtaining the device descriptor of the device connected to the first USB interface; and determining the device type of the device connected to the first USB interface based on the obtained device descriptor.
[0031] Specifically, a device descriptor (Device Descriptor) is a data structure used in a USB device (eg, a device connected to the first USB interface) and is used to describe basic properties and functions of the USB device.
[0032] In some embodiments, for a PC system (i.e., a computer operating system), the device descriptor of the USB interface may be a HID device descriptor in a device manager under the PC system. Among them, the HID (Human Interface Device) device descriptor refers to a descriptor in a HID class USB device, which is used to describe the specific properties and functions of the device. It is included in the USB configuration descriptor of the device and provides information such as the reporting protocol, data format, and supported functions used by the device. Then, by obtaining the HID device descriptor of the device connected to the first USB interface, the device type of the device connected to the first USB interface can be determined.
[0033] Step 12: If the device type is a wireless device, determine whether there is a second USB interface, where the second USB interface is a USB interface of the at least two USB interfaces whose distance from the first USB interface is less than a preset distance threshold.
[0034] Specifically, the positions of at least two USB interfaces are acquired, and based on the positions of the at least two USB interfaces, it is determined whether a second USB interface exists.
[0035] by Figure 2 Take part a as an example. The at least two USB interfaces include a first USB interface US1, a second USB interface US2, and a third USB interface US3. That is, the USB interface control method is used to control the first USB interface US1, the second USB interface US2, and the third USB interface US3.
[0036] Specifically, the position of the first USB interface US1, the position of the second USB interface US2, and the position of the third USB interface US3 are obtained. Taking the second USB interface US2 corresponding to the first USB interface in the embodiment of the present application as an example, two distances can be determined based on the above three positions, namely, distance L1 and distance L2. Then, by comparing distance L1 and distance L2 with the preset distance thresholds, it can be determined whether the first USB interface US1 and the third USB interface US3 can correspond to the second USB interface in the above embodiment.
[0037] Step 13: If there is a second USB interface, obtain the operating frequency of the wireless device.
[0038] Specifically, the second USB interface is a USB interface whose distance from the first USB interface is less than a preset distance threshold, and there may be one or more second USB interfaces.
[0039] The preset distance threshold is a pre-set threshold, which can be set according to the actual application scenario, and the embodiment of the present application does not impose any specific restrictions on this.
[0040] For example, in some embodiments, the preset distance threshold is configured as the length of a USB interface. Among them, in an embodiment of the present application, the USB interface is a USB Type-A interface. The USB Type-A interface is a rectangular parallelepiped interface. The side of the USB Type-A interface used to access the device and the side opposite thereto are called the bottom surface, and the other four sides are called the side surfaces. The length of the bottom surface is the length of the USB interface. On the one hand, configuring the distance between the second USB interface and the first USB interface to be greater than the length of one USB interface has a better effect of reducing the interference caused by the second USB interface to the first USB interface, so as to improve the stability of data transmission in wireless communication; on the other hand, it can prevent the working mode of the second USB interface from being mistakenly disabled due to the preset distance threshold being set too large.
[0041] In this embodiment, after determining that the first USB interface is connected to a wireless device, by determining whether there is a second USB interface whose distance from the first USB interface is less than a preset distance threshold, it is possible to determine whether there are two USB interfaces that may interfere with each other. Then, if it is determined that there is no second USB interface whose distance from the first USB interface is less than the preset distance threshold, the current state is maintained without any processing. If it is determined that there is a second USB interface whose distance from the first USB interface is less than the preset distance threshold, it is determined that the second USB interface has a risk of generating a signal that interferes with the wireless device connected to the first USB interface when the USB flash drive is connected. Then, the operating frequency of the wireless device is obtained, and the second USB interface is processed in a targeted manner based on the operating frequency of the wireless device to achieve the purpose of reducing the risk of the second USB interface interfering with the first USB interface. Afterwards, by obtaining the operating frequency of the wireless device, the frequency that can interfere with the wireless device can be determined. Among them, the operating frequency of the wireless device includes 2.4GHz and 5.0GHz.
[0042] In an embodiment of the present application, the distance between the second USB interface and the first USB interface may be the distance between two parallel sides of the second USB interface and the first USB interface. That is, if one side of the second USB interface is opposite and parallel to one side of the first USB interface, the distance between the two sides is recorded as the distance between the second USB interface and the first USB interface.
[0043] Please refer to Figure 2 , Figure 2 , a schematic diagram of multiple USB interfaces is exemplarily shown. The multiple USB interfaces include a first USB interface US1, a second USB interface US2, a third USB interface US3, a fourth USB interface US4, a fifth USB interface US5, and a sixth USB interface US6. Moreover, the front surfaces of the first USB interface US1, the second USB interface US2, the third USB interface US3, the fourth USB interface US4, the fifth USB interface US5, and the sixth USB interface US6 are all used to access devices.
[0044] like Figure 2As shown in part a, the distance between the first USB interface US1 and the second USB interface US2 is L1, that is, the distance between the right side of the first USB interface US1 and the left side of the second USB interface US2 is L1. The distance between the second USB interface US2 and the third USB interface US3 is L2, that is, the distance between the right side of the second USB interface US2 and the left side of the third USB interface US3 is L2. Taking the second USB interface US2 as the first USB interface in the embodiment of the present application as an example, at this time, when the distance L1 is less than the preset distance threshold, the first USB interface US1 corresponds to the second USB interface in the embodiment of the present application; when the distance L2 is less than the preset distance threshold, the third USB interface US3 also corresponds to the second USB interface in the embodiment of the present application. At the same time, in this embodiment, the length of a USB interface is L5.
[0045] like Figure 2 As shown in part b, the distance between the fourth USB interface US4 and the fifth USB interface US5 is L3, that is, the distance between the lower side of the fourth USB interface US4 and the lower side of the fifth USB interface US5 is L3. The distance between the fifth USB interface US5 and the sixth USB interface US6 is L4, that is, the distance between the lower side of the fifth USB interface US5 and the upper side of the sixth USB interface US6 is L4. Taking the fifth USB interface US5 as the first USB interface in the embodiment of the present application as an example, at this time, when the distance L3 is less than the preset distance threshold, the fourth USB interface US4 corresponds to the second USB interface in the embodiment of the present application; when the distance L4 is less than the preset distance threshold, the sixth USB interface US6 also corresponds to the second USB interface in the embodiment of the present application.
[0046] Step 14: Control the second USB interface to stop operating in the target working mode, wherein the target working mode is: a mode corresponding to the target frequency band among the working modes supported by the second USB interface; there is a frequency in the target frequency band whose difference with the working frequency of the wireless device is less than a preset difference threshold.
[0047] Among them, the difference between the target frequency band and the working frequency of the wireless device is less than the preset difference threshold, including: the difference between all frequencies in the target frequency band and the working frequency of the wireless device is less than the preset difference threshold, or the difference between some frequencies in the target frequency band and the working frequency of the wireless device is less than the preset difference threshold. As described in the above embodiment, for the USB3.0 interface, if the USB3.0 interface is connected to a USB flash drive, the transmission frequency is usually between 625MHz-2.5GHz, that is, the working frequency band of the USB flash drive (here corresponding to the target frequency band in the above embodiment) is 625MHz-2.5GHz. Take the preset difference threshold of 0.1GHz as an example. If the difference between some frequencies in the target frequency band of the USB flash drive (for example, 2.4GHz) and the working frequency of the 2.4GHz wireless device is less than the preset difference threshold, it can be determined that the difference between the working frequency of the wireless device and the target frequency band is less than the preset difference threshold, and then the USB interface connected to the USB flash drive should be controlled to stop operating in the USB3.0 working mode (here corresponding to the target working mode in the above embodiment).
[0048] The preset difference threshold is a preset threshold, which can be set according to the actual application scenario, and the embodiment of the present application does not impose specific restrictions on this. For example, in some embodiments, the preset difference threshold can be set to any value between [0.1GHz, 0.5GHz] to more accurately determine the working frequency that interferes with the wireless device, thereby reducing the risk of mutual interference between the wireless device and the USB flash drive.
[0049] In one embodiment, an implementation process of controlling the second USB interface to stop operating in the target working mode is: if the working frequency of the wireless device is 2.4 GHz, then controlling the second USB interface to stop operating in the USB 3.0 working mode.
[0050] Specifically, based on the description of the above embodiment, it can be known that the transmission frequency of the target frequency band corresponding to the USB3.0 working mode is between 625MHz-2.5GHz. Take the preset difference threshold of 0.1GHz as an example. When the transmission frequency corresponding to the USB3.0 working mode of the second USB interface is between (2.3GHz, 2.5GHz), the difference between the transmission frequency and the working frequency of the wireless device 2.4GHz remains less than the preset difference threshold of 0.1GHz. At this time, if the second USB interface is connected to a USB flash drive, there may be an abnormal phenomenon of mutual interference between the signal of the USB flash drive and the signal of the wireless device. Then, by controlling the second USB interface to stop operating in the USB3.0 working mode, the probability of the above abnormal phenomenon can be reduced to improve the stability of data transmission in wireless communication. In this case, the second USB interface can operate in the USB2.0 working mode or the USB3.2 working mode.
[0051] In another embodiment, another implementation process of controlling the second USB interface to stop operating in the target working mode is: if the operating frequency of the wireless device is 5 GHz, controlling the second USB interface to stop operating in the USB3.2 working mode.
[0052] Specifically, the transmission rate of USB3.2 is 10Gbps. Based on the same reasons as described above for USB3.0, it can be determined that the operating frequency corresponding to the USB3.2 working mode is around 5GHz. Take the preset difference threshold of 0.1GHz as an example. When the transmission frequency corresponding to the USB3.0 working mode of the second USB interface is between (4.9GHz, 5.1GHz), the difference between the transmission frequency and the working frequency of the wireless device, 5GHz, remains less than the preset difference threshold of 0.1GHz. At this time, if the second USB interface is connected to a USB flash drive, there may be an abnormal phenomenon of mutual interference between the signal of the USB flash drive and the signal of the wireless device. Then, by controlling the second USB interface to stop operating in the USB3.2 working mode, the probability of the above abnormal phenomenon can be reduced to improve the stability of data transmission in wireless communication. In this case, the second USB interface can operate in the USB2.0 working mode or the USB3.0 working mode.
[0053] In addition, the embodiments of the present application also provide two methods of controlling the USB interface to stop operating in the target working mode.
[0054] Optionally, an implementation process of controlling the second USB interface to stop operating in the target working mode is: controlling a driver program for the second USB interface to execute the target working mode to stop operating, so as to control the second USB interface to stop operating in the target working mode.
[0055] Specifically, if the operating frequency of the wireless device is 2.4 GHz, the second USB interface can stop using the USB3.0 operating mode by controlling the driver corresponding to the USB3.0 operating mode of the second USB interface to stop running; if the operating frequency of the wireless device is 5 GHz, the second USB interface can stop using the USB3.2 operating mode by controlling the driver corresponding to the USB3.2 operating mode of the second USB interface to stop running. This embodiment realizes the control of the USB interface operating mode to stop running based on software control.
[0056] In practical applications, if the USB interface control method is applied to a personal computer, the USB3.0 or USB3.2 working mode of the second USB interface can be disabled in the device manager of the personal computer to stop the USB3.0 or USB3.2 working mode of the second USB interface.
[0057] Optionally, another implementation process of controlling the second USB interface to stop operating in the target working mode is: cutting off the loop of the second USB interface executing the target working mode to control the second USB interface to stop operating in the target working mode.
[0058] Specifically, if the operating frequency of the wireless device is 2.4 GHz, the circuit where the second USB interface executes the USB 3.0 operating mode can be cut off, and then the second USB interface stops operating in the USB 3.0 operating mode; if the operating frequency of the wireless device is 5 GHz, the circuit where the second USB interface executes the USB 3.2 operating mode can be cut off, and then the second USB interface stops operating in the USB 3.2 operating mode. This embodiment realizes the control of stopping the operating mode of the USB interface based on hardware control.
[0059] In actual application, if the operating frequency of the wireless device is 2.4GHz, the circuit switch of the USB3.0 working mode can be set on the second USB interface; if the operating frequency of the wireless device is 5GHz, the circuit switch of the USB3.2 working mode can be set on the second USB interface. The set switch can turn on or off the circuit, and then control the USB3.0 or USB3.2 working mode of the second USB interface to run or stop.
[0060] In other embodiments, switches may be set in the circuits corresponding to each working mode of the second USB interface. For example, if the second USB interface has two working modes, USB3.0 and USB3.2, switches may be set in the circuits corresponding to the two working modes. Then, if the USB3.0 working mode is to be stopped, the switch of the circuit where the USB3.0 working mode is located is disconnected; if the USB3.2 working mode is to be stopped, the switch of the circuit where the USB3.2 working mode is located is disconnected. Thus, there is no need to make corresponding settings for specific application scenarios, which is conducive to increasing applicable application scenarios and improving practicality.
[0061] Please refer to Figure 3 , Figure 3 A schematic diagram of the structure of a USB interface control system provided in one embodiment of the present application.
[0062] like Figure 3 As shown, the USB interface control system 30 includes a first acquisition module 31 , a determination module 32 , a second acquisition module 33 and a working mode control module 34 .
[0063] Among them, the first acquisition module 31 is used to obtain the device type of the device that has been connected to the first USB interface, and the first USB interface is one of at least two USB interfaces. The judgment module 32 is used to determine whether there is a second USB interface if the device type is a wireless device, and the second USB interface is a USB interface of at least two USB interfaces whose distance from the first USB interface is less than a preset distance threshold. The second acquisition module 83 is used to obtain the operating frequency of the wireless device if the second USB interface exists. The working mode control module 84 is used to control the second USB interface to stop operating in the target working mode. Among them, the target working mode is: the mode corresponding to the target frequency band in the working mode supported by the second USB interface; there is a frequency in the target frequency band whose difference with the working frequency of the wireless device is less than the preset difference threshold.
[0064] The above product can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the USB interface control method provided in the embodiment of the present application.
[0065] Please refer to Figure 4 , Figure 4 A schematic diagram of the structure of a USB interface control system provided in another embodiment of the present application.
[0066] like Figure 4 As shown, the USB interface control system includes at least two USB interfaces and a control processing unit 40 .
[0067] The at least two USB interfaces include a first USB interface US1, a second USB interface US2, ... an nth USB interface USn, where n is an integer ≥2.
[0068] The control processing unit 40 is respectively connected to the first USB interface US1 , the second USB interface US2 , . . . the nth USB interface USn.
[0069] The control processing unit 40 may be a microcontroller unit (MCU) or a digital signal processing (DSP) controller.
[0070] The control processing unit 40 includes at least one processor 41 and a memory 42, wherein the memory 42 may be built into the control processing unit 40 or may be external to the control processing unit 40. The memory 42 may also be a remotely set memory connected to the control processing unit 40 via a network.
[0071] The memory 42, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 42 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 42 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 42 may optionally include a memory remotely arranged relative to the processor 41, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0072] The processor 41 performs various functions of the terminal and processes data by running or executing software programs and / or modules stored in the memory 42, and calling data stored in the memory 42, thereby monitoring the terminal as a whole, for example, implementing the USB interface control method described in any embodiment of the present application.
[0073] The processor 41 may be one or more, Figure 4 A processor 41 is taken as an example. The processor 41 and the memory 42 may be connected via a bus or other means. The processor 41 may include a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a controller, a field programmable gate array (FPGA) device, etc. The processor 41 may also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP core, or any other such configuration.
[0074] In one embodiment, if Figure 5 As shown, the USB interface control system further includes a switch unit 50. The switch unit 50 is respectively connected to at least two USB interfaces and the control processing unit 40. Specifically, the first USB interface US1, the second USB interface US2 ... the nth USB interface USn are all connected to the control processing unit 40 through the switch unit 50. Furthermore, the control processing unit 40 is connected to the switch unit 50.
[0075] In this embodiment, the switch unit 50 is controlled by the control processing unit 40. The switch unit 50 is used to cut off or connect the circuit of the USB interface to execute the working mode.
[0076] Take curve L11, curve L12...curve L1n respectively representing the first USB interface US1, the second USB interface US2...the nth USB interface USn executing the USB2.0 working mode; and take curve L21, curve L22...curve L2n respectively representing the first USB interface US1, the second USB interface US2...the nth USB interface USn executing the USB3.0 working mode as an example.
[0077] Specifically, the circuits for the first USB interface US1, the second USB interface US2 ... the nth USB interface USn to execute the USB3.0 working mode do not pass through the switch unit 50; the circuits for the first USB interface US1, the second USB interface US2 ... the nth USB interface USn to execute the USB3.0 working mode all pass through the switch unit 50. When it is necessary to control any USB interface among the first USB interface US1, the second USB interface US2 ... the nth USB interface USn to stop executing the USB3.0 working mode, the control processing unit 40 outputs a corresponding control signal to the switch unit 50 to disconnect the circuit where the USB interface is located. For example, if it is necessary to control the first USB interface US1, the control processing unit 40 outputs a control signal to the switch unit 50, and the switch unit 50 disconnects the circuit for the first USB interface US1 to execute the USB3.0 working mode, while any USB interface among the second USB interface US2 ... the nth USB interface USn still maintains normal operation.
[0078] The present application also provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. The computer-executable instructions are executed by one or more processors, for example, to execute the above-described Figure 1 Steps to achieve Figure 3 The functions of each module in.
[0079] The present application also provides a computer program product, including a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the USB interface control method in any of the above method embodiments, for example, executing the above described Figure 1 Steps to achieve Figure 3 The functions of each module in.
[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes in different aspects of the present application as described above, which are not provided in detail for the sake of simplicity. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A USB interface control method, characterized in that: Applicable to a device including at least two USB interfaces, including: Obtaining a device type of a device connected to a first USB interface, where the first USB interface is one of the at least two USB interfaces; If the device type is a wireless device, determining whether there is a second USB interface, where the second USB interface is a USB interface of the at least two USB interfaces whose distance from the first USB interface is less than a preset distance threshold; If the second USB interface exists, obtaining the operating frequency of the wireless device; Control the second USB interface to stop operating in a target operating mode, wherein the target operating mode is: a mode corresponding to a target frequency band among the operating modes supported by the second USB interface; and there is a frequency in the target frequency band whose difference with the operating frequency of the wireless device is less than a preset difference threshold.
2. The USB interface control method according to claim 1, characterized in that: The controlling the second USB interface to stop operating in the target working mode includes: The driver program for controlling the second USB interface to execute the target working mode stops running, so as to control the second USB interface to stop running in the target working mode.
3. The USB interface control method according to claim 1, characterized in that: The controlling the second USB interface to stop operating in the target working mode includes: The loop for the second USB interface to execute the target working mode is cut off to control the second USB interface to stop operating in the target working mode.
4. The USB interface control method according to claim 1, characterized in that: The obtaining of the device type of the device connected to the first USB interface includes: Obtaining a device descriptor for the device; The device type is determined according to the acquired device descriptor.
5. The USB interface control method according to claim 1, characterized in that: The controlling the second USB interface to stop operating in the target working mode includes: If the operating frequency of the wireless device is 2.4 GHz, the second USB interface is controlled to stop operating in the USB 3.0 operating mode.
6. The USB interface control method according to claim 1, characterized in that: The controlling the second USB interface to stop operating in the target working mode includes: If the operating frequency of the wireless device is 5 GHz, the second USB interface is controlled to stop operating in the USB 3.2 operating mode.
7. A USB interface control system, characterized in that: Applicable to a device including at least two USB interfaces, including: A first acquisition module, configured to acquire a device type of a device connected to a first USB interface, where the first USB interface is one of the at least two USB interfaces; a determination module, configured to determine whether there is a second USB interface if the device type is a wireless device, the second USB interface being a USB interface of the at least two USB interfaces whose distance from the first USB interface is less than a preset distance threshold; A second acquisition module, configured to acquire the operating frequency of the wireless device if the second USB interface exists; The working mode control module is used to control the second USB interface to stop operating in a target working mode, wherein the target working mode is: a mode corresponding to a target frequency band among the working modes supported by the second USB interface; and there is a frequency in the target frequency band whose difference with the working frequency of the wireless device is less than a preset difference threshold.
8. A USB interface control system, characterized in that: include: At least two USB ports; A control processing unit, used to control the working mode of the USB interface, the control processing unit comprising: at least one processor and a memory communicatively connected to the at least one processor, the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute the method described in any one of claims 1 to 6.
9. The USB interface control system according to claim 8, characterized in that: The USB interface control system also includes a switch unit; The switch unit is connected to the at least two USB interfaces and the control processing unit respectively; The switch unit is controlled by the control processing unit and is used to cut off or connect the circuit of the USB interface to execute the working mode.
10. A non-volatile computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the processor is caused to execute the method according to any one of claims 1 to 6.