Data transmission method, electronic equipment and storage medium

By implementing multi-threaded processing and priority scheduling in the processor of electronic devices, the problem of poor timeliness of sensor data transmission when the processor is high is solved, and more efficient data transmission and lower data loss rate are achieved.

CN120066753AActive Publication Date: 2025-05-30HONOR DEVICE CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202311582113.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-23
Publication Date
2025-05-30
Estimated Expiration
2043-11-23

AI Technical Summary

Technical Problem

In the case of high processor load, electronic devices have poor timeliness when transmitting sensor data, and may even lose data, affecting the user experience.

Method used

By implementing multi-threaded processing in the processor of electronic devices, using priority scheduling and processor core binding mechanisms, the priority of data transmission threads or allocating other processor cores when the processor load is high, to ensure the timely transmission of sensor data.

Benefits of technology

It improves the timeliness of sensor data transmission, reduces data loss, and thus improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066753A_ABST
    Figure CN120066753A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the field of terminals, in particular to a data transmission method, electronic equipment and a storage medium. The method includes the electronic device in response to a top half interrupt event, a first thread for transmitting interrupt event data being in a ready state. In the first time period, the electronic equipment runs the first thread with the first priority, and in the second time period, the electronic equipment runs the first thread with the second priority; and / or, in the first time period, the electronic equipment runs the first thread in the first processor core, and in the second time period, the electronic equipment runs the first thread in the second processor core. Through the method, the priorities of the threads in different time periods and / or the processor cores where the threads are located can be flexibly adjusted, so that the threads run at the appropriate priorities and / or the processor cores, the timeliness of sensor data transmission is improved, and the situation of sensor data loss is relieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of terminals, and in particular, to a data transmission method, an electronic device, and a storage medium. Background Art

[0002] With the development of terminal technologies, there are more and more sensors on electronic devices. An electronic device can collect external data of the electronic device through sensors to obtain sensor data, and enrich the functions of the electronic device through the sensor data.

[0003] Currently, an electronic device can transmit sensor data through an interrupt event. For example, an interrupt is reported through a top-half interrupt event, and after the interrupt is reported, sensor data is transmitted through the interrupt event data.

[0004] When an electronic device transmits sensor data, if the processor load is relatively high, there will be a poor timeliness in transmitting sensor data, and even sensor data loss may occur, which affects the user experience. Summary of the Invention

[0005] Embodiments of the present application provide a data transmission method, an electronic device, and a storage medium, which are used to improve the timeliness of sensor data transmission and alleviate the situation of sensor data loss.

[0006] To achieve the above object, the embodiments of the present application adopt the following technical solutions:

[0007] In a first aspect, a data transmission method is provided. This method can be applied to an electronic device, such as a mobile phone, a tablet computer, etc. The processor of the electronic device includes multiple processor cores, and the electronic device includes a first thread. The method includes: the electronic device responds to a top-half interrupt event, and the first thread is in a ready state. The first thread is used to transmit the above interrupt event data, such as sensor data. Next, when the preset priority of the first thread is the first priority, within a first time period, the electronic device runs the first thread with the first priority, and within a second time period, the electronic device runs the first thread with a second priority; and / or, when the processor core preset to be bound to the first thread is the first processor core, within the first time period, the electronic device runs the first thread on the first processor core, and within the second time period, the electronic device runs the first thread on the second processor core. It should be understood that if the first thread runs, the first thread transmits the interrupt event data.

[0008] Among them, the second time period is later than the first time period, the second priority is higher than the first priority, and the first processor core and the second processor core are different processor cores.

[0009] In this method, when the processor load is relatively high, since the priority of the first thread in the second time period is higher than that of the first thread in the first time period, the chance for the first thread to run on the processor core of the electronic device in the second time period can be increased. For example, the chance to run on the first processor core is increased. Thus, the first thread can run on the processor core of the electronic device when the processor load is relatively high, and then the first thread can transmit interrupt data, such as sensor data. Based on this, the timeliness of sensor data transmission can be improved, and the situation of sensor data loss can be alleviated.

[0010] Moreover, when the processor load is relatively high, since the processor core preset to be bound by the first thread is the first processor core, in the first time period, the electronic device runs the first thread on the first processor core, and in the second time period, the electronic device runs the first thread on the second processor core. That is to say, in the second time period, the first thread can run on a processor core other than the preset bound processor core. Thus, the number of processor cores that the first thread can use is increased. For example, the first thread can run on the second processor core. Based on this, the first thread can run on the processor core of the electronic device when the processor load is relatively high, and then the first thread can transmit interrupt data, such as sensor data. Based on this, the timeliness of sensor data transmission can be improved, and the situation of sensor data loss can be alleviated.

[0011] In a possible design of the first aspect, the above method may further include: when the preset priority of the first thread is the first priority, in the third time period, the electronic device runs the first thread at the first priority; the third time period is later than the second time period; and / or, when the processor core preset to be bound by the first thread is the first processor core, in the third time period, the electronic device runs the first thread on the first processor core.

[0012] In this design, in the third time period after the second time period, the electronic device runs the first thread at the above preset first priority, which can reasonably allocate the processor resources of the mobile phone on the basis of improving the timeliness of sensor data transmission. Moreover, in the third time period after the second time period, the electronic device runs the first thread on the above preset bound first processor core, which can reasonably allocate the processor resources of the mobile phone on the basis of improving the timeliness of sensor data transmission.

[0013] In a possible design of the first aspect, the above-mentioned second time period includes a first time point and a second time point, and the second time point is later than the first time point; within the time period from the first time point to the second time point, the above-mentioned first thread is in a ready state; the duration from the first time point to the second time point is greater than or equal to a preset first duration threshold. Above, within the second time period, the electronic device runs the first thread with a second priority, including: within the second time period, based on the duration from the first time point to the second time point being greater than or equal to the first duration threshold, the electronic device runs the first thread with a second priority. And, above, within the second time period, the first thread is run on the second processor core, including: within the second time period, based on the duration from the first time point to the second time point being greater than or equal to the first duration threshold, the electronic device runs the first thread on the second processor core.

[0014] In this design, since the above-mentioned first thread is in a ready state within the time period from the first time point to the second time point, that is to say, the first thread is not in a running state and no interrupt event data is transmitted. Thus, the electronic device can, based on the duration for which the first thread is in a ready state, within the second time period, run the first thread on the second processor core, and / or run the first thread with a second priority. Since the second priority is higher than the first priority and the second processor core is different from the first processor core, the opportunity for the first thread to run can be improved, and in this way, the timeliness of sensor data transmission can be further enhanced and the situation of sensor data loss can be alleviated.

[0015] In another possible design of the first aspect, the above-mentioned third time period includes a third time point, and the duration from the second time point to the third time point is greater than or equal to a preset second duration threshold; within the third time period, the electronic device runs the first thread with a first priority, including: within the third time period, based on the duration from the second time point to the third time point being greater than or equal to the second duration threshold, the electronic device runs the first thread with a first priority. Above, within the third time period, the first thread is run on the first processor core, including: within the third time period, based on the duration from the second time point to the third time point being greater than or equal to the second duration threshold, the electronic device runs the first thread on the first processor core.

[0016] In this design, within the third time period, the electronic device runs the first thread with a first priority and / or runs the first thread on the first processor core, which can reasonably allocate the mobile phone processor resources on the basis of improving the timeliness of sensor data transmission.

[0017] In yet another possible design of the first aspect, the above-mentioned electronic device further includes a second thread, the priority of the second thread is higher than the first priority and lower than the second priority; within the first time period, the second thread is not running, and within the second time period, the second thread is run on the first processor core.

[0018] In another possible design of the first aspect, the above method further includes: if the duration for which the first thread is in the ready state is greater than or equal to the first duration threshold, performing a first process on the first thread; the first process includes: increasing the priority of the first thread, and / or, unbinding the first thread from the first processor core.

[0019] In this design, if the duration for which the first thread is in the ready state exceeds the first duration threshold, that is, the first thread is not in the running state and no interrupt event data is transmitted. Thus, the electronic device can perform a first process on the first thread based on the duration for which the first thread is in the ready state. In this way, by performing the first process on the first thread, the timeliness of sensor data transmission can be further improved, and the situation of sensor data loss can be alleviated.

[0020] In a possible design of the first method, the electronic device can also determine the duration for which the first thread is in the ready state through the transmission flag bit of the first thread and the data in the target data queue.

[0021] In another possible design of the first aspect, the above method further includes: if the duration after the first thread undergoes the first process is greater than or equal to the second duration threshold, performing a second process on the first thread. Wherein, in the case where the first process includes increasing the priority of the first thread, the second process includes restoring the priority of the first thread to the first priority; and / or, in the case where the first process includes unbinding the first thread from the first processor core, the second process includes restoring the binding between the first thread and the first processor core.

[0022] In this design, considering that if the time after the first thread undergoes the first process is too long, it may affect the resource allocation on the mobile phone. Thus, by performing a second process on the first thread when the second duration threshold is exceeded after the first thread undergoes the first process, the processor resources of the mobile phone can be reasonably allocated on the basis of improving the timeliness of sensor data transmission.

[0023] In yet another possible design of the first aspect, the above method further includes: the duration after the first thread undergoes the first process is greater than or equal to the second duration threshold, including: if the first timer times out, the duration after the first thread undergoes the first process is greater than or equal to the second duration threshold, where the first timer is started when the first process is performed on the first thread, and the timing duration of the first timer is the second duration threshold.

[0024] In a possible design of the first aspect, the above-mentioned electronic device further includes a sensor integrated circuit (IC) and a sensor module. Before triggering the first thread to be in the ready state in response to a top-half interrupt event, the above method further includes: the sensor IC acquires interrupt event data and sends a top-half interrupt event. After triggering the first thread to be in the ready state in response to a top-half interrupt event, the above method further includes: the first thread in the running state acquires interrupt event data from the sensor IC and puts the interrupt event data into a target data queue. Subsequently, the sensor module acquires interrupt event data from the target data queue. Wherein, if the sensor module fails to acquire interrupt event data from the target data queue within a preset third time threshold, the sensor module acquires sensor data from the sensor IC.

