A mode switching method and a first device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-31
- Publication Date
- 2026-08-14
AI Technical Summary
然而,现有技术中,该设备仅作为外设设备被第二设备识别,第二设备无法直接调度或使用该设备中内置的相关资源,容易导致资源浪费
[0003]本公开提供了一种模式切换方法及第一设备,以至少解决现有技术中存在的以上技术问题。
Smart Images

Figure CN122570385A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more particularly to a mode switching method and an electronic device. Background Technology
[0002] In real-world applications, when a device connects to a second device via a high-speed serial computer expansion bus (Peripheral Component Interconnect Express, PCIe) or a universal serial bus (USB), the second device can detect the connection event and identify the device as a peripheral device based on it. However, in existing technologies, the device is only recognized as a peripheral device by the second device, which cannot directly schedule or use the device's built-in resources, easily leading to resource waste. Summary of the Invention
[0003] This disclosure provides a mode switching method and a first device to at least solve the above-mentioned technical problems existing in the prior art.
[0004] According to a first aspect of this disclosure, a mode switching method is provided, applied to a first device, the method comprising:
[0005] Acquire detection signals; In response to a low-level detection signal, the data link of at least one functional unit in the first device is switched to connect with the second device. After the data link is switched, the at least one functional unit is identified as a slave device of the second device, so that the first device enters peripheral mode.
[0006] In one possible implementation, at least one functional unit includes at least one of a computing unit, a storage unit, and an audio unit; After switching data links, the computing power unit is identified as the computing power slave device of the second device through the high-speed serial computer expansion bus PCIe. After the data link is switched, the storage unit is identified as a storage slave device of the second device via a Universal Serial Bus (USB) or a PCIe bus. After the data link is switched, the audio unit is identified as the audio slave device of the second device via the USB bus.
[0007] In one possible implementation, the method further includes: In response to a high-level detection signal, the data link of at least one functional unit in the first device is switched to be connected to the first device, so that the first device enters an independent mode.
[0008] In one possible implementation, the method further includes: Monitor the operating status of the second device; When the second device is determined to be in an idle state and the idle time reaches the preset duration, the detection signal is switched from a low level signal to a high level signal.
[0009] In one possible implementation, before acquiring the detection signal, the method further includes: Obtain the first identification information sent by the second device; If the first identification information of the second device matches the first reference identification information pre-stored in the first device, the second device is determined to be the bound device of the first device, and the acquisition of the detection signal is triggered. or, Obtain the first identification information sent by the second device; Send the second identification information of the first device to the second device; If it is determined that the first identification information matches the first reference identification information pre-stored by the first device, and the second identification information matches the second reference identification information pre-stored by the second device, then it is determined that the first device and the second device are bound to each other, and the acquisition of the detection signal is triggered. The identification information includes the Product Identifier (PID) and / or the Manufacturer Identifier (VID).
[0010] In one possible implementation, at least one functional unit includes a computing unit; the method further includes: In response to the first device entering peripheral mode, a power consumption request is sent to the second device through the power delivery PD data channel. The power consumption request includes current parameters and / or voltage parameters corresponding to the computing unit. If the PD controller of the second device verifies that the power consumption request is successful, it adjusts the power supply current of the computing unit based on the current parameters and / or adjusts the power supply voltage of the computing unit based on the voltage parameters, so that the computing unit operates at a first power consumption value.
[0011] In one possible implementation, at least one functional unit includes a computing unit; the method further includes: In response to the first device entering independent mode, the power supply path in the second device used to power the computing unit is cut off, and the computing unit is controlled to operate at a second power consumption value.
[0012] In one possible implementation, the method further includes: In response to the first device entering peripheral mode, determine multiple data fragments to be transmitted to the second device; During the process of the first device transmitting multiple data fragments to the second device using the first transmission link, the link parameters of the second transmission link are monitored. When the link parameters of the second transmission link meet the preset link switching conditions, the remaining data fragments are transmitted to the second device using the second transmission link. The remaining data fragments are the data fragments that were not transmitted to the second device through the first transmission link when the first transmission link was switched to the second transmission link.
[0013] In one possible implementation, the method further includes: Determine the required link parameters for transmitting multiple data fragments; Obtain the actual link parameters corresponding to at least two transmission links between the first device and the second device; the at least two transmission links include the first transmission link and the second transmission link. Based on the actual link parameters corresponding to at least two transmission links and the required link parameters corresponding to multiple data fragments, determine the link scores corresponding to at least two transmission links respectively. The transmission link with the highest link score is determined from at least two transmission links and designated as the first transmission link.
[0014] According to a second aspect of this disclosure, a first device is provided, comprising: At least one functional unit; The detection module is used to acquire detection signals; A microcontroller unit is configured to switch the data link of at least one functional unit in the first device to be connected to the second device in response to a low-level detection signal, wherein at least one functional unit after the data link is switched is determined to be a slave device of the second device, so that the first device enters peripheral mode.
[0015] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0016] The above and other objects, features, and advantages of this disclosure will become readily apparent from the following detailed description of exemplary embodiments, taken in conjunction with the accompanying drawings. Several embodiments of this disclosure are illustrated in the drawings by way of example and not limitation, in which: In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
[0017] Figure 1 This illustration shows a schematic diagram of the implementation flow of a mode switching method provided in an embodiment of this disclosure. Figure 1 ; Figure 2 This illustration shows a schematic diagram of the implementation flow of a mode switching method provided in an embodiment of this disclosure. Figure 2 ; Figure 3 This illustration shows a schematic diagram of the implementation flow of a mode switching method provided in an embodiment of this disclosure. Figure 3 ; Figure 4 A schematic diagram of the composition structure of a mode switching system according to an embodiment of the present disclosure is shown. Detailed Implementation
[0018] To make the objectives, features, and advantages of this disclosure more apparent and understandable, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0019] Currently, when docking stations and USB devices connect to a second device, the following initialization scheme is typically used: When a device connects to a second device via a PCIe bus or USB bus, the second device can detect the connection event, read the device descriptor and other information based on the connection event, load the corresponding driver according to the obtained information, and recognize the device as its own peripheral device.
[0020] However, in this initialization scheme, the device can only be recognized by the second device as a peripheral device. The second device cannot recognize the functional units in the device that integrate resources such as storage and computing. Therefore, after the device is connected to the second device, its built-in storage resources and computing resources cannot be directly recognized and called by the second device, which can easily lead to a waste of resources.
[0021] Based on this, the present disclosure provides a mode switching method and a first device to at least solve the technical problem in the prior art where the second device cannot directly schedule or use the device's built-in resources because the device is only recognized as a peripheral device by the second device.
[0022] The mode switching method provided in this disclosure will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0023] Figure 1 This is a schematic diagram of the implementation flow of the mode switching method provided in the embodiments of this disclosure. Figure 1 .
[0024] like Figure 1 As shown, the executing entity of this method can be a first device. Based on this, the mode switching method provided in this embodiment of the disclosure may include the following steps: S110, acquire the detection signal.
[0025] S120, in response to the detection signal being a low-level signal, the data link of at least one functional unit in the first device is switched to be connected to the second device, and the at least one functional unit after the data link is switched is determined to be a slave device of the second device, so that the first device enters the peripheral mode.
[0026] The detection signal can be used to characterize whether the first device is electrically connected to the second device. Specifically, it can include a high-level signal or a low-level signal. If the detection signal is a high-level signal, it indicates that the first device is not connected to the second device. If the detection signal is a low-level signal, it indicates that the first device is electrically connected to the second device. No specific limitation is made here.
[0027] The first device mentioned above can be a hardware device with artificial intelligence computing capabilities. For example, the first device can be understood as a Large Language Model (LLM) device, without specific limitations here. The second device mentioned above refers to a computing device that can be connected to the first device and used to schedule and manage its resources. For example, the second device can be understood as an Artificial Intelligence Personal Computer (AI PC) device, without specific limitations here either.
[0028] Based on this, the aforementioned at least one functional unit can be a hardware module or circuit component with specific functions integrated within the first device, such as a computing unit, a storage unit, an audio unit, etc., wherein the audio unit may include a microphone and a speaker, without specific limitations. In the embodiments of this disclosure, the at least one functional unit can be scheduled and used by the second device as a resource such as computing resources, storage resources, or audio resources through data link switching, without specific limitations.
[0029] Specifically, the first device can acquire a detection signal. If the detection signal is low, it indicates that the first device is electrically connected to the second device. In response to the low-level detection signal, the first device can switch the data link of at least one functional unit in the first device to connect to the second device. After the switch is completed, at least one functional unit after the data link switch can be identified as a slave device of the second device, thereby enabling the first device to enter peripheral mode.
[0030] More precisely, if the detection signal is a low-level signal, the first device can respond to the low-level signal by controlling the multiplexer (MUX) to switch the data link of at least one functional unit in the first device to connect with the system on chip (SOC) of the second device. This will not be elaborated further here.
[0031] It should be noted that after the first device enters peripheral mode, the second device can establish communication with the first device via the PCIe bus and detect and process the tasks to be completed on the first device. The specific process is as follows: First, following the vendor-defined message (VDM) definition of the Power Delivery Interface Controller (PDIC), the second device establishes communication with the first device via the PCIe bus, enabling it to detect pending tasks. For example, it can access the "Task Log Index Table" in Universal Flash Storage (UFS), which records the identifiers, creation times, and data storage paths of all incomplete tasks; or it can check whether there is temporary unprocessed task data (such as real-time voice cache, inference intermediate results, etc.) in a memory buffer (such as Dynamic Random Access Memory (DRAM)). This allows the second device to detect pending tasks in the first device.
[0032] If a task to be completed is detected, the SoC in the first device can establish a high-speed data transmission channel with the second device through the PCIe bus, and read the corresponding data files (such as voice cache, inference intermediate results, etc.) from the UFS according to the task log index table, and transfer these data files to the designated directory of the solid state disk (SSD) of the second device to provide data support for subsequent operations.
[0033] After the data migration is complete, the second device selects to activate its local computing unit (such as its own eXtensible Processing Unit (XPU)) or the computing unit designated as a slave device in the first device, based on the task type of the received task to be completed, to execute the AI calculation. Furthermore, after the calculation is completed, the second device can display and save the AI calculation results, thus completing the entire task processing process.
[0034] Based on the mode switching method provided in this embodiment, the first device can acquire a detection signal and, in response to the detection signal being a low-level signal, switch at least one functional unit in the first device to be connected to the second device. After the switch is completed, at least one functional unit after the data link switch is determined as a slave device of the second device, so that the first device enters peripheral mode. Thus, during the mode switching process, at least one functional unit built into the first device can be directly scheduled and used by the second device as computing, storage, or other resources through the data link switch, avoiding resource waste caused by the second device being unable to directly schedule or use the built-in resources of the device when it is only recognized as a peripheral device.
[0035] It should be noted that, in some embodiments, at least one functional unit provided by the present disclosure may include at least one of a computing unit, a storage unit, and an audio unit.
[0036] If at least one functional unit includes a computing power unit, the computing power unit after switching data links can be identified as the computing power slave device of the second device through the high-speed serial computer expansion bus PCIe. If at least one functional unit includes a storage unit, the storage unit after switching data links can be identified as a storage slave device of the second device via a USB bus or a PCIe bus. If at least one functional unit includes an audio unit, the audio unit after switching data links can be identified as the audio slave device of the second device via the USB bus.
[0037] Thus, the first device can acquire a detection signal. If the detection signal is low, the first device can switch the data link of at least one of its computing unit, storage unit, and audio unit to connect to the second device in response to the low-level detection signal. Accordingly, the computing unit after the link switch can be identified as a computing slave device of the second device via the PCIe bus, the storage unit can be identified as a storage slave device of the second device via the USB bus or PCIe bus, and the audio unit can be identified as an audio slave device of the second device via the USB bus, thereby enabling the first device to enter peripheral mode.
[0038] In this embodiment, in response to a low-level detection signal, the data link of at least one of the computing unit, storage unit, and audio unit built into the first device can be switched to connect to the second device. After the data link is switched, at least one of the computing unit, storage unit, and audio unit can be identified as a computing slave device, storage slave device, and audio slave device of the second device, thereby enabling the first device to enter peripheral mode. Thus, during mode switching, the second device can directly identify and schedule at least one functional unit in the first device, effectively avoiding the idle waste of the first device's built-in resources.
[0039] In order to provide a comprehensive and detailed description of the mode switching method provided in the embodiments of this disclosure, in one embodiment, such as Figure 2 As shown, the mode switching method provided in this embodiment may further include the following steps: S210, in response to the detection signal being a high-level signal, the data link of at least one functional unit in the first device is switched to be connected to the first device, so that the first device enters the independent mode.
[0040] Thus, if the first device can respond to a high-level detection signal, indicating that the first device is not electrically connected to the second device, the data link of at least one functional unit in the first device can be switched to be connected to the first device, so that the first device enters independent mode.
[0041] It should be noted here that if the detection signal is a high-level signal, the first device can respond to the detection signal being a high-level signal by controlling the MUX to switch the data link of at least one functional unit in the first device to connect with the SOC of the first device. This will not be elaborated further here.
[0042] In a complete example, the first device is able to acquire a detection signal. If the detection signal is a high-level signal, the first device is able to switch the data link of at least one functional unit within the first device to be connected to the first device in response to the detection signal being a high-level signal, so that the first device enters an independent mode.
[0043] Alternatively, the first device can acquire a detection signal. If the detection signal is low, the first device can switch the data link of at least one functional unit within the first device to connect with the second device in response to the low-level detection signal. After the switch is completed, the at least one functional unit after the data link switch can be identified as a slave device of the second device, thereby enabling the first device to enter peripheral mode. After the first device enters peripheral mode, the first device can continuously acquire detection signals. If the detected detection signal is high, the first device can switch the data link of at least one functional unit within the first device to connect with the first device in response to the high-level detection signal, thereby enabling the first device to switch from peripheral mode to independent mode.
[0044] In this embodiment, in response to a low-level detection signal, the data link of at least one functional unit in the first device can be switched to be connected to the first device, enabling the first device to enter an independent mode. Thus, the mode switching of the first device can be flexibly implemented in response to the acquired detection signal.
[0045] The detection signal in this embodiment can be used to reflect the connection status between the second device and the first device. In other words, this embodiment can realize mode switching of the first device by monitoring the connection status between the second device and the first device. In addition, this embodiment also provides another dynamic mode switching method. Based on this, in order to comprehensively and thoroughly describe the mode switching method provided by this embodiment, in one embodiment, the mode switching method provided by this embodiment may specifically include the following steps: Monitor the operating status of the second device; When the second device is determined to be in an idle state and the idle time reaches the preset duration, the detection signal is switched from a high-level signal to a low-level signal.
[0046] The operating status of the second device can be determined based on whether it is executing the tasks pending completion from the first device, or whether it is performing other related tasks; no specific limitations are made here. Furthermore, the aforementioned preset duration can be based on practical experience or circumstances; no specific limitations are made here.
[0047] Specifically, after the first device enters the peripheral mode, the first device can monitor the working status of the second device. If it determines that the working status of the second device is idle and the idle time reaches the preset time, which indicates that the second device has not processed the task or other task of the first device for a long time, the first device can switch the detection signal from a low level signal to a high level signal so that the first device can respond to the detection signal being a high level signal and control the first device to switch from the peripheral mode to the independent mode.
[0048] In this embodiment, the operating status of the second device can be detected, and when it is determined that the second device is in an idle state and the idle time reaches a preset duration, the detection signal is switched from a low-level signal to a high-level signal. This allows the first device to respond to the high-level detection signal and control the first device to switch from peripheral mode to independent mode. Thus, when the second device does not need to serve the first device, the first device can switch to independent mode promptly, achieving automatic switching of the first device's operating mode and avoiding resource waste caused by the first device still occupying peripheral mode when the second device is idle for a long time.
[0049] Furthermore, to prevent unidentified devices from occupying the computing or storage resources of the first device, it is necessary to authenticate the second device connected to the first device before switching the data link of at least one functional unit in the first device. Based on this, in one embodiment, before S110, the mode switching method provided in this disclosure embodiment may include the following steps: Obtain the first identification information sent by the second device; If the first identification information of the second device matches the first reference identification information pre-stored in the first device, the second device is determined to be the bound device of the first device, and the acquisition detection signal is triggered.
[0050] The aforementioned identification information includes a product identifier (Product ID, PID) and / or a vendor identifier (VID). Correspondingly, the first identification information may include the PID and / or VID of the second device. The first reference identification information is the identification information pre-stored by the second device in the first device, used as a reference comparison benchmark.
[0051] Specifically, when the first device and the second device are electrically connected, the first device can obtain the first identification information sent by the second device and determine whether the first identification information matches the first reference identification information pre-stored in the first device. If they match, the second device can be determined to be the bound device of the first device and can trigger the acquisition of the detection signal.
[0052] In this embodiment, the first device can obtain first identification information sent by the second device and match it with first reference identification information pre-stored in the first device. If the match is successful, i.e., when the second device is determined to be a bound device of the first device, a detection signal is triggered. This allows for effective authentication of the second device before data link switching, preventing unidentified devices from occupying the first device's computing or storage resources, thereby ensuring the security of the first device and its data.
[0053] In one embodiment, prior to S110, the mode switching method provided in this disclosure embodiment may include the following steps: Obtain the first identification information sent by the second device; Send the second identification information of the first device to the second device; If it is determined that the first identification information matches the first reference identification information pre-stored by the first device, and the second identification information matches the second reference identification information pre-stored by the second device, then it is determined that the first device and the second device are bound to each other, and the acquisition of the detection signal is triggered.
[0054] The aforementioned identification information may include a PID and / or a VID. Correspondingly, the first identification information may include the PID and / or VID of the second device, and the first reference identification information is the identification information pre-stored by the second device in the first device, used as a reference comparison benchmark. The second identification information may include the PID and / or VID of the first device, and the second reference identification information is the identification information pre-stored by the first device in the second device, used as a reference comparison benchmark.
[0055] Specifically, it can acquire the first identification information sent by the second device and send the second identification information of the first device to the second device. In this way, if it is determined that the first identification information matches the first reference identification information pre-stored by the first device and the second identification information matches the second reference identification information pre-stored by the second device, it can determine that the first device and the second device are bound to each other and trigger the acquisition of detection signals.
[0056] In this example, the first device obtains first identification information sent by the second device and verifies it using pre-stored first reference identification information. Simultaneously, the second device obtains second identification information sent by the first device and verifies it using pre-stored second reference identification information. If both verifications pass, it is confirmed that the first and second devices are bound together, triggering the acquisition of a detection signal. This allows for effective authentication of the second device before data link switching, preventing unidentified devices from occupying the first device's computing or storage resources, thus ensuring the security of the first device and its data.
[0057] To provide a comprehensive and detailed description of the mode switching method provided in this disclosure, it should be noted that after the first device connects to the second device and enters peripheral mode, its built-in computing power unit can detach from the first device and be designated as a computing power slave device of the second device, operating in a high-performance mode (e.g., with a power consumption of 25W), thereby directly sharing the computing power load of the second device. Based on this, in one embodiment, where at least one functional unit includes a computing power unit, the mode switching method provided in this disclosure may further include the following steps: In response to the first device entering peripheral mode, a power consumption request is sent to the second device through the power delivery PD data channel. If the PD controller of the second device verifies that the power consumption request is successful, the power supply current of the computing unit is adjusted based on the current parameter, and / or the power supply voltage of the computing unit is adjusted based on the voltage parameter, so that the computing unit operates at a first power consumption value.
[0058] The aforementioned power consumption request may include current and / or voltage parameters corresponding to the computing unit. These current and / or voltage parameters can be used to enable the computing unit to operate at a first power consumption value. For example, if the first power consumption value is 25W, the current parameter can be set to 25A and the voltage parameter can be set to 1.0V; no specific limitations are made here.
[0059] Specifically, in response to the first device entering peripheral mode, it can send a power consumption request to the second device via a Power Delivery (PD) data channel. This power consumption request may include current parameters and / or voltage parameters corresponding to the computing unit. Thus, the PD controller of the second device can verify the power consumption request. If the verification is successful, and the power consumption request includes a current parameter, the second device can adjust the power supply current of the computing unit based on the current parameter; if the power consumption request includes a voltage parameter, the second device can adjust the power supply voltage of the computing unit based on the voltage parameter; if the power consumption request includes both current and voltage parameters, the second device can adjust the power supply current and voltage based on both respectively, thereby enabling the computing unit to operate at a first power consumption value.
[0060] In one example, in response to the first device entering peripheral mode—that is, the computing unit in the first device being recognized as a computing slave device of the second device—the first device can send a power consumption request to the second device via the PD data channel of the Type-C interface. This power consumption request can include power supply parameters corresponding to the computing power level (e.g., a 25W computing power level corresponds to a power supply voltage of 1.0V and a power supply current of 25A). Thus, after verifying the power consumption request, the PD controller of the second device can adjust the output power to the corresponding level based on the power supply parameters in the request, providing a stable power supply to the first device.
[0061] In this way, the second device can run the issued driver to perform formal initialization of the first device. After initialization is complete, the first device can receive the task schedule from the second device and switch its model loading path from local storage to the second device's Non-Volatile Memory Host Controller Interface Specification (NVMe) hard drive to make full use of the second device's storage resources and reduce the computing load on the second device.
[0062] In this embodiment, after the first device enters peripheral mode, it sends a power consumption request containing current and / or voltage parameters to the second device via the PD data channel. After verification by the second device's PD controller, the power supply current and / or voltage of the computing unit are dynamically adjusted according to the parameters in the power consumption request, enabling the computing unit to operate at a first power consumption value. This achieves on-demand configuration of the computing unit's power supply parameters, allowing it to operate at a fixed power consumption value based on the power supply capacity of the second device and actual task requirements, avoiding computing power limitations due to insufficient power supply or resource waste due to excessive power supply.
[0063] Furthermore, if the first device enters independent mode, the computing unit, as the local computing unit of the first device, needs to operate in low-power mode (running at 10W power consumption) to handle lightweight AI tasks. Based on this, in one embodiment, the at least one functional unit may include a computing unit, and the mode switching method provided in this disclosure embodiment may further include the following steps: In response to the first device entering independent mode, the power supply path in the second device used to power the computing unit is cut off, and the computing unit is controlled to operate at a second power consumption value.
[0064] The second power consumption value can be determined according to the actual situation, and no specific limitation is made here. In addition, the second power consumption value can be less than the first power consumption value mentioned above, and no specific limitation is made here.
[0065] Specifically, the first device can respond to entering an independent mode by cutting off the power supply path in the second device used to power the computing unit, and can control the computing unit to operate at a second power consumption value.
[0066] In one example, in response to the first device entering standby mode, the first device can automatically cut off the power supply path in the second device used to power the computing unit, such as the voltage bus (VBUS) power supply path of the Type-C interface, switch to power supply by the internal battery, and send a power consumption configuration command to the power management unit (PMU) of the computing unit through the microcontroller unit (MCU) via the inter-integrated circuit (I2C) bus, so that the computing unit operates at 10W to adapt to the power supply capability in standby mode.
[0067] In addition, the first device can control the power supply current of the computing unit, for example, limiting its power supply current to 12.5A (10W / 0.8V). Furthermore, when the voltage of the computing unit falls below a preset voltage threshold (which can be set to 3.2V), it can trigger the computing unit to automatically reduce its frequency to a third power consumption value (e.g., 5W) to extend the device's battery life. It should also be noted that in standalone mode, for real-time interactive scenarios, the first device can call upon the computing unit for local AI computation; for non-real-time interactive scenarios, relevant data and task logs can be saved to local storage for later processing.
[0068] In this embodiment, after the first device enters independent mode, the power supply path for powering the computing unit in the second device is switched off, and the computing unit is controlled to operate at a second power consumption value. This allows for timely disconnection of the power supply path on the second device side when the first device is disconnected from the second device or when no host power is required, thereby reducing the power consumption of the second device. Furthermore, by controlling the computing unit to operate at the second power consumption value, on-demand power supply configuration for the computing unit is achieved.
[0069] Furthermore, if, during data transmission between the first and second devices via the current transmission link, it is necessary to switch to another transmission link, the transmission task on the current link often needs to be interrupted, and a new link established to restart the data transmission task. For example, if the first device can transmit data to the second device via a Wi-Fi link, but during the data transmission process it is found that the Wi-Fi link is slow or malfunctioning, and it is necessary to switch to a Type-C link for data transmission, the transmission task on the Wi-Fi link needs to be interrupted, and the Type-C link selected to restart the transmission task. This not only causes redundant consumption of resources such as time and bandwidth, but also disrupts the continuity of the data transmission process and reduces data transmission efficiency.
[0070] Based on this, in order to effectively improve the data transmission efficiency between the first device and the second device, and at the same time reduce the repeated consumption of resources such as time and bandwidth during data transmission, in one embodiment, such as Figure 3 As shown, the mode switching method provided in this embodiment may further include the following steps: S310, determine the multiple data fragments to be transmitted to the second device.
[0071] The aforementioned data fragments together constitute the data to be transmitted, which is the data that the first device wants to transmit to the second device. This data to be transmitted can be, for example, model files, logs, or other related data; no specific limitation is made here.
[0072] Specifically, if the first device needs to transmit relevant data to the second device, it can first determine the data to be transmitted from the first device to the second device, and then divide the data to be transmitted according to a preset fragment size, thereby determining multiple data fragments to be transmitted by the second device. The preset fragment size can be determined according to the actual situation; for example, it can be set to 1MB, but no specific limitation is made here.
[0073] S320: During the process of the first device transmitting multiple data fragments to the second device using the first transmission link, the link parameters of the second transmission link are monitored.
[0074] Specifically, after determining the multiple data fragments to be transmitted from the first device to the second device, the first device can transmit the multiple data fragments to the second device using the first transmission link. During this transmission process, the first device can also monitor the link parameters of the second transmission link in real time, thereby facilitating the selection of the link that meets the actual needs from the first and second transmission links for transmission.
[0075] Here, the first transmission link is the link currently transmitting data, while the second transmission link can be a link with better transmission performance than the first transmission link. This transmission performance can be, for example, transmission speed, or it can be a link with higher priority than the first transmission link. The priority can be determined according to the actual situation and is not specifically limited here. In addition, the link parameters of the second transmission link refer to parameters related to the data transmission of the second transmission link, and are not specifically limited here.
[0076] It should be noted that the first transmission link and the second transmission link can be different types of transmission links. Specifically, the first transmission link can be a wireless transmission link, and the second transmission link can be a wired transmission link. For example, the first transmission link can be a Wi-Fi transmission link, and the second transmission link can be a Type-C link. Further details are omitted here. Additionally, the first transmission link and the second transmission link can be the same type of transmission link, for example, both can be wireless or wired transmission links. No specific limitations are imposed here.
[0077] S330, if the link parameters of the second transmission link meet the preset link switching conditions, the remaining data fragments are transmitted to the second device using the second transmission link.
[0078] Specifically, after monitoring and obtaining the link parameters of the second transmission link, it can be determined whether the link parameters of the second transmission link meet the preset link switching conditions. If they do, it indicates that the current transmission link can be switched from the first transmission link to the second transmission link, and the remaining data fragments can be used to continue transmitting to the second device using the second transmission link, thereby achieving seamless switching of the transmission link. The remaining data fragments can be data fragments that were not transmitted to the second device via the first transmission link when switching from the first to the second transmission link; no specific limitation is made here.
[0079] The preset link switching conditions can be determined based on actual conditions. For example, the preset link switching conditions may include the second transmission link being in a transmittable state. Specifically, if the second transmission link is a wired transmission link, it can be determined that the second transmission link is in a transmittable state if it is connected, and that it is in a non-transmittable state if it is disconnected. If the second transmission link is a wireless transmission link, it can be determined that the second transmission link is in a transmittable state if there is no link failure, and that it is in a non-transmittable state if there is a link failure.
[0080] In addition, the preset link switching condition may also include that the link parameters of the second transmission link are better than those of the first transmission link. Specifically, it can be determined whether the link parameters of the second transmission link are better than those of the first transmission link by comparing the link parameters of the same type of the first and second transmission links. Alternatively, the transmission performance of the first and second transmission links can be comprehensively judged based on the link parameters of the first and second transmission links respectively to determine whether the link parameters of the second transmission link are better than those of the first transmission link.
[0081] In this embodiment, multiple data fragments to be transmitted from the first device to the second device can be determined. During the transmission of these data fragments from the first device to the second device using the first transmission link, the link parameters of the second transmission link are monitored in real time. If the link parameters of the second transmission link meet preset link switching conditions, the remaining data fragments that were not transmitted to the second device using the first transmission link are continued to be transmitted using the second transmission link. This not only enables seamless switching between the first and second transmission links, effectively improving data transmission efficiency, but also ensures that the second transmission link, after switching, only transmits the remaining data fragments, avoiding redundant consumption of resources such as time and bandwidth caused by repeated transmission of data fragments.
[0082] Based on this, in order to accurately determine the remaining data fragments and thus avoid the omission or duplicate transmission of data fragments, in one embodiment, before S330, the mode switching method provided in this disclosure embodiment may further include the following steps: Obtain fragment transmission status information for multiple data fragments. The fragment transmission status information includes the metadata and transmission status of each data fragment. Based on the metadata and transmission status of each data fragment, the data fragments with a transmission status of "not transmitted" are identified from multiple data fragments as the remaining data fragments.
[0083] It should be noted that the metadata of each data fragment can uniquely identify that data fragment, which may include data such as fragment identifier, fragment size, checksum, and file information. The fragment identifier can be set after the data has been divided into multiple fragments. For example, if N data fragments are obtained, the fragment identifiers of these N data fragments can be set as (File1D_1, File1D_2, ..., File1D_i, ..., File1D_N), without any specific limitations here.
[0084] In addition, the transmission status of data fragments includes a transmitted state and a not transmitted state. Alternatively, the transmission status of data fragments includes a transmitted state, a state in the process of transmission, and a state not yet transmitted. No specific limitations are imposed here.
[0085] Thus, during the process of the first device transmitting multiple data fragments to the second device through the first transmission link, if it is necessary to switch the transmission link from the first transmission link to the second transmission link, the fragment transmission status information of the multiple data fragments can be obtained. The fragment transmission status information may include the metadata and transmission status of each data fragment. In this way, based on the metadata and transmission status of each data fragment, the data fragments with the transmission status of not being transmitted can be determined from the multiple data fragments as the remaining data fragments, so that the remaining data fragments can be transmitted using the second transmission link.
[0086] It should be noted that if there is a data fragment in the transmission state among the multiple data fragments, the first transmission link can be used to transmit the data fragment in the transmission state. When the transmission of the data fragment in the transmission state ends, the first transmission link can be stopped to continue transmitting the next data fragment, and the second transmission link can be used to continue transmitting the remaining data fragments.
[0087] In this embodiment, by acquiring the fragment transmission status information of multiple data fragments, and based on this information, the remaining data fragments can be identified as those in an "untransmitted" state. This allows for accurate identification of the remaining data fragments, thereby preventing missed or duplicate transmissions of data fragments.
[0088] During the transmission of multiple data fragments from the first device to the second device, the link parameters required for the transmission link will differ depending on the task type of each data fragment. Therefore, using the same transmission link for data fragments of different task types is insufficient to meet the transmission requirements of each task type. For example, using a unified Wireless Fidelity (Wi-Fi) link to transmit all data fragments results in high power consumption; using a unified Bluetooth link fails to meet the performance requirements of high-bandwidth tasks (such as video transmission). Specifically, the power consumption of a Bluetooth link is approximately 1.2 mAh to 1.5 mAh, which is about 80% lower than the 8.5 mAh to 10 mAh of a Wi-Fi link, and the bandwidth of a Bluetooth link can meet the requirements of high-definition audio transmission. However, in video transmission scenarios, the actual bandwidth of Bluetooth links is only 1.2Mbps to 1.5Mbps, which cannot support the 5Mbps to 10Mbps bandwidth required for 1080p video, and the latency is as high as 350ms to 450ms; while the latency of Wi-Fi links in the 5G band is only 30ms to 100ms, and the link bandwidth is sufficient.
[0089] Based on this, in order to meet the transmission requirements of different task types, in one embodiment, the mode switching method provided by this disclosure may further include the following steps: Determine the required link parameters for transmitting multiple data fragments; Obtain the actual link parameters corresponding to at least two transmission links between the first device and the second device; Based on the actual link parameters corresponding to at least two transmission links and the required link parameters corresponding to multiple data fragments, determine the link scores corresponding to at least two transmission links respectively. The transmission link with the highest link score is determined from at least two transmission links and designated as the first transmission link.
[0090] The aforementioned required link parameters refer to the parameter requirements that the transmission link must meet during the transmission of these multiple data fragments. These required link parameters can be determined based on the task types of the multiple data fragments, with different task types corresponding to different required link parameters. Task types can include at least one of the following: voice interaction, voice commands, image transmission, video streaming, data backup, and model library upgrades. Required link parameters can include minimum bandwidth requirements, maximum latency, task data volume, and task real-time level (for example, the task real-time level is divided into five levels, namely level 1 to level 5, with real-time requirements increasing sequentially; where level 1 corresponds to non-real-time tasks, and level 5 corresponds to strongly real-time tasks), etc., without specific limitations here.
[0091] In addition, the aforementioned at least two transmission links may include a first transmission link and a second transmission link. The actual link parameters corresponding to the at least two transmission links may refer to the link parameters of the at least two transmission links during data transmission. These link parameters may include link bandwidth, link power consumption, link delay, connection status, etc., without specific limitations here.
[0092] Specifically, the first device can determine the required link parameters for transmitting multiple data fragments and obtain the actual link parameters corresponding to at least two transmission links between the first device and the second device. Then, for each of the at least two transmission links, based on the actual link parameters of the transmission link and the required transmission parameters corresponding to the multiple data fragments, the link score of the transmission link can be determined. Then, the transmission link with the highest link score can be determined from the at least two transmission links as the first transmission link for transmitting multiple data fragments.
[0093] In this embodiment, during the process of selecting a first transmission link for transmitting multiple data fragments, a link score can be calculated for each transmission link based on its actual link parameters and the required link parameters for transmitting the multiple data fragments. Then, based on these transmission scores, a transmission link that meets the transmission requirements of the multiple data fragments can be selected as the first transmission link for transmitting the multiple data fragments. This allows for the accurate determination of transmission links suitable for transmitting multiple data fragments.
[0094] In order to accurately calculate the link score of each transmission link and select the first transmission link from each transmission link for the transmission of multiple data fragments, in one embodiment, the actual link parameters of the above transmission links may include first attribute parameters of a first type. Correspondingly, the required link parameters may also include first type demand parameters. For example, the first attribute parameters may include at least one of link bandwidth and link delay. Correspondingly, the demand parameters may include at least one of minimum bandwidth demand and maximum delay. No specific limitation is made here.
[0095] Based on this, the steps described above for determining the link scores corresponding to at least two transmission links based on the actual link parameters corresponding to at least two transmission links and the required link parameters corresponding to multiple data fragments may specifically include the following steps: For each of at least two transmission links, calculate the matching score corresponding to the transmission link based on the first attribute parameter and the requirement parameter corresponding to the transmission link; The link score of the transmission link is determined based on the matching score corresponding to the transmission link.
[0096] The matching score can be used to characterize the degree of matching or satisfaction between the first attribute parameter and the requirement parameter.
[0097] Specifically, since the actual link parameters of each transmission link may include first attribute parameters of the first type, the required link parameters may include first demand parameters of the first type. Based on this, for each of the at least two transmission links, the matching score corresponding to the transmission link is calculated based on the first attribute parameters corresponding to the transmission link and the demand parameters for transmitting the multiple data fragments. Then, the link score of the transmission link can be determined based on the matching score corresponding to the transmission link.
[0098] Furthermore, this disclosure does not specifically limit the method for calculating the matching score corresponding to the transmission link based on the first attribute parameter and the requirement parameter. For example, the matching score can be determined based on the ratio of the first attribute parameter to the requirement parameter. For instance, if the first attribute parameter includes link bandwidth and the requirement parameter includes minimum bandwidth requirement, the degree of link bandwidth satisfaction can be determined by calculating the ratio of the two, without specific limitations. It should be noted that if the first attribute parameter and the requirement parameter respectively include bandwidth and delay, the final link score can be obtained by weighted summation after obtaining the matching scores corresponding to the bandwidth and delay indicators. In this embodiment, if the actual link parameters of the transmission link can include the first attribute parameter of the first type, the required link parameters can correspondingly include the requirement parameter of the first type. Based on this, for each of at least two transmission links, the matching score corresponding to the transmission link is calculated based on the first attribute parameter corresponding to the transmission link and the requirement parameter for transmitting the multiple data fragments, thereby accurately determining the link score of each transmission link.
[0099] To more accurately calculate the link score of each transmission link, in one embodiment, the actual link parameters of the aforementioned transmission links may further include a second type of second attribute parameter, which may include link power consumption, without specific limitation here. Based on this, before the step of determining the link score of a transmission link based on the matching score corresponding to the transmission link, the mode switching method provided in this disclosure embodiment may further include the following steps: For each of at least two transmission links, based on the pre-defined relationship between attribute parameters and scores, the second attribute parameters of the transmission link are matched to obtain the attribute score corresponding to the transmission link.
[0100] The relationship between the preset attribute parameters and the rating can be determined according to the actual situation, and no specific limitation is made here.
[0101] Based on this, the steps described above for determining the link score of a transmission link based on the matching score corresponding to the transmission link may specifically include: Obtain the first weight information; Based on the first weight information, the matching score and attribute score corresponding to the transmission link are weighted and summed to obtain the link score of the transmission link.
[0102] The first weight information is used to measure the relative importance of the matching score and the attribute score, including the first weight corresponding to the matching score and the second weight corresponding to the attribute score; the larger the weight value, the more important the score of the corresponding category.
[0103] Specifically, before determining the link score for each transmission link, for each of the at least two transmission links, based on a preset relationship between attribute parameters and scores, the second attribute parameters of the transmission link can be matched to obtain the attribute score corresponding to the transmission link. Thus, in the process of determining the link score for each transmission link, first weight information can be obtained, and based on the first weight information, the matching score and attribute score corresponding to the transmission link can be weighted and summed to obtain the link score of the transmission link.
[0104] In one example, the link score for the transmission link calculated above can satisfy the following formula: (1) in, To match the rating, Rate the attributes , Together they constitute the first weight information, which is related to the battery power of the first device, and is not specifically limited here.
[0105] Furthermore, based on this, the real-time performance level of the multiple data fragments being transmitted can also be considered. That is, different real-time performance levels correspond to different real-time scores. Based on this, the specific formula is as follows: (2) in, It could be a real-time score determined based on the task's real-time performance level. Thus, , , These together constitute the first weight information, which can be dynamically adjusted based on the battery level. For example, when the battery level is greater than a first battery level threshold (e.g., set to 70%), then... =0.5、 =0.2、 =0.3. When the battery level is greater than the second battery level threshold (e.g., set to 30%), and the battery level is less than the first battery level threshold, =0.4、 =0.3、 =0.3 is not specifically limited here.
[0106] In this embodiment, based on the matching score of each transmission link, the attribute score of each transmission link can be obtained by matching the second attribute parameter of each transmission link, and the link score of each transmission link can be accurately obtained by weighted summation of the matching score and attribute score of each transmission link.
[0107] Based on the same inventive concept, this disclosure also provides a mode switching system, which can be specifically combined with... Figure 4 A mode switching system provided in the embodiments of this disclosure will be described in detail.
[0108] Figure 4 This is a schematic diagram of the composition structure of a mode switching system provided in an embodiment of this disclosure.
[0109] like Figure 4 As shown, the mode switching system disclosed in this embodiment may include a first device 41 and a second device 42 electrically connected to the first device 41. The first device 41 and the second device 42 may be electrically connected through their respective Type-C interface modules, which is not specifically limited here.
[0110] The first device 41 mentioned above may include the following parts: At least one functional unit: The at least one functional unit may include at least one of a computing unit 411, a storage unit 412, and an audio unit 413. The computing unit 411 can be used to perform AI calculations, the storage unit 412 can be used for data storage, and the audio unit 413 can be used for audio processing such as voice acquisition and voice output, which will not be elaborated further here.
[0111] Detection module 414: The detection module 414 is located on pin 6 of the first Type-C interface module 416 of the first device 41, and can be used to acquire a detection signal that indicates whether the first device 41 and the second device 42 are electrically connected.
[0112] MCU415: This MCU415 is electrically connected to both the detection module 414 and the MUX417. It can be used to switch the data link of at least one of the above-mentioned functional units by controlling the MUX417 based on the detection signal collected by the detection module 414. In addition, it can also be electrically connected to the computing unit 411, which will not be described in detail here.
[0113] MUX417: The MUX417 is connected to at least one of the above-mentioned functional units, the first SOC418 and the second SOC422 in the second device, and can be used to switch the data link of at least one functional unit.
[0114] First SOC418: It can be used to schedule the use of at least one of the above-mentioned functional units when the first device is in stand-alone mode.
[0115] Accordingly, the second device 42 may include the following components: a second Type-C interface module 421: pin 6 of the second Type-C interface module 421 is configured to be grounded, for providing a low-level detection signal to the detection module 414 of the first device 41 when connected to the first device 41. A second SOC 422: used as a functional unit for scheduling the first device 41 by the second device when the first device 41 enters peripheral mode.
[0116] Based on this, the detection module 414 is used to acquire the detection signal; MCU415, in response to a low-level detection signal acquired by detection module 414, controls MUX417 to switch the data link of at least one functional unit (at least one of computing unit 411, storage unit 412, and audio unit 413) in the first device 41 to connect with the second SOC422 of the second device 42. After the data link is switched, at least one functional unit is identified as a slave device of the second device 42, thereby putting the first device 41 into peripheral mode. or, MCU415 is used to control MUX417 to switch the data link of at least one functional unit in the first device 41 to connect with the first SOC418 inside the first device 41 when the detection signal obtained by the detection module 414 is a high-level signal, thereby enabling the first device 41 to enter independent mode.
[0117] In addition, in the mode switching system provided in this embodiment, the first device 41 may also include auxiliary function modules (specifically including audio codecs, power management modules (e.g., DC-DC converters, chargers, current sense resistors, batteries, etc.)). These modules work together to achieve mode switching and functional operation of the first device; specific limitations are not provided here. The second device 42 may also include a PD module, which will not be described in detail here.
[0118] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this disclosure can be achieved, and this is not limited herein.
[0119] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means two or more, unless otherwise explicitly specified.
[0120] The above description is merely a specific embodiment of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this disclosure should be included within the scope of protection of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope of the claims.
Claims
1. A mode switching method applied to a first device, the method comprising: Acquire detection signals; In response to the detection signal being a low-level signal, the data link of at least one functional unit in the first device is switched to connect with the second device, and the at least one functional unit after the data link is switched is determined to be a slave device of the second device, so that the first device enters peripheral mode.
2. The method according to claim 1, wherein the at least one functional unit includes at least one of a computing unit, a storage unit, and an audio unit; After the data link is switched, the computing power unit is identified as the computing power slave device of the second device via the high-speed serial computer expansion bus PCIe. After the data link is switched, the storage unit is identified as the storage slave device of the second device via a Universal Serial Bus (USB) or a PCIe bus. After the data link is switched, the audio unit is identified as the audio slave device of the second device via the USB bus.
3. The method according to claim 1, further comprising: In response to the detection signal being a high-level signal, the data link of at least one functional unit in the first device is switched to be connected to the first device, so that the first device enters an independent mode.
4. The method according to claim 3, further comprising: Monitor the operating status of the second device; When it is determined that the second device is in an idle state and the idle time reaches a preset duration, the detection signal is switched from a low-level signal to a high-level signal.
5. The method according to any one of claims 1 to 4, wherein before acquiring the detection signal, the method further comprises: Obtain the first identification information sent by the second device; If the first identification information of the second device matches the first reference identification information pre-stored in the first device, the second device is determined to be the bound device of the first device, and the acquisition of the detection signal is triggered. or, Obtain the first identification information sent by the second device; Send the second identification information of the first device to the second device; If it is determined that the first identification information matches the first reference identification information pre-stored by the first device, and the second identification information matches the second reference identification information pre-stored by the second device, then it is determined that the first device and the second device are bound to each other, and the acquisition of the detection signal is triggered. The identification information includes the Product Identifier (PID) and / or the Manufacturer Identifier (VID).
6. The method according to claim 1, wherein the at least one functional unit includes a computing power unit; the method further includes: In response to the first device entering peripheral mode, a power consumption request is sent to the second device via the power delivery PD data channel. The power consumption request includes current parameters and / or voltage parameters corresponding to the computing unit. If the PD controller of the second device verifies that the power consumption request is valid, it adjusts the power supply current of the computing unit based on the current parameters and / or adjusts the power supply voltage of the computing unit based on the voltage parameters, so that the computing unit operates at a first power consumption value.
7. The method according to claim 3, wherein the at least one functional unit includes a computing power unit; the method further includes: In response to the first device entering independent mode, the power supply path in the second device used to power the computing unit is cut off, and the computing unit is controlled to operate at a second power consumption value.
8. The method according to claim 1, further comprising: Identify the multiple data fragments to be transmitted to the second device; During the process of the first device transmitting the multiple data fragments to the second device using the first transmission link, the link parameters of the second transmission link are monitored; When the link parameters of the second transmission link meet the preset link switching conditions, the remaining data fragments are transmitted to the second device using the second transmission link. The remaining data fragments are the data fragments that were not transmitted to the second device through the first transmission link when the first transmission link was switched to the second transmission link.
9. The method according to claim 8, further comprising: Determine the required link parameters for transmitting the multiple data fragments; Obtain the actual link parameters corresponding to at least two transmission links between the first device and the second device; The at least two transmission links include the first transmission link and the second transmission link; Based on the actual link parameters corresponding to the at least two transmission links and the required link parameters corresponding to the multiple data fragments, determine the link scores corresponding to the at least two transmission links respectively; The transmission link with the highest link score is determined from the at least two transmission links to be the first transmission link.
10. A first device, comprising: At least one functional unit; The detection module is used to acquire detection signals; A microcontroller unit is configured to switch the data link of at least one functional unit in the first device to a connection with the second device in response to the detection signal being a low-level signal, wherein the at least one functional unit after the data link is switched is determined to be a slave device of the second device, so that the first device enters peripheral mode.