[0025] In this design, when the top-half interrupt event is masked, the first thread will not be in the ready state, let alone in the running state. Thus, by the sensor module actively acquiring interrupt event data from the sensor IC, it can be ensured that the sensor module can still acquire interrupt event data, such as sensor data, when the top-half interrupt event is masked. Based on this, the timeliness of sensor data transmission can be improved and the situation of sensor data loss can be alleviated.

[0026] In a possible design of the first aspect, the situation that the sensor module fails to acquire sensor data from the target data queue within a preset third time threshold includes: if the duration for which the sensor module is in the blocked state is greater than or equal to the third time threshold, the sensor module fails to acquire sensor data from the target data queue within the preset third time threshold.

[0027] It can be understood that when the sensor module acquires sensor data from the target data queue, it will also experience a series of state transitions itself. Therefore, based on the duration for which the sensor module is in the blocked state, it can be accurately determined whether the sensor module has acquired sensor data from the target data queue.

[0028] In another possible design of the first aspect, the electronic device further includes a sensor, which has a corresponding relationship with the above-mentioned sensor module. The acquisition mode of the sensor includes a low-frequency acquisition mode or a high-frequency acquisition mode, and the third time threshold includes: the third time threshold corresponding to the low-frequency acquisition mode and the third time threshold corresponding to the high-frequency acquisition mode. The above method further includes: setting the third time threshold corresponding to the sensor acquisition mode based on the acquisition mode of the sensor.

[0029] In this design, since the sensors of the electronic device may have different acquisition modes, for different acquisition modes, the electronic device can set different third time thresholds, which can make the data transmission process of the electronic device more matched with the acquisition mode of the sensor.

[0030] In yet another possible design of the first aspect, the above-mentioned sensor IC includes a touch panel IC or a fingerprint sensor IC. When the sensor IC includes a touch panel IC, the sensor module includes a touch panel module located in the hardware abstraction layer of the electronic device, and the interrupt event data includes touch data. When the sensor IC includes a fingerprint sensor IC, the sensor module includes a fingerprint sensor module located in the hardware abstraction layer of the electronic device, and the interrupt event data includes fingerprint data.

[0031] In a second aspect, another data transmission method is provided, which is applied to an electronic device, such as a mobile phone, a tablet computer, etc. The electronic device includes a sensor IC, a sensor module, and a third thread. The method includes: the sensor IC obtains interrupt event data and sends a top-half interrupt event. Then, in response to the top-half interrupt event, the third thread is in a ready state. Next, the third thread in a running state obtains the interrupt event data from the sensor IC and puts the interrupt event data into a target data queue. Then, the sensor module obtains the interrupt event data from the target data queue. Wherein, if the sensor module fails to obtain the interrupt event data from the target data queue within a preset fourth duration threshold, the sensor module obtains the interrupt event data, such as sensor data, from the sensor IC.

[0032] In this method, when the top-half interrupt event is masked, the third thread will not be in a ready state, let alone in a running state. Thus, by the sensor module actively obtaining the interrupt event data from the sensor IC, it can be ensured that the sensor module can still obtain the interrupt event data, such as sensor data, when the top-half interrupt event is masked. Based on this, the timeliness of sensor data transmission can be improved, and the situation of sensor data loss can be alleviated.

[0033] In yet another possible design of the second aspect, the above-mentioned sensor module fails to obtain sensor data from the target data queue within a preset fourth duration threshold, including: if the duration for which the sensor module is in a blocked state is greater than or equal to the fourth duration threshold, the sensor module fails to obtain sensor data from the target data queue within the fourth duration threshold.

[0034] In another possible design of the second aspect, the above-mentioned electronic device further includes a sensor, and the sensor has a corresponding relationship with the above-mentioned sensor module; the acquisition mode of the sensor includes a low-frequency acquisition mode or a high-frequency acquisition mode, and the fourth duration threshold includes: a fourth duration threshold corresponding to the low-frequency acquisition mode and a fourth duration threshold corresponding to the high-frequency acquisition mode. The above method further includes setting the fourth duration threshold corresponding to the sensor acquisition mode based on the acquisition mode of the sensor.

[0035] In yet another possible design of the second aspect, the above-mentioned sensor IC includes a touch panel IC or a fingerprint sensor IC. When the sensor IC includes a touch panel IC, the sensor module includes a touch panel module located in the hardware abstraction layer of the electronic device, and the interrupt event data includes touch data. When the sensor IC includes a fingerprint sensor IC, the sensor module includes a fingerprint sensor module located in the hardware abstraction layer of the electronic device, and the interrupt event data includes fingerprint data.

[0036] In a third aspect, the present application provides an electronic device, which includes: a memory, one or more processors, and a Bluetooth module; the memory is coupled to the processor; wherein, computer program code is stored in the memory, and the computer program code includes computer instructions; when the computer instructions are executed by the processor, the electronic device is caused to execute the method provided in the first aspect and any possible design of the first aspect; or the electronic device is caused to execute the method provided in the second aspect and any possible design of the second aspect.

[0037] In a fourth aspect, the present application provides a computer-readable storage medium, in which instructions are stored, and when the computer instructions are run on an electronic device, the electronic device is caused to execute the method provided in the first aspect and any possible design of the first aspect; or the electronic device is caused to execute the method provided in the second aspect and any possible design of the second aspect.

[0038] In a fifth aspect, the present application provides a computer program product containing instructions, and when the computer program product is run on an electronic device, the electronic device can be caused to execute the method provided in the first aspect and any possible design of the first aspect; or the electronic device is caused to execute the method provided in the second aspect and any possible design of the second aspect.

[0039] Among them, for the technical effects brought by any design method in the second aspect to the fifth aspect, reference can be made to the technical effects brought by different design methods in the first aspect, which will not be elaborated here. Description of the Drawings

[0040] Figure 1 It is a schematic flowchart of a data transmission method provided by an embodiment of the present application;

[0041] Figure 2 It is a schematic flowchart of another data transmission method provided by an embodiment of the present application;

[0042] Figure 3 It is a schematic diagram of a usage scenario provided by an embodiment of the present application;

[0043] Figure 4Schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application;

[0044] Figure 5 Schematic diagram of the hardware structure of a sensor provided by an embodiment of the present application;

[0045] Figure 6 Schematic diagram of a software architecture provided by an embodiment of the present application;

[0046] Figure 7 Schematic diagram of the process flow of a data transmission method provided by an embodiment of the present application;

[0047] Figure 8 Schematic diagram of the process of collecting touch data by a touch panel provided by an embodiment of the present application;

[0048] Figure 9 Schematic diagram of the process flow of a data transmission method provided by an embodiment of the present application;

[0049] Figure 10 Schematic diagram of an example of the status of threads and processors provided by an embodiment of the present application;

[0050] Figure 11 Another schematic diagram of the status of threads and processors provided by an embodiment of the present application;

[0051] Figure 12 Schematic diagram of the process flow of another data transmission method provided by an embodiment of the present application;

[0052] Figure 13 Schematic diagram of the process flow of another data transmission method provided by an embodiment of the present application;

[0053] Figure 14 Schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present application;

[0054] Figure 15 Schematic diagram of the structure of a chip system provided by an embodiment of the present application. Detailed implementation manners

[0055] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application. Among them, in the description of the present application, unless otherwise specified, " / " means that the objects associated before and after are in an "or" relationship. For example, A / B may represent A or B; "and / or" in the present application is only a description of the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. These three situations, where A and B may be singular or plural. Also, in the description of the embodiments of the present application, unless otherwise specified, "a plurality of" means two or more than two. "At least one (item)" or its similar expression below refers to any combination of these items, including any combination of a single item (item) or plural items (items). For example, at least one (item) of a, b, or c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c may be single or multiple. In addition, in order to facilitate a clear description of the technical solutions in the embodiments of the present application, in the embodiments of the present application, terms such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and roles. Those skilled in the art can understand that terms such as "first" and "second" do not limit the quantity and execution order, and terms such as "first" and "second" do not necessarily limit to be different.

[0056] Meanwhile, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner for easy understanding.

[0057] With the development of terminal technologies, there are more and more sensors on electronic devices. An electronic device can collect external data through sensors. This external data can be called sensor data. An electronic device can enrich the functions of the electronic device through sensor data and provide a convenient usage experience for users.

[0058] For example, an electronic device can collect touch data of a user on a touch screen through the touch screen, and implement a screen touch function through the touch data, so that the user can perform touch operations on the display elements on the touch screen. Another example is that an electronic device can collect a user's fingerprint through a fingerprint sensor, and implement an unlocking function by identifying the collected fingerprint, so that the user can conveniently unlock the electronic device through the fingerprint.

[0059] Since an electronic device enriches its functions through sensor data, the electronic device needs to transmit the sensor data collected by the sensor to upper-layer services (such as fingerprint unlocking service, screen touch service, etc.). Currently, the electronic device can transmit sensor data through interrupt event data. For example, it reports an interrupt through a top-half interrupt event, and after reporting the interrupt, it transmits sensor data through the interrupt event data. When the electronic device transmits sensor data, if the load of the processor of the electronic device is relatively high, there is a situation where the timeliness of transmitting sensor data is relatively poor, and even sensor data is lost, which affects the user experience.

[0060] In the related art, an electronic device can obtain sensor data from the integrated circuit (IC) chip of the sensor through a data transmission thread; then, the data transmission thread sends the sensor data. Among them, the data transmission thread runs on a preset processor core with a preset priority. In this solution, if the load of the processor in which the electronic device is located is relatively high, such as when a high-priority real-time thread occupies the processor, the priority of the high-priority real-time thread is higher than the above preset priority; since the above preset processor core is continuously occupied by the high-priority real-time thread, it will cause the data transmission thread to be unable to use this processor core, and then the data transmission thread cannot send sensor data.

[0061] It should be understood that the above data transmission thread can be referred to as a sensor data transmission thread, a transmission thread, etc.

[0062] Exemplarily, refer to Figure 1 , in the electronic device 100, the data transmission thread runs on the preset processor core 0, and the processor core 0 is continuously occupied by a high-priority real-time thread. Since the processor core 0 is occupied by the high-priority real-time thread, it will cause the data transmission thread to be unable to use the processor core 0, and then the data transmission thread cannot transmit sensor data, such as sending the sensor data to the upper-layer service. Thus, the timeliness of sensor data transmission on the electronic device is relatively poor, and even sensor data loss may occur, and the upper-layer service cannot receive the sensor data. This will affect the user experience.

[0063] In view of this, an embodiment of the present application provides a data transmission method. In this method, an electronic device transmits sensor data through a data transmission thread. The electronic device can monitor the data transmission thread. If the data transmission thread does not send sensor data within a preset duration threshold, the electronic device can increase the priority of the data transmission thread and / or allocate other processor cores to the data transmission thread.

[0064] In this way, since the priority of the data transmission thread is increased or other processor cores are allocated, the data transmission thread can utilize the processor core when the processor load is high. Then, the data transmission thread can send the sensor data based on the processor core, and the upper-layer service can obtain the sensor data in a relatively timely manner. Thus, by increasing the priority of the data transmission thread and / or allocating other processor cores to the data transmission thread, the timeliness of sensor data transmission can be improved, and the situation of sensor data loss can be alleviated.

[0065] Exemplarily, referring to Figure 2 Part (A) therein, in the electronic device 100, the data transmission thread runs on the preset processor core 0, and the processor core 0 is continuously occupied by other threads. The electronic device 100 monitors that the data transmission thread fails to send the sensor data to the upper-layer service within the preset duration threshold, and the electronic device allocates other processor cores, such as processor core 1, to the data transmission thread. In this way, the data transmission thread can send the sensor data to the upper-layer service through processor core 1.

[0066] Another exemplarily, referring to Figure 2 Part (B) therein, in the electronic device 100, the data transmission thread runs on the preset processor core 0, and the processor core 0 is continuously occupied by other threads. The electronic device 100 monitors that the data transmission thread fails to send the sensor data to the upper-layer service within the preset duration threshold, and the electronic device increases the priority of the data transmission thread. For example, the priority of the data transmission thread is set to be higher than the priority of the above-mentioned other threads. Since the priority of the data transmission thread is higher than the priority of the other threads occupying processor core 0, the data transmission thread can send the sensor data to the upper-layer service through processor core 0.

[0067] Exemplarily, referring to Figure 3 , the technical solution provided by the embodiments of the present application can be applied to the daily use process of the user for the electronic device 100, especially applicable to the process of the user using the fingerprint unlocking function or the screen touch function of the electronic device.

[0068] Among them, the above-mentioned electronic device can be an electronic device with a display screen, such as a mobile phone, a tablet computer, a wearable device, a smart screen, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc.; it can also be an in-vehicle device with a display screen, such as an in-vehicle computer, an in-vehicle computer, etc.; it can also be some Internet of Things devices with a display screen, such as smart watches and smart bracelets. The product form of the electronic device is not limited in any way in the embodiments of the present application.

[0069] Next, a brief introduction to the hardware structure and software architecture of the above-mentioned electronic device 100 will be given.

[0070] Figure 4 A schematic diagram of the hardware structure of the electronic device 100 is shown.

[0071] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0072] It can be understood that the structure schematically shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0073] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0074] It can be understood that the above-mentioned processing units may also be referred to as processor cores. That is to say, the processor 110 may include one or more processor cores; during application, they may be referred to as processor core 0, processor core 1,..., processor core N, where N is a positive integer greater than 1.

[0075] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0076] The I2C interface is a two-way synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be respectively coupled to the touch sensor 180K, the charger, the flashlight, the camera 193, etc. through different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K through the I2C interface, enabling the processor 110 and the touch sensor 180K to communicate through the I2C bus interface, thereby implementing the touch function of the electronic device 100.

[0077] The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple groups of I2S buses. The processor 110 may be coupled to the audio module 170 through the I2S bus to implement communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through the I2S interface to implement the function of answering a call through a Bluetooth headset.

[0078] The PCM interface can also be used for audio communication to sample, quantize, and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through the PCM bus interface. In some embodiments, the audio module 170 may also transmit an audio signal to the wireless communication module 160 through the PCM interface to implement the function of answering a call through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0079] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present application are only illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods or a combination of multiple interface connection methods in the above embodiments.

[0080] The NPU is a neural-network (NN) computing processor. By referring to the biological neural network structure, for example, referring to the transmission mode between human brain neurons, it can quickly process input information and can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0081] The pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can include at least two parallel plates with conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations with the same touch position but different touch operation intensities can correspond to different operation instructions.

[0082] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc.

[0083] The touch sensor 180K can also be referred to as a touch panel (TP). The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also known as a "touch screen". The touch sensor 180K is used to detect touch operations acting thereon or nearby. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, in a different position from the display screen 194.

[0084] Exemplarily, the processor 110 can further include a serial peripheral interface (SPI). The processor 110 can obtain the sensor data of the sensor through the SPI. For example, the processor 110 can obtain the sensor data of the TP through the SPI; for another example, the processor 110 can obtain the sensor data of the fingerprint sensor 180H through the SPI; for still another example, the processor 110 can obtain the sensor data of the pressure sensor 180A through the SPI.

[0085] As an example, the structure of the above sensor 180 can be referred to Figure 5As shown. The sensor 180 may include a sensor device 180-1 and an IC chip 180-2. The sensor device 180-1 is used to collect sensor data, such as fingerprint data, pressure data, etc.; the IC chip 180-2 is used to transmit the sensor data. Among them, the IC chip 180-2 may include an interrupt pin and a data pin. The data pin is used to transmit sensor data, and the interrupt pin is used to send an interrupt signal. Among them, the interrupt signal may be a level transition, such as a low level transitioning to a high level. It should be understood that in actual applications, the above interrupt pin and data pin may also be combined into one pin, or split into more pins, and the embodiments of the present application do not impose any restrictions on this. And, in actual applications, the above sensor 180 may also have other more structures, and specifically can be set according to actual usage requirements, and the embodiments of the present application do not impose any restrictions on this.

[0086] For the TP, the TP may include a TP device and a TPIC, and the sensor data collected by the TP may be referred to as touch data. For the fingerprint sensor 180H, it may include a fingerprint sensor device and a fingerprint IC, and the sensor data collected by the fingerprint sensor 180H may be referred to as fingerprint data.

[0087] Exemplarily, the sensor device 180-1 may periodically collect sensor data based on the sampling rate of the sensor 180; then, the IC chip 180-2 obtains the sensor data collected by the sensor device 180-1 and stores the sensor data in the memory (buffer) of the IC chip 180-2 for caching. Next, the IC chip 180-2 sends an interrupt signal through the interrupt pin; and sends the sensor data through the data pin. Exemplarily, the sensor 180 may send an interrupt signal to the processor 110 through the interrupt pin of the IC chip 180-1. Another exemplarily, the sensor 180 may send the sensor data to the data transmission thread based on SPI through the data pin of the IC chip 180-1.

[0088] Next, in combination with Figure 6 the software architecture of the above electronic device 100 will be introduced.

[0089] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present application, taking the Android TM system as an example, the software structure of the electronic device 100 will be exemplarily described.

[0090] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, taking Android TMThe system is divided into five layers, from top to bottom are the application layer, the application framework layer, Android runtime and system libraries, the hardware abstraction layer (HAL), and the kernel layer (kernel). TM runtime), and the kernel layer (kernel).

[0091] The application layer can include a series of application packages.

[0092] Such as Figure 6 shown, the application packages can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.

[0093] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.

[0094] Such as Figure 6 shown, the application framework layer can be divided into two parts: system services and media services.

[0095] The system service (system server) is a thread that provides many subsystem services. Each subsystem service runs in the form of a thread, waits for requests sent by the application, then processes the requests, and returns the results to the application. The above-mentioned subsystem services include, for example, window manager service (WMS), notification manager service (NMS), activity manager service (AMS), and input manager service (IMS).

[0096] The WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system. The NMS enables applications to display notification information in the status bar, can be used to convey notification-type messages, and can automatically disappear after a short stay without user interaction. The AMS can be used for the startup, switching, scheduling of system components (such as activities, services, content providers, and broadcast receivers), and the management and scheduling of application threads. The IMS can be used to manage the input of the system, such as touch screen input, key input, and sensor input, etc. The IMS retrieves events from input device nodes (such as the following sensor modules, key modules, etc.), and through interaction with the WMS, distributes the events to the windows in the WMS. The media server is responsible for playing audio and video, as well as the threads for taking pictures and recording videos.

[0097] Android TM Runtime includes core libraries and virtual machines. Android TM runtime is responsible for the scheduling and management of the Android system.

[0098] The core libraries consist of two parts: one part is the functional functions that the Java language needs to call, and the other part is the core libraries of Android.

[0099] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0100] The system libraries can include multiple functional modules. For example: surface manager, Media Libraries, 3D graphics processing libraries (such as: OpenGL ES), 2D graphics engines (such as: SGL), etc.

[0101] The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.

[0102] The media libraries support the playback and recording of multiple common audio and video formats, as well as static image files, etc. The media libraries can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0103] The 3D graphics processing libraries are used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc.

[0104] The 2D graphics engine is the drawing engine for 2D drawing.

[0105] Hardware Abstraction Layer (HAL). The HAL is an abstract layer between the hardware and the upper layer, used to provide a unified interface to the upper layer, enabling upper-layer applications to be unaware of the specific implementation details of the underlying hardware, thus shielding the implementation details of the lower layer.

[0106] The HAL can provide standard interfaces to expose the device hardware functions to a higher-level application framework layer. The HAL contains multiple library modules, each of which implements an interface for a specific type of hardware component. The library modules can include an audio module, a Bluetooth module, a camera module, sensor modules, a key module, etc. The sensor modules can include, for example, an accelerometer module, a magnetic field module, an orientation module, a gyroscope module, a light sensor module, a pressure sensor module, a temperature sensor module, a proximity sensor module, and so on. When the application framework layer requests access to the device hardware, the system will load the corresponding library module for that hardware component. Manufacturers can define interfaces within the HAL.

[0107] The sensor modules can include a TP module or a fingerprint sensor module. For the sensor modules in the HAL, they can be divided into user mode and kernel mode. For example, for the TP module, it can be divided into user mode and kernel mode, and the TP module can cycle between kernel mode and user mode. The TP module in kernel mode has relatively high system privileges.

[0108] Exemplarily, the TP module can be used to send touch data to the IMS, and the IMS will send the touch data to upper-layer services, such as screen touch services, to implement the screen touch function of the electronic device. The fingerprint sensor module can be used to send fingerprint data to the IMS, and the IMS will send the fingerprint data to upper-layer services, such as fingerprint unlocking services, to implement the fingerprint unlocking function of the electronic device.

[0109] The kernel layer is the layer between the hardware and the software. The kernel layer at least contains sensor drivers. In addition, it can also include other drivers, such as display drivers, camera drivers, and audio drivers. Among them, the sensor drivers can be used to drive the sensors to work, such as driving the TP to work and driving the fingerprint sensor to work.

[0110] In addition, the kernel layer may further include a data transmission thread for transmitting the above-mentioned sensor data. For example, it obtains sensor data from the sensor IC and sends it to the sensor module. In some embodiments, the above data transmission thread may also be referred to as the first thread or the third thread.

[0111] Moreover, the kernel layer may further include a transmission management thread for detecting the time when the data transmission thread is in the running state. If the duration of the data transmission thread in the running state is greater than a preset duration threshold, a first processing is performed on the data transmission thread. The first processing includes: increasing the priority of the data transmission thread, and / or unbinding the data transmission thread from the first processor core.

[0112] Optionally, a hardware layer may be further included below the kernel layer. The hardware layer may include sensors, such as the fingerprint sensor 180H, touch panel (TP), etc. as described above. Figure 4 in the fingerprint sensor 180H, touch panel (TP), and so on.

[0113] The following combines the above Figure 4 , Figure 5 , Figure 6 . A brief description of the transmission process of sensor data in the electronic device is given.

[0114] The sensor device generates sensor data and sends an interrupt signal through the interrupt pin of the IC chip. It should be understood that in the software architecture, the above interrupt signal can be understood as the interrupt function of the top half. For a detailed description of the interrupt function of the top half, please refer to the following text and will not be described in detail here. For the convenience of the following description, the interrupt function of the top half can be referred to as the top half interrupt. And in some embodiments, the above top half interrupt can also be referred to as the top half interrupt event.

[0115] Next, in response to the top half interrupt, the data transmission thread wakes up the interrupt function of the bottom half, and the data transmission thread is in the ready (runnable) state. It should be understood that for the data transmission thread in the runnable state, when it is assigned to a processor core, the data transmission thread can become the running state and run on the assigned processor core. The data transmission thread in the running state can obtain sensor data from the above IC chip through the assigned processor core and send it to the sensor module. Then, the sensor module sends the sensor data to the upper-layer service. For example, IMS located in the framework layer, and IMS sends the sensor data to the fingerprint unlocking service, screen touch service, and so on. In this way, the electronic device can implement the functions corresponding to the sensor data based on the sensor data. For example, it can implement the fingerprint unlocking function through the fingerprint data, and also, it can implement the screen touch function through the touch data. It should be understood that in some embodiments, the above sensor data can also be referred to as interrupt event data.

[0116] In an embodiment of the present application, the electronic device can detect the time when the data transmission thread is in the running state. If the duration when the data transmission thread is in the running state is greater than or equal to the above duration threshold, it means that the data transmission line fails to use the processor core, that is, the data transmission thread cannot transmit sensor data. At this time, the electronic device can increase the priority of the data transmission thread, and / or reallocate other processor cores for the data transmission thread.

[0117] Exemplarily, the electronic device can detect the time when the data transmission thread is in the running state through a specific thread. The specific thread can be a transmission management thread, and the transmission management thread can be located in the above kernel layer.

[0118] For example, assume that the processor core currently allocated to the data transmission thread is processor core 0, and the data transmission thread runs on processor core 0. If it is detected that the duration when the data transmission thread is in the running state is greater than or equal to the duration threshold, the priority of the data processing thread is increased. In this way, since the priority of the data transmission thread is increased, the data transmission thread can use processor core 0 to send the above sensor data to the sensor module through processor core 0. Or, reallocate processor core 1 for the data transmission thread. Since the data transmission thread is allocated processor core 1, the data transmission thread can send the above sensor data to the sensor module through processor 1. Thus, the IMS located in the framework layer can obtain the sensor data in a timely manner.

[0119] Next, taking the above Figure 3 illustrated use scenario where the electronic device is a mobile phone and the user uses the touch function of the mobile phone, that is, the mobile phone collects touch data through the TP and sends it to the TP module in the HAL layer through the data transmission thread as an example, the technical solution provided by the embodiment of the present application will be described.

[0120] Exemplarily, referring to Figure 7 , the data transmission method provided by the embodiment of the present application may include steps S700 - S703.

[0121] In some embodiments, before step S700, the above data transmission method may further include: the TP device generates touch data based on the touch operation in response to the touch operation issued by the user.

[0122] Among them, the touch operation may refer to the operation of the user touching the TP. The touch data can be obtained according to the touch position corresponding to the touch operation. The touch data can be used to represent the touch position, and the TP device can generate different touch data according to different touch positions on the TP.

[0123] Specifically, for a TP with a touch host processing (THP) architecture, its touch control data includes capacitance data corresponding to the touch position, that is, the TP device can generate capacitance data based on the touch position, and this capacitance data can represent the touch position. For a TP with other architectures, its touch control data includes coordinate data, that is, the TP device can generate coordinate data based on the touch position, and this coordinate data can represent the touch position.

[0124] It should be understood that in actual use, the above touch control data may further include other more data, which can be specifically set according to actual usage requirements, and the embodiments of the present application do not impose any restrictions on this.

[0125] In some other embodiments, the TP device can also periodically generate touch control data based on its sampling rate; that is to say, the TP device can also spontaneously generate touch control data. Specifically, the timing for the TP device to generate touch control data can be designed according to actual usage requirements, and the embodiments of the present application do not impose any restrictions on this.

[0126] S700. The TPIC acquires the touch control data generated by the TP device and sends a top half interrupt.

[0127] As a possible implementation manner, the TPIC can periodically scan the touch control data generated by the TP device and put the scanned touch control data into the buffer of the TPIC. After the TPIC finishes scanning, the TPIC generates a top half interrupt through its touch control pin.

[0128] Among them, the period for the TPIC to scan the TP device is related to the sampling rate of the TP. For example, 120 hertz (Hz), 60 Hz, etc. It can be understood that in some implementation manners, the mobile phone can adjust the sampling rate of the TP; thus, the period for the TPIC to scan also changes accordingly; for example, the higher the sampling rate of the TP, the shorter the period for the TPIC to scan, and the lower the sampling rate of the TP, the longer the period for the TPIC to scan. Since the higher the sampling rate of the TP, the more frequent the operation of the TPIC, that is to say, the higher the power consumption of the TP, thus by adjusting the sampling rate of the TP, the power consumption of the mobile phone can be reduced and the battery life of the mobile phone can be improved.

[0129] It can be understood that if the user touches the TP, then the touch control data generated by the TP device will change, and thus the TPIC can sense the touch operation of the user on the TP through the change in the touch control data. Thus, the TPIC can start executing the above step S700 in response to the touch operation on the TP; afterwards, if the sensor data does not change for a long time, such as 1 minute, 5 minutes, etc., the TPIC stops executing step S700. Thus, the power consumption of the mobile phone can be saved.

[0130] For example, see Figure 8 , the user touches the TP 801 of the electronic device 800, and the TP device 802 generates touch data. After that, the TPIC 803 obtains the touch data, and generates and sends a top half interrupt through the interrupt pin.

[0131] In the present application, the top half interruption can be referred to as the top half interruption event, which is a kind of interruption of the operating system of the mobile phone. Corresponding to the top half interruption, the interruption of the operating system of the mobile phone can also include the bottom half, the top half can also be referred to as the upper half, and the bottom half can also be referred to as the lower half. Generally speaking, the top half is used to handle some tasks that are more urgent and have a short running time. The bottom half is used to handle some tasks that are not very urgent and have a long running time. At the same time, for TP, since the top half is triggered by the hardware of the TPIC, it is a hardware interruption, such as the interrupt pin of the TPIC jumps from a low level to a high level. The mobile phone will respond to the top half interruption and start the data transmission thread, so that the data transmission thread is in a runnable state. Exemplarily, the mobile phone can process the top half interruption through the irq_handler thread, such as converting the hardware interruption of the level jump of the above-mentioned TPIC interrupt pin into a software interruption. Optionally, since the above-mentioned top half interruption is a hardware interruption, the top half interruption will not be affected by the load on the processor core.

[0132] S701. In response to the top half interrupt, the data transmission thread is in the runnable state.

[0133] It can be understood that data transmission threads are a type of threads. Threads can be divided into states such as ready (runnable), running (running) and blocked (blocked). When a thread runs on a processor core, the thread is in the running state, and the code block of the thread will be executed by the processor core. If a thread in the runnable state obtains the right to use the processor core, that is, it runs on the processor core, it can change to the running state. A thread in the blocked state means that the code block of the thread does not execute when it runs to a certain code, that is, a blocking event occurs. When the blocking event is released, the thread changes from the blocked state to the runnable state, and then from the runnable state to the running state. For example, when a thread executes a certain code, it needs to wait for the function result, transmission result, etc., and the thread will be in the blocked state, that is, a blocking event has occurred. Afterwards, when the blocking event is released, such as when the above-mentioned function result and transmission result are returned to the thread, the thread will be unblocked and change from the runnable state to the running state again.

[0134] For example, modules related to thread management on a mobile phone, such as system services, can start a data transmission thread in response to a top half interrupt, putting the data transmission thread in the runnable state. Also, for example, the above irq_handler thread can convert a hardware interrupt into a software interrupt and notify the system service of the software interrupt, so that the system service can start a data transmission thread in response to the top half interrupt. It can be understood that in actual applications, other modules can also start the data transmission thread and put the data transmission thread in the runnable state, and the embodiments of the present application do not impose any restrictions on this.

[0135] Exemplarily, refer to Figure 9 to introduce the process of the data transmission thread transmitting touch data. First, the data transmission thread 900 in the running state puts the touch data into the touch data queue 901. After that, the data transmission thread changes from the running state to the blocked state, waiting for the transmission result. Then, in response to the transmission result, the data transmission thread changes from the blocked state, through the runnable state, and back to the running state again. If the transmission result is a successful transmission, the data transmission thread is destroyed; if the transmission result is a failed transmission, the touch data is sent again. Next, the TP module 902B in the kernel state obtains the touch data from the touch data queue 901. For example, the TP module 902B in the kernel state can be in a blocked state, waiting for the touch queue 901 to send touch data to the TP module 902B in the kernel state; after the touch queue 901 sends touch data to the TP module 902B in the kernel state, the TP module 902B in the kernel state cancels the blocked state, goes through the runnable state and becomes the running state, and receives the touch data. After obtaining the touch data, the TP module switches back to the user state. The TP module 902A in the user state sends the touch data. For example, sending touch data to the IMS903 in the framework layer. In this way, the touch data can be transmitted from the underlying hardware to the upper-layer service. It should be understood that the above transmission result can be sent by the touch data queue 901 to the data transmission thread after receiving the touch data; it can also be sent by the TP module to the data transmission thread after obtaining the touch data, and the embodiments of the present application do not impose any restrictions on this. The above transmission result can be characterized by a transmission flag bit. For example, if the transmission flag bit is 1, it means a successful transmission, and if the transmission flag bit is 0, it means a failed transmission.

[0136] In some embodiments, the above touch data queue can be referred to as a target data queue.

[0137] Among them, the above-mentioned user-mode TP module may include a get_frame thread, and the above-mentioned kernel-mode TP module may include an ioctl_get_frame thread. The TP module can achieve conversion between the user mode and the kernel mode through system calls.

[0138] It should be noted that the above Figure 9 As shown, the process of the data transmission thread transmitting touch data is only an example. In actual use, there may be other more transmission methods, and the embodiments of the present application do not impose any restrictions on this.

[0139] In some implementation manners, after the above TP module obtains touch data in the kernel mode, the TP module can also perform some processing on the touch data, such as converting the capacitance value data included in the touch data into coordinate data. Then, the touch data is sent again, for example, the touch data is sent to the IMS.

[0140] S702. The transmission management thread determines whether the data transmission thread is running normally. If it is not running normally, step S703 is executed; if it is running normally, step S701 is returned.

[0141] Among them, the normal operation of the above data transmission thread can be understood as that within a preset duration threshold, the data transmission thread can be allocated to a processor core, the data transmission thread changes from the runnable state to the running state, and the data transmission thread successfully sends touch data. If within the duration threshold, the data transmission thread is not allocated a processor core and the data transmission thread does not change to the running state, the transmission management thread determines that the data transmission thread is not running normally.

[0142] Among them, the duration threshold can be set as needed without limitation. For example, the above duration threshold can be 8 milliseconds (ms), 7 ms, 12 ms, etc. In some embodiments, the above duration threshold can be referred to as the first duration threshold.

[0143] Exemplarily, the transmission management thread is started in response to a top-half interrupt. After the transmission management thread is started, it starts timing, and the timing duration is the above duration threshold. If the transmission management thread times out, the transmission management thread determines whether the data transmission thread is running normally through the transmission flag bit, or the state of the data transmission thread, or the touch data queue.

[0144] Among them, the transmission flag bit can be used to represent the above transmission result.

[0145] As a possible implementation, the above data transmission thread can be configured such that if a transmission result indicating successful transmission is received, the transmission flag bit is set to 1; if a transmission result indicating transmission failure is received, or no transmission result is received, the transmission flag bit is set to 0. The above system service can, in response to a top half interrupt, start a transmission management thread. After the transmission management thread is started, it begins timing, and the timing duration of the transmission management thread is the above duration threshold. Next, in response to the expiration of the timing of the transmission management thread, the transmission management thread obtains the above transmission flag bit. If the transmission flag bit is 0, the transmission management thread determines that the data transmission thread is not running properly and executes the following step S703. If the transmission flag bit is 1, it can be considered that the data transmission thread has successfully sent touch data and the data transmission thread is running properly. Thus, the transmission management thread can determine whether the data transmission thread is running properly through the transmission flag bit.

[0146] In this application, the transmission management thread determining whether the data transmission thread is running properly based on the state of the data transmission thread can be alternatively described as the transmission management thread determining whether the data transmission thread is running properly based on whether the data transmission thread is in the running state. If it is in the running state, the data transmission thread is running properly; conversely, if it is not in the running state, the data transmission thread is not transmitting properly.

[0147] As another possible implementation, the above data transmission thread can be configured to send a timing termination command to the transmission management thread if it is in the running state. The above system service can, in response to a top half interrupt, start a transmission management thread. After the transmission management thread is started, it begins timing, and the timing duration of the transmission management thread is the above duration threshold. If the timing duration of the transmission management thread exceeds the preset duration threshold, the transmission management thread executes the following step S703. If the transmission management thread receives a timing termination command, the transmission management thread stops timing and self-destructs. It can be understood that if the data transmission thread is in the running state, then the data transmission thread can successfully send touch data.

[0148] As another possible implementation, the above system service can, in response to a top half interrupt, start a transmission management thread. After the transmission management thread is started, it begins timing, and the timing duration of the transmission management thread is the above duration threshold. And the transmission management thread can monitor the data in the touch data queue. If new touch data appears in the touch data queue, the timer of the transmission management thread restarts timing. If the timing times out, the transmission management thread executes the following step S703. In this implementation, the transmission management thread can determine whether the data transmission thread is running properly based on whether new touch data appears in the touch data queue.

[0149] The transmission management thread increases the priority of the data transmission thread and / or unbinds the core for the data transmission thread.

[0150] It can be understood that, considering the allocation of mobile phone processor resources, to avoid a processor core with relatively low performance executing complex threads and a processor core with relatively high performance executing simple threads, the mobile phone will preset a binding to a certain processor core for a thread. That is to say, a thread will be bound to a processor core, simply referred to as core binding. This thread will only run on this processor core.

[0151] For example, if the data transmission thread is bound to core 0 of the processor, then the data transmission thread after core binding will only run on core 0 of the processor. However, in the case of relatively high processor load, core 0 to which the data transmission thread is bound may be occupied by one or more threads for a long time, and the priority of the above one or more threads is higher than the priority of the data transmission thread. In this way, it will cause the data transmission thread to be unable to use core 0 of the processor. That is to say, the data transmission thread cannot become the running state and cannot transmit the above touch data. Among them, the above core 0 of the processor can also be referred to as the first processor core.

[0152] Similarly, considering the allocation of mobile phone processor resources, a thread will also be preset with a certain priority. For example, the priority of the data transmission thread is preset to the first priority.

[0153] Among them, the priority of a thread can be used to manage the resources that the thread can use, such as managing the order of processor cores that the thread can use. That is to say, a thread with a higher priority will be preferentially allocated and used by the scheduler of the mobile phone. Exemplarily, the priority of a thread can be represented by a priority parameter, such as the prio value. The smaller the prio value of a thread, the higher the priority of the thread.

[0154] As a possible implementation manner, the transmission management thread can increase the priority of the data transmission thread by reducing the prio value of the data transmission thread. For example, reducing the prio value by 20, reducing the prio value by 30, and so on. Or, raising the priority of the data transmission thread to the highest, such as setting the prio value to 0. Since the priority of the data transmission thread is increased, that is to say, the data transmission thread will be allocated processor cores more preferentially. For example, it will be allocated core 0 of the processor more preferentially than the thread occupying core 0 of the processor. That is to say, the chance for the data transmission thread to be allocated a processor core is increased, which can also make the data transmission thread become the running state and be able to transmit the above touch data. In this way, the timeliness of sensor data transmission can be improved and the situation of sensor data loss can be alleviated.

[0155] As a possible implementation, the transmission management thread can unbind the data transmission thread from the processor core 0. Then, after unbinding, the data transmission thread can use not only processor 0 but also other processor cores on the mobile phone, such as processor core 1, processor core 2, and so on. That is to say, the number of processor cores that the data transmission thread can use is increased. In this way, the chance for the data transmission thread to be assigned a processor core can be improved, and the data transmission thread can be changed to the running state to transmit the above touch data. In this way, the timeliness of sensor data transmission can be improved, and the situation of sensor data loss can be alleviated.

[0156] Exemplarily, the transmission management thread can set the priority of the data transmission thread through the sched_setscheduler interface. For example, increase the priority of the data transmission thread through this sched_setscheduler interface.

[0157] Also exemplarily, the transmission management thread can unbind the data transmission thread through the set_cpus_allowed_ptr interface. For example, unbind the data transmission thread from processor core 0 through this set_cpus_allowed_ptr interface.

[0158] As another possible implementation, since the transmission management thread also needs to execute corresponding functions through the processor core. That is to say, after the timer of the transmission management thread times out, the transmission management thread can assign the processor core it uses to the above data transmission thread. Thus, the chance for the data transmission thread to be assigned a processor core can also be improved, and the data transmission thread can be changed to the running state to transmit the above touch data. The timeliness of sensor data transmission can be improved, and the situation of sensor data loss can be alleviated.

[0159] As yet another possible implementation, the transmission management thread can first increase the priority of the data transmission thread and then assign other processor cores to the data transmission thread. Similarly, the transmission management thread can also first assign other processor cores to the data transmission thread and then increase the priority of the data transmission thread. In this way, the chance for the data transmission thread to be assigned a processor core can be further improved, the timeliness of sensor data transmission can be improved, and the situation of sensor data loss can be alleviated.

[0160] Exemplarily, the transmission management thread can first increase the priority of the data transmission thread. And after a preset duration 1, if the data transmission thread is still in the runnable state, the transmission management thread will unbind the data transmission thread from processor core 0. The above duration 1 can be 2 milliseconds, 4 milliseconds, and so on.

[0161] Exemplarily, the transmission management thread can first unbind the data transmission thread from the processor core 0. And after a preset duration 2, if the data transmission thread is still in the runnable state, the transmission management thread increases the priority of the data transmission thread. The above duration 2 can be 2 milliseconds, 4 milliseconds, and so on.

[0162] In some embodiments, after the above step S703, the mobile phone can return to execute the above step S701. In some other embodiments, the data transmission method provided by the embodiments of the present application may further include step S704.

[0163] In some embodiments, after the priority of the data transmission thread is adjusted in step S703, the priority of the data transmission thread can be the second priority, and the second priority is higher than the first priority.

[0164] S704. The transmission management thread restores the priority of the data transmission thread, and / or restores the core binding for the data transmission thread.

[0165] As a possible implementation manner, after executing the above step S703, the transmission management thread can start a timer 1, and the timing duration of the timer 1 is duration 3. After that, after the timer 1 times out, the transmission management thread restores the priority of the data transmission thread, and / or restores the core binding for the data transmission thread. For example, the priority of the data transmission thread is restored to the priority before step S703. Another example is to restore the binding of the data transmission thread to the processor core 0. Among them, the above duration 3 can be set as needed without limitation. For example, duration 3 can be 10 seconds, 15 seconds, 20 seconds, and so on. In some embodiments, the above duration 3 can be referred to as the second duration threshold.

[0166] It should be understood that considering the allocation of processor resources on the mobile phone, a preset priority is usually set for the data transmission thread, and a preset processor core is bound to the thread. In this way, the mobile phone can reasonably allocate processor resources. It should be noted that in the face of the rationality of resource allocation, the timeliness of data transmission, especially the timeliness of touch data and fingerprint data transmission, is more worthy of attention. Therefore, the technical solution provided by the embodiments of the present application can give priority to ensuring the timeliness of data transmission in scenarios where the processor load is relatively high. After that, if the processor load is alleviated, such as the processor load decreases, then the rationality of processor resource allocation is ensured. That is to say, through the above step S704, the priority of the data transmission thread is restored, and / or the core binding for the data transmission thread is restored. This can improve the reasonable degree of processor resource allocation on the mobile phone.

[0167] It can be understood that in step S704, the actions performed by the transmission management thread correspond to those in step S703 above. If the priority of the data transmission thread is adjusted in step S703, the transmission management thread restores the priority of the data transmission thread in step S704. If another processor core is allocated to the data transmission thread in step S703, the transmission management thread restores the binding for the data transmission thread in step S704. If both another processor core is allocated to the data transmission thread and the priority of the data transmission thread is adjusted in step S703, the transmission management thread in step S704 both restores the priority of the data transmission thread and restores the binding for the data transmission thread.

[0168] Exemplarily, the transmission management thread can set the priority of the data transmission thread through the sched_setscheduler interface. For example, the priority of the data transmission thread can be restored through this sched_setscheduler interface.

[0169] Also exemplarily, the transmission management thread can restore the core binding for the data transmission thread through the set_cpus_allowed_ptr interface. For example, the data transmission thread is bound to processor core 0 through this set_cpus_allowed_ptr interface.

[0170] In some embodiments, after the priority of the data transmission thread is restored in step S704 above, the priority of the data transmission thread can be the first priority.

[0171] In some embodiments, after step S704 above, the mobile phone can return to execute step S701 above.

[0172] Next, in combination with the user's process of using the mobile phone, the data transmission method provided by the embodiments of the present application will be introduced. Assume that the processor core preset for the data transmission thread is processor core 0; in the first time period, the mobile phone is in a low-load state; in the second time period, due to the AA thread continuously occupying processor core 0, the mobile phone is in a high-load state. Among them, the second time period is later than the first time period.

[0173] In some embodiments, the processor core preset for the above data transmission thread can be obtained by querying through a relevant query function. For example, the processor core preset for the above data transmission thread can be queried through the query function, the taskset - p() function. Among them, the input parameter of the above function can be the thread ID of the data transmission thread.

[0174] It should be understood that the priority of the AA thread is higher than that of the data transfer thread, and the AA thread can be one thread or multiple threads. The embodiments of the present application do not impose any restrictions on the number of threads included in the AA thread. For the convenience of the following description, an example will be given where the AA thread is one thread.

[0175] In some embodiments, the above AA thread may be referred to as the second thread.

[0176] In some other embodiments, if the mobile phone is in a low-load state during the time period before the above-mentioned first time period, and the data transfer thread runs on the processor core 0 multiple times, such as 5 times, 10 times, etc., it can be considered that the preset processor core of the data transfer thread is the processor core 0.

[0177] During the first time period, the mobile phone executes the above steps S700 - S702; when the mobile phone executes the above step S702, since the data transfer thread is assigned to the processor core 0, the data transfer thread becomes the running state. The mobile phone executes the normal branch and returns to step S700, that is, the mobile phone loops through steps S700 - S702. In this way, the touch data can be transmitted to the upper-layer service, such as IMS, through the data transfer thread, and the upper-layer service can execute the touch function of the mobile phone based on the touch data.

[0178] Exemplarily, refer to Figure 10 , Figure 10 shows the states of the threads during the above-mentioned first time period and the second time period, as well as the threads running on the processor core. Figure 10 In, the thread in a runnable state is represented by a slanted grid filling, the thread in a running state is represented by a solid black filling, the thread in a blocked state is represented by a square grid filling, the data transfer thread is represented by a horizontal straight line filling, and the transmission management thread is represented by a dot filling. It can be understood that in the above Figure 10 In, the state of the thread at a certain time point will be shown on the time line corresponding to the thread, such as being in a runnable state, a running state, or a blocked state, etc.; and, on the time line corresponding to the processor core, the time point at which a certain thread is running on the processor will be shown, such as the data transfer thread, the AA thread, other threads, etc., and these threads are in the running state. That is to say, on the time line corresponding to the processor core, only the threads running on the processor core and in the running state will be shown. It should be understood that the above-mentioned other threads can be understood as other threads except the above-mentioned data transfer thread and AA thread.

[0179] Refer to again Figure 10 , during the first time period, based on the data transfer thread multiple times ( Figure 10If it runs on the processor core 0 three times (shown in the figure), it can be considered that the data transfer thread is bound to the processor core 0. Specifically, within the time period A1001, in response to the top half interrupt, the data transfer thread is in the runnable state. After that, the data transfer thread is assigned to the processor core 0 and the data transfer thread is in the running state. Then, the data transfer thread transfers touch data. Exemplarily, the process of the data transfer thread transferring touch data can be referred to the above Figure 9 corresponding description. After the data transfer thread transfers touch data, the data transfer thread will go through the runnable state and become the running state again to confirm the transfer result. In this way, the data transfer thread completes the process of transferring touch data.

[0180] Correspondingly, within the time period A1001, in response to the top half interrupt, the transfer management thread is started, that is, the transfer management thread is in the runnable state. Next, the transfer management thread executes the above step S702. Exemplarily, within the above time period A1001, based on the transfer management thread executing the above step S702, the transfer management thread will be in the runnable-running state twice. For example, within the above time period A1001, based on the transfer management thread being in the runnable-running state for the first time, the transfer management thread starts timing; based on the transfer management thread being in the runnable-running state for the second time, the transfer management thread ends timing, for example, executing the yes branch in the above step S702. It should be understood that the transfer management thread can run on the processor core 0, or on the processor core 1, or on other processor cores not shown in more figures. The embodiments of the present application do not impose any restrictions on the processor core on which the transfer management thread runs.

[0181] As can be seen from the above analysis, within the first time period, the mobile phone executes the above steps S700-S702. When executing the above step S702, it executes the yes branch and returns to execute the above step S700; that is, the mobile phone repeatedly executes steps S700-S702.

[0182] After that, in the second time period, since the AA thread occupies the processor core 0 for a long time, the data transmission thread cannot use the processor core 0, which will cause the data transmission thread to be in the runnable state for a long time; Next, the transmission management thread executes the above step S702 and reaches the negative branch, and then executes the above step S703. After the transmission management thread executes step S703, since the priority of the data transmission thread is increased, and / or, other processor cores are allocated to the data transmission thread. The data transmission can be allocated to the processor core and be in the running state to transmit touch data. In this way, the timeliness of sensor data transmission can be improved and the situation of sensor data loss can be alleviated.

[0183] Exemplarily, referring again to Figure 10 , in the time period B1002, in response to the top half interrupt, the data transmission thread is in the runnable state; based on the AA thread occupying the processor core 0 for a long time and the priority of the AA thread being higher than that of the data transmission thread, the data transmission thread cannot use the processor core 0, and the data transmission thread will be in the runnable state for a long time. Correspondingly, in response to the top half interrupt, the transmission management thread is in the runnable state, and then the transmission management thread is in the running state and starts timing, and the timing duration is the above duration threshold. Next, in response to the transmission management thread timing out, the transmission management thread determines that the data transmission thread is not running normally based on the transmission flag bit, and the transmission management thread executes the above step S703. That is, based on the duration of the data transmission thread being in the running state being greater than or equal to the duration threshold, such as the duration from time point E1004 to time point F1005 being greater than or equal to the duration threshold, the transmission management thread executes the above step S703. From the description corresponding to the above step S703, it can be seen that based on the transmission management thread executing the above step S703, the data transmission thread changes from the runnable state to the running state. Next, the data transmission thread transmits touch data. After that, the mobile phone executes the above step S700 again.

[0184] In some embodiments, the above time point E may also be referred to as the first time point, and the above time point F may also be referred to as the second time point.

[0185] It should be noted that in the time period C1003, based on the transmission management thread increasing the priority of the data transmission thread, the data transmission thread runs on the processor core 0. And, in the time period C1003, based on the transmission management thread unbinding the core for the data transmission thread, the data transmission thread runs on other processor cores, such as processor core 1.

[0186] In the above Figure 10During the corresponding process, since the data transmission thread runs on the processor core 1 during the second time period, or the priority of the data transmission thread is increased, that is, even when the processor is under high load, the data transmission thread can still be allocated to the processor core, and the data transmission thread can be in the running state to transmit touch data. Then, the timeliness of touch data transmission on the mobile phone is improved, and the situation of sensor data loss is alleviated.

[0187] In some embodiments, after the second time period, since the AA thread has finished running, the mobile phone is in a low-load state again. During the third time period, the mobile phone is in a low-load state. The third time period is later than the second time period. During the third time period, since after the above-mentioned transmission management thread executes step S703, timer 1 is started; in response to the timeout of the timer, the transmission management thread executes step S704. The timing duration of timer 1 is the above-mentioned duration 3.

[0188] Exemplarily, refer to Figure 11 , Figure 11 shows the states of the threads and the states of the processor cores during the second time period and the third time period. The state of the processor core can be understood as the threads running on the processor core. Figure 11 In, the thread in a runnable state is represented by a slanted grid filling, the thread in a running state is represented by a solid black filling, the thread in a blocked state is represented by a square grid filling, the data transmission thread is represented by a horizontal straight line filling, and the transmission management thread is represented by a dot filling. It can be understood that in the above Figure 11 In, the state of the thread at a certain time point will be shown on the time line corresponding to the thread, such as being in a runnable state, a running state, or a blocked state, etc.; and, the thread running on the processor at a certain time point will be shown on the time line corresponding to the processor core, such as the data transmission thread, the AA thread, other threads, etc., and these threads are in the running state. That is to say, on the time line corresponding to the processor core, only the threads running on the processor core and in the running state will be shown. It should be understood that the above-mentioned other threads can be understood as other threads except the above-mentioned data transmission thread and AA thread.

[0189] During time period D1101, in response to the timeout of Timer 1, the transmission management thread executes step S704. That is, based on the duration from time point A1103 to time point B1104 being greater than or equal to the above-mentioned duration 3, the transmission management thread executes step S704. After the transmission management thread executes step S704, the priority of the data transmission thread is restored, and / or the data transmission thread resumes core binding. That is, in the third time period, the priority of the data transmission thread before time point C1102 is higher than the priority of the data transmission thread after time point C1102, and / or the data transmission thread is not bound to processor core 0 before time point C1102 and is bound to processor core 0 after time point C1102.

[0190] In some embodiments, the above time point A may be referred to as the second time point, and the above time point B may be referred to as the third time point.

[0191] In some other embodiments, the above first time period may be referred to as the first time period, the above second time period may be referred to as the second time period, and the above third time period may be referred to as the third time period.

[0192] In some other embodiments, the above time period A may be referred to as the first time period, and the above time period B may be referred to as the second time period.

[0193] From the above Figure 8 corresponding description, it can be seen that the data transmission thread is started in response to a top half interrupt. Considering that in some scenarios, the processor load is relatively high, or the processor has an exception, and the top half interrupt is not received, or the top half interrupt is masked; then the data transmission thread may not be started, which may cause sensor data loss, seriously affecting the timeliness of sensor data transmission and seriously affecting the user experience. For example, for the touch data collected by the TP, the mobile phone will experience the phenomenon of unresponsive touch, and for the fingerprint data of the fingerprint sensor, the mobile phone will experience the phenomenon of failed fingerprint unlocking.

[0194] To improve the timeliness of sensor data transmission in the scenario of processor exceptions, an embodiment of this application provides another data transmission method. In this method, if the sensor module has not received sensor data for a long time, the sensor module obtains sensor data from the sensor. It should be understood that in this method, the above-mentioned sensor module is a software module at the HAL layer, which can be in user mode or kernel mode, and the above-mentioned sensor is a hardware device at the hardware layer. In the above method, since the sensor module is not triggered by the top half interrupt, that is, even without the top half interrupt, the sensor module can actively obtain sensor data from the hardware bottom layer, such as the IC chip of the sensor; thus, by the sensor module obtaining sensor data from the IC chip, the timeliness of sensor data transmission can be improved, and the situation of sensor data loss can be alleviated.

[0195] Exemplarily, referring to Figure 12 , the sensor IC of the electronic device 100 does not generate a top half interrupt, or the generated top half interrupt is masked by the processor of the electronic device 100, which will cause the above data transmission thread not to become a runnable state, let alone a running state to transmit sensor data. As a result, the sensor module at the HAL layer does not receive sensor data. The sensor module at the hardware abstraction layer obtains sensor data from the sensor IC at the hardware layer based on not receiving sensor data for more than a preset duration 4. Among them, the process of the sensor module receiving sensor data is similar to the Figure 9 corresponding process, and the corresponding text description can be referred to above Figure 9 .

[0196] Among them, the above duration 4 can be set as needed without limitation. For example, the above duration 4 can be 12ms, 15ms, 1 second, etc. In some embodiments, the above duration 4 can be referred to as the third duration threshold. In some other embodiments, the above duration 4 can be referred to as the fourth duration threshold.

[0197] Next, in combination with the above Figure 3 shown usage scenario, taking the electronic device as a mobile phone, the sensor at the hardware layer as a fingerprint sensor, the sensor at the HAL layer as a fingerprint sensor, and the sensor data as fingerprint data as an example, this data transmission method will be introduced.

[0198] Referring to Figure 13 , the data transmission method provided by the embodiment of this application may include steps S1200 - S1202.

[0199] S1200. The fingerprint module switches from user mode to kernel mode.

[0200] Specifically, the implementation process of this step can be referred to the above Figure 9 corresponding description, and will not be elaborated here.

[0201] S1201. The fingerprint module in the kernel state is in a blocked state.

[0202] It can be understood that the fingerprint module in the kernel state will be in a blocked state to wait for the fingerprint data queue to send fingerprint data, and cancel the blocked state in response to the fingerprint data queue sending fingerprint data. That is to say, if the fingerprint module is in a blocked state, it can be considered that the fingerprint module has not received fingerprint data.

[0203] In some embodiments, the above fingerprint data queue may be referred to as a target data queue.

[0204] S1202. Based on the duration that the fingerprint module is in a blocked state exceeding a preset duration 4, the fingerprint module obtains fingerprint data from the fingerprint IC.

[0205] It should be understood that for the fingerprint sensor, its fingerprint acquisition work is relatively independent. That is to say, the fingerprint sensor device acquires fingerprint data, and then the fingerprint IC sends the fingerprint data. However, in some scenarios, such as the top half interrupt sent by the fingerprint IC through the interrupt pin being masked, this will cause the fingerprint IC to fail to send fingerprint data, but the fingerprint data will exist in the buffer of the fingerprint IC. Based on this, even if the top half interrupt is masked, the fingerprint module can still obtain fingerprint data from the fingerprint IC.

[0206] It should be pointed out that if the top half interrupt is masked and the data transmission thread is not started, then the fingerprint data queue will not send fingerprint data to the fingerprint module, which will cause the fingerprint module to be in a blocked state for a long time. Or, the mobile phone processor load is relatively high, and the data transmission thread is in the runnable state for a long time and cannot use the processor core, so the data transmission thread cannot send the fingerprint data to the fingerprint data queue; this will cause the fingerprint module to be in a blocked state for a long time. Or, the mobile phone processor load is relatively high, the data transmission thread is in the runnable state for a long time, and after the above data management thread raises the priority of the data transmission thread, and / or, after unbinding the core for the data transmission thread, the data transmission thread is still in the runnable state for a long time and cannot use the processor core; this will cause the fingerprint module to be in a blocked state for a long time.

[0207] As a possible implementation manner, the above duration 4 may be related to the sampling frequency (sampling period) of the fingerprint sensor, such as the duration 4 being greater than or equal to the sampling period. It should be understood that the process of the fingerprint sensor acquiring fingerprint data requires a certain amount of time, and it is impossible to obtain complete fingerprint data during the process of the fingerprint sensor acquiring fingerprint data. Therefore, based on the duration 4 being greater than the sampling period of the fingerprint sensor, the fingerprint module can obtain complete fingerprint data, which can improve the integrity of the mobile phone obtaining sensor data.

[0208] In some embodiments, after the above step S1202, the mobile phone can execute steps S1200 - S1202 again. That is to say, the mobile phone can execute steps S1200 - S1202 in a loop, and the fingerprint data can be transmitted to the upper-layer service, such as IMS.

[0209] In some scenarios, considering that the fingerprint sensor may have different working modes, such as a low-frequency acquisition mode and a high-frequency acquisition mode. Thus, the fingerprint module can obtain the working mode of the fingerprint sensor and, based on the working mode of the fingerprint sensor, take different values for the above-mentioned duration 4. Among them, in the low-frequency acquisition mode, the period for the fingerprint sensor to collect fingerprint data can be 1 second, 0.5 second, etc.; in the high-frequency acquisition mode, the period for the fingerprint sensor to collect fingerprint data can be 8.3 milliseconds, 16 milliseconds, etc. The low-frequency acquisition mode can save the power consumption of the mobile phone. Exemplarily, if the fingerprint sensor is in the low-frequency acquisition mode, the duration 4 can be at the second level, such as 2 seconds, 1.5 seconds, etc. If the fingerprint sensor is in the high-frequency acquisition mode, the duration 4 can be at the millisecond level, such as 12 milliseconds, 15 milliseconds, 18 milliseconds, etc. That is to say, the mobile phone can set different durations 4 based on the acquisition mode of the sensor.

[0210] It can be understood that in some other embodiments, if the time for the fingerprint module to be in the blocked state does not exceed the preset duration 4, it can be considered that the fingerprint module can obtain the fingerprint data, and the fingerprint module executes the process of transmitting the fingerprint data. Specifically, this process is similar to the Figure 9 corresponding process, and reference can be made to the above Figure 9 corresponding text description.

[0211] Next, in combination with the user's usage process of the mobile phone, the data transmission method provided by the embodiments of the present application will be introduced.

[0212] Assume that the processor core preset for the data transmission thread is processor core 0; in the 4th time period, the mobile phone is in a low-load state; in the 5th time period, due to the BB thread continuously occupying processor core 0, the mobile phone is in a high-load state. In the 6th time period, the mobile phone is in a low-load state. The 5th time period is later than the 4th time period, and the 6th time period is later than the 5th time period. Among them, for the detailed introduction of the above 4th time period, 5th time period, and 6th time period, reference can be made to the above Figure 10 and Figure 11 corresponding descriptions, which will not be elaborated here.

[0213] Next, in the 7th time period, the CC thread masks the top-half interrupt sent by the fingerprint IC through the interrupt pin. The 7th time period is later than the 6th time period.

[0214] Since the upper half interrupt of the fingerprint IC is masked during the 7th time period, that is to say, neither the above data transmission thread nor the transmission management thread will become the runnable state, let alone the running state. Then, the fingerprint data cannot be transmitted to the upper-layer service, such as IMS, through the data transmission thread, the fingerprint data queue, and the fingerprint module.

[0215] During the 7th time period, the fingerprint module repeatedly executes the above steps S1200 - S1202. In step S1202, since the upper half interrupt is masked, the data transmission thread will not become the running state, and the fingerprint data queue will not send fingerprint data. This will cause the fingerprint module to be blocked for a long time. That is to say, based on the masking of the upper half interrupt of the fingerprint IC, when the blocking duration of the fingerprint module exceeds the preset duration 4, the fingerprint module obtains fingerprint data from the fingerprint IC. Thus, the fingerprint data can be transmitted to the upper-layer service, such as ISM, through the fingerprint IC and the fingerprint module.

[0216] It should be noted that the personal information used in the technical solution of this application is limited to the information for which individual consent has been obtained, including but not limited to, before the user uses this function, notifying and reminding the user to read the relevant user agreement (notification), and signing the agreement (authorization) including authorizing the relevant user information.

[0217] Combined with the algorithm steps of each example described in the embodiments disclosed herein, this application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described function for each specific application in combination with the embodiments, but such implementation should not be considered to exceed the scope of this application.

[0218] This embodiment can divide the functional modules of the electronic device according to the above method examples. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is illustrative, only a logical function division, and there can be other division methods in actual implementation.

[0219] This application embodiment also provides an electronic device, such as Figure 14 shown, the electronic device can include one or more processors 1401, a memory 1402, and a communication interface 1403.

[0220] Among them, the memory 1402 and the communication interface 1403 are coupled to the processor 1401. For example, the memory 1402, the communication interface 1403 and the processor 1401 can be coupled together through the bus 1404.

[0221] Among them, the communication interface 1403 is used for data transmission with other devices. The memory 1402 stores computer program code. The computer program code includes computer instructions. When the computer instructions are executed by the processor 1401, the electronic device is caused to execute the relevant method steps in the method embodiments of the present application described above.

[0222] Among them, the processor 1401 can be a processor or a controller. For example, it can be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the present disclosure. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and so on.

[0223] Among them, the bus 1404 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The above bus 1404 can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 14 only a thick line is used to represent it in the figure, but it does not mean that there is only one bus or one type of bus.

[0224] The embodiments of the present application also provide a chip system, as Figure 15 shown. The chip system includes at least one processor 1501 and at least one interface circuit 1502. The processor 1501 and the interface circuit 1502 can be interconnected by lines. For example, the interface circuit 1502 can be used to receive signals from other devices (such as the memory of a mobile phone). For another example, the interface circuit 1502 can be used to send signals to other devices (such as the processor 1501).

[0225] For example, the interface circuit 1502 can read the instructions stored in the memory of the mobile phone and send the instructions to the processor 1501. When the instructions are executed by the processor 1501, the mobile phone can execute the respective steps in the above embodiments.

[0226] An embodiment of the present application further provides a computer-readable storage medium. Computer program code is stored in the computer storage medium. When the above processor executes the computer program code, the electronic device executes the relevant method steps in the above method embodiments.

[0227] An embodiment of the present application further provides a computer program product. When the computer program product runs on a computer, the computer is caused to execute the relevant method steps in the above method embodiments.

[0228] Among them, the electronic device, computer-readable storage medium, or computer program product provided in the present application are all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be elaborated here.

[0229] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0230] In the several embodiments provided in the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.

[0231] The units described as separate components may or may not be physically separated. The components displayed as units may be one physical unit or multiple physical units, that is, they can be located in one place, or they can be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0232] In addition, in each embodiment of the present application, each functional unit can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0233] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence, or the part that makes a contribution, or all or part of the technical solution, can be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes.

[0234] The above content is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A data transmission method, characterized in that, applied to an electronic device, the processor of the electronic device includes multiple processor cores, and the electronic device includes a first thread; the method includes: In response to a top-half interrupt event, trigger the first thread to be in a ready state, and the first thread is used to transmit interrupt event data; When the preset priority of the first thread is the first priority, within a first time period, run the first thread with the first priority, and within a second time period, run the first thread with a second priority; and / or, When the processor core preset to be bound to the first thread is the first processor core, within the first time period, run the first thread on the first processor core, and within the second time period, run the first thread on a second processor core; wherein, the second time period is later than the first time period, the second priority is higher than the first priority, and the first processor core and the second processor core are different processor cores.

2. The method according to claim 1, characterized in that, the method further includes: When the preset priority of the first thread is the first priority, within a third time period, run the first thread with the first priority; the third time period is later than the second time period; and / or, When the processor core preset to be bound to the first thread is the first processor core, within the third time period, run the first thread on the first processor core.

3. The method according to claim 2, characterized in that, the second time period includes a first time point and a second time point, and the second time point is later than the first time point; the first thread is in the ready state from the first time point to the second time point; the duration from the first time point to the second time point is greater than or equal to a preset first duration threshold; The step of running the first thread with a second priority within the second time period includes: Within the second time period, based on the duration from the first time point to the second time point being greater than or equal to the first duration threshold, run the first thread with a second priority; The step of running the first thread on the second processor core within the second time period includes: Within the second time period, based on the duration from the first time point to the second time point being greater than or equal to the first duration threshold, run the first thread on the second processor core.

4. The method according to claim 3, characterized in that, the third time period includes a third time point, and the duration from the second time point to the third time point is greater than or equal to a preset second duration threshold; The step of running the first thread with the first priority within the third time period includes: Within the third time period, based on the duration from the second time point to the third time point being greater than or equal to the second duration threshold, run the first thread with the first priority; The step of running the first thread on the first processor core within the third time period includes: During the third time period, based on the duration from the second time point to the third time point being greater than or equal to the second duration threshold, the first thread is run on the first processor core.

5. The method according to any one of claims 1-4, wherein, the electronic device further includes a second thread, the priority of the second thread is higher than the first priority and lower than the second priority; during the first time period, the second thread is not running, and during the second time period, the second thread runs on the first processor core.

6. The method according to any one of claims 1-5, wherein, the method further includes: if the duration for which the first thread is in the ready state is greater than or equal to the first duration threshold, perform a first process on the first thread; the first process includes: increasing the priority of the first thread, and / or, unbinding the first thread from the first processor core.

7. The method according to claim 6, wherein, the method further includes: if the duration after the first thread undergoes the first process is greater than or equal to the second duration threshold, perform a second process on the first thread; wherein, in the case where the first process includes increasing the priority of the first thread, the second process includes restoring the priority of the first thread to the first priority; and / or, in the case where the first process includes unbinding the first thread from the first processor core, the second process includes restoring the binding of the first thread to the first processor core.

8. The method according to claim 7, wherein, the duration after the first thread undergoes the first process being greater than or equal to the second duration threshold includes: if a first timer times out, the duration after the first thread undergoes the first process is greater than or equal to the second duration threshold, wherein the first timer is started when the first process is performed on the first thread, and the timing duration of the first timer is the second duration threshold.

9. The method according to any one of claims 6-8, wherein, the electronic device further includes a sensor integrated circuit IC and a sensor module; before triggering the first thread to be in the ready state in response to the top half interrupt event, the method further includes: the sensor IC acquires interrupt event data and sends the top half interrupt event; after triggering the first thread to be in the ready state in response to the top half interrupt event, the method further includes: the first thread in the running state acquires the interrupt event data from the sensor IC and places the interrupt event data into a target data queue; the sensor module acquires the interrupt event data from the target data queue; wherein, if the sensor module does not acquire the interrupt event data from the target data queue within a preset third duration threshold, the sensor module acquires the sensor data from the sensor IC.

10. The method according to claim 9, wherein, The sensor module fails to obtain the sensor data from the target data queue within a preset third duration threshold, including: If the duration for which the sensor module is in a blocked state is greater than or equal to the third duration threshold, the sensor module fails to obtain the sensor data from the target data queue within the preset third duration threshold.

11. The method according to claim 9 or 10, wherein, the sensor IC includes a touch panel IC or a fingerprint sensor IC; When the sensor IC includes a touch panel IC, the sensor module includes a touch panel module located in the hardware abstraction layer of the electronic device, and the interrupt event data includes touch data; When the sensor IC includes a fingerprint sensor IC, the sensor module includes a fingerprint sensor module located in the hardware abstraction layer of the electronic device, and the interrupt event data includes fingerprint data.

12. A data transmission method, wherein, applied to an electronic device, the electronic device includes a sensor integrated circuit (IC), a sensor module, and a third thread; The method includes: The sensor IC obtains interrupt event data and sends a top half interrupt event; In response to the top half interrupt event, triggering the third thread to be in a ready state; The third thread in a running state obtains the interrupt event data from the sensor IC and places the interrupt event data into a target data queue; The sensor module obtains the interrupt event data from the target data queue; wherein, if the sensor module fails to obtain the interrupt event data from the target data queue within a preset fourth duration threshold, the sensor module obtains the interrupt event data from the sensor IC.

13. The method according to claim 12, wherein, the sensor module fails to obtain the sensor data from the target data queue within a preset fourth duration threshold, including: If the duration for which the sensor module is in a blocked state is greater than or equal to the fourth duration threshold, the sensor module fails to obtain the sensor data from the target data queue within the fourth duration threshold.

14. The method according to claim 12 or 13, wherein, the acquisition mode of the sensor includes a low-frequency acquisition mode or a high-frequency acquisition mode, and the fourth duration threshold includes: a fourth duration threshold corresponding to the low-frequency acquisition mode and a fourth duration threshold corresponding to the high-frequency acquisition mode; The method further includes: Based on the acquisition mode of the sensor, setting the fourth duration threshold corresponding to the sensor acquisition mode.

15. The method according to any one of claims 12-14, wherein, the sensor IC includes a touch panel IC or a fingerprint sensor IC; When the sensor IC includes a touch panel IC, the sensor module includes a touch panel module located in the hardware abstraction layer of the electronic device, and the interrupt event data includes touch data; When the sensor IC includes a fingerprint sensor IC, the sensor module includes a fingerprint sensor module located in the hardware abstraction layer of the electronic device, and the interrupt event data includes fingerprint data.

16. An electronic device, characterized in that the electronic device includes a memory, one or more processors, and a camera, the memory is coupled to the processor, and the processor is coupled to the camera; wherein, computer program code is stored in the memory, and the computer program code includes computer instructions; when the computer instructions are executed by the processor, the electronic device is caused to execute the method according to any one of claims 1-15.

17. A computer-readable storage medium, characterized in that it includes computer instructions, and when the computer instructions are run on an electronic device, the electronic device is caused to execute the method according to any one of claims 1-15.

Citation Information

Patent Citations

  • Processor scheduling method and system

    CN106293902A

  • Thread execution method and device, terminal and storage medium

    CN109918141A

  • Response speed increasing method, terminal and storage medium

    CN110737518A

  • Thread running method and device, electronic equipment and storage medium

    CN115599537A

  • Drawing method, electronic equipment and readable storage medium

    CN115639920A