Log collection method and device, electronic equipment and storage medium
By responding to target commands in electronic devices to obtain instruction information, the log information of the target sensor is directly collected, solving the problem of cumbersome sensor log information collection and achieving efficient log information acquisition and storage optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING XIAOMI MOBILE SOFTWARE CO LTD
- Filing Date
- 2024-11-08
- Publication Date
- 2026-05-08
AI Technical Summary
In electronic devices, collecting log information from specific sensors is a cumbersome and time-consuming process. Existing technologies require collecting log information from all sensors before filtering, resulting in low efficiency.
A log collection method is provided, which obtains indication information in response to target instructions, directly collects log information from target sensors, and uses the indication information to configure preset parameters to indicate whether to collect log information from other sensors, thereby simplifying the process and improving efficiency.
It simplifies the process of acquiring target sensor log information, reduces time consumption, improves the speed of log information collection, and reduces the size and storage capacity of log information.
Smart Images

Figure CN121996492A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a log collection method, apparatus, electronic device, and storage medium. Background Technology
[0002] There may be dozens or even hundreds of sensors mounted on a Sensorhub in an electronic device. Currently, when you want to know the operating status of a specific sensor, you can only collect the log information of all sensors, and then the user has to filter out the log information of the specific sensor from the log information of all sensors. This makes the process of obtaining the log information of a specific sensor cumbersome and extremely time-consuming. Summary of the Invention
[0003] To overcome the problems existing in related technologies, this disclosure provides a log collection method, apparatus, electronic device, and storage medium.
[0004] According to a first aspect of the present disclosure, a log collection method is provided, the method comprising:
[0005] In response to a target instruction, indication information is acquired; wherein the target instruction is used to instruct the collection of log information from a target sensor, and the indication information is used to instruct the target sensor;
[0006] Based on the indicated information, log information of the target sensor is collected.
[0007] In some embodiments, the method further includes:
[0008] Obtain user feedback information, which includes sensor anomaly information, used to indicate a sensor malfunction in the current electronic device;
[0009] The target instruction is generated based on the sensor anomaly information.
[0010] In some embodiments, the method further includes:
[0011] In response to the detection of an instruction input operation, the target instruction is obtained.
[0012] In some embodiments, collecting log information from the target sensor based on the indication information includes:
[0013] Based on the first correspondence, the sensor identifier corresponding to the indication information is determined, wherein the first correspondence includes the correspondence between the indication information and the sensor identifier;
[0014] Collect log information of the target sensor corresponding to the sensor identifier.
[0015] In some embodiments, the method further includes:
[0016] When the target sensor is a virtual sensor, determine the physical sensor associated with the target sensor;
[0017] Collect log information from physical sensors associated with the target sensor.
[0018] In some embodiments, collecting log information from the target sensor based on the indication information includes:
[0019] Based on the indication information, preset parameters are configured to obtain the configured preset parameters; the configured preset parameters are used to indicate that log information of the target sensor is collected, and log information of other sensors besides the target sensor is not collected.
[0020] Based on the preset parameters configured, the log information of the target sensor is collected.
[0021] In some embodiments, the preset parameters include multiple flag bits, each flag bit corresponding to a sensor, and the value on the flag bit is used to indicate whether to collect log information from the sensor corresponding to the flag bit; the step of configuring the preset parameters based on the indication information to obtain the configured preset parameters includes:
[0022] Based on the indicated information, the value of each flag bit in the preset parameters is configured to obtain the configured preset parameters.
[0023] In some embodiments, configuring the value of each flag bit in the preset parameters based on the indication information includes:
[0024] Based on the indication information, the value of the target flag bit in the preset parameters is set to a first preset value, and the values of the other flag bits in the preset parameters other than the target flag bit are set to a second preset value;
[0025] Wherein, the target flag bit is the flag bit corresponding to the target sensor, the value on the flag bit is a first preset value used to indicate that the log information of the sensor corresponding to the flag bit is collected, and the value on the flag bit is a second preset value used to indicate that the log information of the sensor corresponding to the flag bit is not collected.
[0026] In some embodiments, the step of obtaining indication information in response to a target instruction includes:
[0027] In response to the target instruction, the indication information is obtained through the application processor;
[0028] The step of collecting log information from the target sensor based on the indication information includes:
[0029] Based on the indicated information, the sensor hub collects log information from the target sensor.
[0030] In some embodiments, the method further includes:
[0031] The application processor sends the indication information to the sensor hub using a preset communication method.
[0032] In some embodiments, the method further includes:
[0033] The application processor stores the instruction information into a preset storage area;
[0034] The indication information is read from the preset storage area via the sensor hub.
[0035] According to a second aspect of the present disclosure, a log collection apparatus is provided, the apparatus comprising:
[0036] The indication information acquisition module is configured to acquire indication information in response to a target instruction; wherein the target instruction is used to instruct the collection of log information from a target sensor, and the indication information is used to instruct the target sensor.
[0037] The log collection module is configured to collect log information from the target sensor based on the indication information.
[0038] In some embodiments, the apparatus further includes:
[0039] The instruction acquisition module is configured to acquire user feedback information, which includes sensor anomaly information, and the sensor anomaly information is used to indicate the sensor that is malfunctioning in the current electronic device.
[0040] The instruction acquisition module is also configured to generate the target instruction based on the sensor anomaly information.
[0041] In some embodiments, the apparatus further includes:
[0042] The instruction acquisition module is configured to acquire the target instruction in response to the detection of an instruction input operation.
[0043] In some embodiments, the log collection module is configured to:
[0044] Based on the first correspondence, the sensor identifier corresponding to the indication information is determined, wherein the first correspondence includes the correspondence between the indication information and the sensor identifier;
[0045] Collect log information of the target sensor corresponding to the sensor identifier.
[0046] In some embodiments, the log collection module is further configured to:
[0047] When the target sensor is a virtual sensor, determine the physical sensor associated with the target sensor;
[0048] Collect log information from physical sensors associated with the target sensor.
[0049] In some embodiments, the log collection module is configured to:
[0050] Based on the indication information, preset parameters are configured to obtain the configured preset parameters; the configured preset parameters are used to indicate that log information of the target sensor is collected, and log information of other sensors besides the target sensor is not collected.
[0051] Based on the preset parameters configured, the log information of the target sensor is collected.
[0052] In some embodiments, the preset parameters include multiple flag bits, each flag bit corresponding to a sensor, and the value on the flag bit is used to indicate whether to collect log information from the sensor corresponding to the flag bit; the log collection module is configured to:
[0053] Based on the indicated information, the value of each flag bit in the preset parameters is configured to obtain the configured preset parameters.
[0054] In some embodiments, the log collection module is configured to:
[0055] Based on the indication information, the value of the target flag bit in the preset parameters is set to a first preset value, and the values of the other flag bits in the preset parameters other than the target flag bit are set to a second preset value;
[0056] Wherein, the target flag bit is the flag bit corresponding to the target sensor, the value on the flag bit is a first preset value used to indicate that the log information of the sensor corresponding to the flag bit is collected, and the value on the flag bit is a second preset value used to indicate that the log information of the sensor corresponding to the flag bit is not collected.
[0057] In some embodiments, the indication information acquisition module is configured to acquire the indication information through an application processor in response to the target instruction;
[0058] The log collection module is configured to collect log information of the target sensor based on the indication information via a sensor hub.
[0059] In some embodiments, the apparatus further includes:
[0060] The indication information sending module is configured to send the indication information to the sensor hub via the application processor using a preset communication method.
[0061] In some embodiments, the apparatus further includes:
[0062] The storage module is configured to store the indication information into a preset storage area via the application processor;
[0063] The reading module is configured to read the indication information from the preset storage area via the sensor hub.
[0064] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0065] processor;
[0066] Memory used to store processor-executable instructions;
[0067] The processor is configured to perform the log collection method as described in the first aspect of the embodiments of this disclosure.
[0068] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, wherein when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the log collection method as described in the first aspect of the present disclosure.
[0069] The method described above, as disclosed in this invention, has the following beneficial effects:
[0070] The method provided in this disclosure, in response to an instruction to collect log information of a target sensor, obtains instruction information to indicate the target sensor, and then collects the log information of the target sensor based on the instruction information. This eliminates the need to first collect the log information of all sensors and then filter out the log information of the target sensor from the log information of all sensors, thus simplifying the process of obtaining the log information of the target sensor, reducing time consumption, and improving the speed of log information collection.
[0071] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0072] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0073] Figure 1 This is a flowchart illustrating a log collection method according to an exemplary embodiment;
[0074] Figure 2 This is a schematic diagram illustrating an acquisition of indication information according to an exemplary embodiment;
[0075] Figure 3 This is a flowchart illustrating a log collection method according to an exemplary embodiment;
[0076] Figure 4 This is a flowchart illustrating a log collection method according to an exemplary embodiment;
[0077] Figure 5 This is a schematic diagram illustrating a configuration of preset parameters according to an exemplary embodiment;
[0078] Figure 6 This is a schematic diagram illustrating a configuration of preset parameters according to an exemplary embodiment;
[0079] Figure 7 This is a schematic diagram illustrating the software architecture of an electronic device according to an exemplary embodiment;
[0080] Figure 8 This is a flowchart illustrating a log collection method according to an exemplary embodiment;
[0081] Figure 9 This is a flowchart illustrating a log collection method according to an exemplary embodiment;
[0082] Figure 10 This is a block diagram illustrating a log collection device according to an exemplary embodiment;
[0083] Figure 11 This is a block diagram of an electronic device according to an exemplary embodiment. Detailed Implementation
[0084] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention as detailed in the appended claims.
[0085] Electronic devices may have dozens or even hundreds of sensors mounted on Sensorhub, resulting in an extremely large volume of log data collected. However, when understanding the operational status of a specific sensor, it's unnecessary to examine log data unrelated to that sensor. Removing irrelevant log data from a large volume of data is not only tedious but also requires recompiling the code, which is extremely time-consuming. Therefore, there is an urgent need for a method that can selectively collect log data from one or more sensors.
[0086] This disclosure provides a log collection method that, in response to a target instruction, acquires instruction information. The target instruction instructs the collection of log information from a target sensor, and the instruction information instructs the target sensor to perform the collection. Based on the instruction information, the log information from the target sensor is collected. This method collects only the necessary log information from the target sensor based on the instruction information, eliminating the need to first collect log information from all sensors and then filter out the target sensor's log information. This simplifies the process of acquiring the target sensor's log information, reduces time consumption, and improves the speed of log information collection.
[0087] The method provided in this disclosure is executed by an electronic device, which may be a mobile phone, tablet computer, laptop computer, wearable device, smart home device, vehicle terminal, or other device containing sensor components.
[0088] Figure 1 This is a flowchart illustrating a log collection method according to an exemplary embodiment, performed by an electronic device, see [link to flowchart]. Figure 1 The method includes the following steps:
[0089] Step S101: In response to the target instruction, obtain the indication information; the target instruction is used to instruct the collection of log information from the target sensor, and the indication information is used to instruct the target sensor.
[0090] The target instruction can be generated by the electronic device or input by the user. The target instruction includes indication information, or the indication information can be determined based on the target instruction. The indication information can be in any form, such as numbers, letters, or other formats. Different content of the indication information will indicate different target sensors. For example, if the indication information is a number, a value of 4 indicates the gyroscope, while a value of 16 indicates raising the screen to activate (a virtual sensor).
[0091] Step S102: Based on the indication information, collect the log information of the target sensor.
[0092] Since the instruction information has already indicated the target sensor for which log information needs to be collected, when collecting log information, it is only necessary to collect the log information of the target sensor, and there is no need to collect the log information of other sensors.
[0093] The method provided in this disclosure, in response to an instruction to collect log information of a target sensor, obtains instruction information to indicate the target sensor, and then collects the log information of the target sensor based on the instruction information. This eliminates the need to first collect the log information of all sensors and then filter out the log information of the target sensor from the log information of all sensors, thus simplifying the process of obtaining the log information of the target sensor, reducing time consumption, and improving the speed of log information collection.
[0094] Furthermore, since only the log information of the target sensor needs to be collected, the volume of the collected log information is reduced. Moreover, if the collected log information is uploaded to the corresponding server, the storage capacity of the log information on the server is also reduced.
[0095] In this embodiment of the disclosure, before collecting log information, it is necessary to obtain the target instruction. In some embodiments, the target instruction can be obtained using either of the following two methods:
[0096] Method 1: Obtain user feedback information, including sensor anomaly information, which indicates the sensor malfunctioning in the current electronic device. Based on this sensor anomaly information, generate a target command. That is, when a user notices a sensor malfunction in the electronic device, they can submit feedback to resolve the issue. This feedback includes sensor anomaly information. The electronic device can then determine the malfunctioning sensor based on this information, generate a target command, and subsequently obtain instruction information based on this command. Furthermore, based on this instruction information, the electronic device can collect log information from the target sensor, facilitating analysis and resolution of the sensor malfunction based on the collected log information.
[0097] Optionally, the user feedback interface of the user feedback application can be displayed, user feedback information can be entered in the user feedback interface, and user feedback information can be obtained in response to the detection of user feedback submission.
[0098] See one example. Figure 2 The diagram shown illustrates how to obtain instruction information, and the user is on the user feedback interface. Figure 2 Select the module(a) respectively in (a) Figure 2 Taking sensor selection as an example, select problem type ( Figure 2Taking gyroscope failure as an example, the system calculates the probability of the problem occurring, the time of the problem, and then the user clicks the submit control to generate user feedback information. Based on the gyroscope failure information in the user feedback, the system generates the target command. Afterwards, the user can submit the command through the user feedback interface. Figure 2 b) See the process of collecting log information for gyroscope failure issues, i.e., the user can reproduce the problem so that the electronic device can collect log information of the target sensor (gyroscope) based on the instruction information.
[0099] In one example, when a sensor malfunction occurs, the system property "debug.sensors.diag_log_mask" can be set to the mask corresponding to the sensor malfunction type. For example, if the gyroscope fails, the system property "debug.sensors.diag_log_mask" will be set to 4, the target command will be "adb shell setpropdebug.sensors.diag_log_mask_4", and the indicator message will be 4. If the raise-to-wake screen fails, the system property "debug.sensors.diag_log_mask" will be set to 16, the target command will be "adb shell setpropdebug.sensors.diag_log_mask_16", and the indicator message will be 16.
[0100] Method 2: Responding to the detection of a command input operation, obtain the target command. The command input operation can be an operation performed by a developer or technician after gaining system privileges on the electronic device. For example, the target command could be "adb shell setprop debug.sensors.diag_log_mask 4". In this case, the indicator information is 4, which is the same as the indicator information generated when the user reports a gyroscope failure through the user feedback application in Method 1.
[0101] Of course, target instructions can also be obtained through other means.
[0102] Figure 3 This is a flowchart illustrating a log collection method according to an exemplary embodiment, performed by an electronic device, see [link to flowchart]. Figure 3 The method includes the following steps:
[0103] Step S301: In response to the target instruction, obtain instruction information.
[0104] Step S302: Based on the indication information, collect the log information of the target sensor.
[0105] In some embodiments, the indication information may be the sensor identifier of the target sensor whose log information is to be collected. In this case, after obtaining the indication information, the log information of the target sensor corresponding to the sensor identifier included in the indication information can be collected directly.
[0106] In some embodiments, the indication information is not the sensor identifier of the target sensor whose log information is to be collected. In this case, the sensor identifier corresponding to the indication information can be determined based on a first correspondence, and the log information of the target sensor corresponding to the sensor identifier can be collected. The first correspondence includes the correspondence between the indication information and the sensor identifier. That is, there is a correspondence between the indication information and the sensor identifier; after obtaining the indication information, the target sensor can be determined based on this indication information. For example, if the indication information is 4, and 4 corresponds to a gyroscope identifier in the first correspondence, then the target sensor can be determined to be a gyroscope.
[0107] In some embodiments, the electronic device includes two types of sensors: virtual sensors and physical sensors. Virtual sensors are sensors without actual physical components, while physical sensors are sensors with actual physical components, but virtual sensors rely on physical sensors for implementation. For example, "raise to wake" is a virtual sensor, and the physical sensors associated with "raise to wake" can include gyroscopes, accelerometers, etc. When the target sensor is a physical sensor, collecting its log information is sufficient; when the target sensor is a virtual sensor, it is necessary to collect not only the target sensor's log information but also the log information of the physical sensors associated with it, requiring the execution of subsequent steps S303 and S304.
[0108] Step S303: When the target sensor is a virtual sensor, determine the physical sensor associated with the target sensor.
[0109] In some embodiments, a physical sensor associated with a virtual sensor is determined based on a second correspondence. The second correspondence includes a correspondence between virtual sensors and physical sensors. For example, the second correspondence may include the identifier of the virtual sensor and the identifier of the physical sensor associated with the identifier of the virtual sensor.
[0110] Step S304: Collect log information from physical sensors related to the target sensor.
[0111] In this embodiment of the disclosure, regardless of whether the target sensor is a physical sensor or a virtual sensor, the desired log information can be obtained, and log information from other irrelevant sensors will not be collected. This simplifies the process of obtaining log information from the target sensor, reduces time consumption, and improves the speed of log information collection.
[0112] Figure 4 This is a flowchart illustrating a log collection method according to an exemplary embodiment, performed by an electronic device, see [link to flowchart]. Figure 4 The method includes the following steps:
[0113] Step S401: In response to the target instruction, obtain instruction information.
[0114] Step S402: Based on the instruction information, configure the preset parameters to obtain the configured preset parameters.
[0115] The preset parameters indicate which sensor's log information to collect and which sensor's log information not to collect. The configured preset parameters indicate which sensor's log information to collect and which sensor's log information not to collect.
[0116] In some embodiments, the preset parameters include multiple flag bits, each corresponding to a sensor. The value on the flag bit indicates whether to collect log information from the sensor corresponding to that flag bit. The preset parameters can be defined by technicians during the development process based on the number of sensors in the electronic device. That is, after obtaining the indication information, the electronic device can configure the value of each flag bit in the preset parameters based on the indication information to obtain the configured preset parameters.
[0117] In some embodiments, configuring the value of each flag bit in the preset parameters based on indication information includes: setting the value of the target flag bit in the preset parameters to a first preset value, and setting the values of the other flag bits in the preset parameters (excluding the target flag bit) to second preset values, based on the indication information. Here, the target flag bit is the flag bit corresponding to the target sensor, the first preset value indicates that log information from the sensor corresponding to the flag bit should be collected, and the second preset value indicates that log information from the sensor corresponding to the flag bit should not be collected. For example, the first preset value is 1 and the second preset value is 0; or, the first preset value is 0 and the second preset value is 1.
[0118] Step S403: Based on the configured preset parameters, collect log information from the target sensor.
[0119] During log collection, the system determines which sensor's log information needs to be collected and which sensor's log information does not need to be collected based on the configured preset parameters. In some embodiments, the system determines whether to collect the log information of the sensor corresponding to each flag bit based on the value of each flag bit in the configured preset parameters.
[0120] In some embodiments, when the value of the flag bit is detected as a first preset value, the log information of the sensor corresponding to that flag bit is collected; when the value of the flag bit is detected as a second preset value, the log information of the sensor corresponding to that flag bit is not collected. This achieves the collection of log information from the desired sensors while avoiding the collection of irrelevant log information.
[0121] The method provided in this disclosure achieves the effect of collecting log information from a target sensor without collecting log information from other sensors by configuring the value of each flag bit in the preset parameters. This simplifies the process of obtaining log information from the target sensor, reduces time consumption, improves the speed of log information collection, and reduces the volume of collected log information, thus reducing the storage capacity of the log information.
[0122] In some embodiments, considering the large number of sensors in an electronic device, setting a preset parameter would involve numerous flag bits and a long parameter length, potentially hindering configuration. Furthermore, considering the presence of both virtual and physical sensors in the electronic device, separate preset parameters are defined for each type. Specifically, the preset parameters include a first preset parameter and a second preset parameter. Each flag bit in the first preset parameter corresponds to a virtual sensor, and each flag bit in the second preset parameter corresponds to a physical sensor. The first and second preset parameters are shorter than the standard preset parameter length, making configuration easier.
[0123] In this case, step S402 includes: configuring the values of each flag bit in the first preset parameter and the values of each flag bit in the second preset parameter based on the indication information, to obtain the configured first preset parameter and the configured second preset parameter. Step S403 includes: collecting log information from the target sensor based on the configured first preset parameter and the configured second preset parameter.
[0124] In some embodiments, the first preset parameter further includes a first selection bit, and the second preset parameter further includes a second selection bit. The values on both the first and second selection bits are used to indicate the type of target sensor indicated by the indication information. When the values on the first and second selection bits indicate the same type, they can be the same or different, and the user can configure this as needed. For example, when the target sensor is a physical sensor, the value on the first selection bit is 0, and the value on the second selection bit is 1, or both the first and second selection bits are 1; when the target sensor is a virtual sensor, the value on the first selection bit is 1, and the value on the second selection bit is 0, or both the first and second selection bits are 0.
[0125] Based on the indication information, the values of each flag bit in the first preset parameter and each flag bit in the second preset parameter are configured respectively to obtain the configured first preset parameter and the configured second preset parameter. This includes: configuring the value of the target selection bit based on the indication information; and configuring the value of each flag bit in the first preset parameter and each flag bit in the second preset parameter based on the target sensor type indicated by the value of the target selection bit. The target selection bit includes a first selection bit and / or a second selection bit. That is, the configuration method of the first preset parameter and the second preset parameter differs depending on the type of target sensor.
[0126] Optionally, the values of each flag bit in the first preset parameter and the values of each flag bit in the second preset parameter are set to the second preset value; when the target selection bit indicates that the target sensor is a physical sensor, the value of the first flag bit in the second preset parameter is set to the first preset value; the first flag bit is the flag bit in the second preset parameter corresponding to the target sensor; or, when the target selection bit indicates that the target sensor is a virtual sensor, the values of the second flag bit in the first preset parameter and the values of the third flag bit in the second preset parameter are set to the first preset value; the second flag bit is the flag bit in the first preset parameter corresponding to the target sensor, and the third flag bit is the flag bit in the second preset parameter corresponding to the physical sensor related to the target sensor.
[0127] Before configuring the preset parameters, the values of the flag bits in the preset parameters may be either the first preset value or the second preset value. In order to avoid setting the values of the flag bits corresponding to sensors unrelated to the target sensor to the first preset value and collecting log information from unrelated sensors, the values of each flag bit in the preset parameters can be reset to the second preset value before configuring the preset parameters. In this way, when configuring the values of each flag bit in the preset parameters, it can be ensured that only the values of the flag bits corresponding to the target sensor and sensors related to the target sensor are set to the first preset value.
[0128] Optionally, when the target selection bit indicates that the target sensor is a physical sensor, the value of the first flag bit in the second preset parameter is set to the first preset value, the values of the other flag bits in the second preset parameter (excluding the first flag bit) are set to the second preset value, and the value of each flag bit in the first preset parameter is set to the second preset value. Alternatively, when the target selection bit indicates that the target sensor is a virtual sensor, the value of the second flag bit in the first preset parameter is set to the first preset value, the value of the third flag bit in the second preset parameter is set to the first preset value, the values of the other flag bits in the first preset parameter (excluding the second flag bit) are set to the second preset value, and the values of the other flag bits in the second preset parameter (excluding the third flag bit) are set to the second preset value.
[0129] See one example. Figure 5 The diagram shown illustrates the configuration of preset parameters. Taking the first and second preset parameters as examples, each containing 8 bits, bit 0 is the selection bit and bits 1-7 are flag bits. The first selection bit is used to indicate the type of the target sensor. When the indication information is 4, indicating that the target sensor is a gyroscope, the first preset parameter is configured as 00000000 and the second preset parameter is configured as 00001000. Bit 4 of the second preset parameter corresponds to the gyroscope.
[0130] See one example. Figure 6 The diagram shown illustrates the configuration of preset parameters. Taking the first and second preset parameters as examples, each containing 8 bits, bit 0 is the selection bit, and bits 1-7 are flag bits. The first selection bit is used to indicate the type of the target sensor. When the indication information is 16, indicating that the target sensor is set to screen-on when the screen is raised, the first preset parameter is configured as 10001000. Then, by looking up a table (i.e., finding the correspondence between the virtual sensor and the related physical sensor), the physical sensor (ambient light sensor, gyroscope, accelerometer) related to the target sensor is determined, and the second preset parameter is configured as 00101001. In the second preset parameter, bit 2 corresponds to the ambient light sensor, bit 4 corresponds to the gyroscope, and bit 7 corresponds to the accelerometer.
[0131] In some embodiments, to avoid affecting the collection of subsequent log information, after collecting the log information of the target sensor, the value of each flag bit in the preset parameters (first preset parameter and second preset parameter) can be set to the first preset value so that the log information of each sensor can be collected. Optionally, for the first selection bit and the second selection bit, the value on the first selection bit can be set to indicate the value of the virtual sensor, and the value on the second selection bit can be set to indicate the value of the physical sensor. Of course, the first selection bit and the second selection bit can also be left unset, in which case the settings on the selection bits are not considered by default.
[0132] In some embodiments, see Figure 7 The diagram illustrates the software architecture of the electronic device, which includes an Application Processor (AP) and a sensor hub. The AP comprises a system application layer, a framework layer, a native layer, a hardware abstraction layer, and a kernel layer. Each sensor in the electronic device is mounted on the sensor hub. Considering the sensors need to operate in a low-power mode, the sensor hub is configured independently of the application processor. Based on the above software architecture, the log collection method flow is described below. Figure 8 and Figure 9 The example shown.
[0133] Figure 8 This is a flowchart illustrating a log collection method according to an exemplary embodiment, performed by an electronic device, see [link to flowchart]. Figure 8 The method includes the following steps:
[0134] Step S801: In response to the target instruction, obtain instruction information through the application processor.
[0135] Step S802: The application processor sends indication information to the sensor hub using a preset communication method.
[0136] The preset communication methods can be inter-core communication, bus communication, or other methods. Inter-core communication is implemented based on shared memory and can include communication methods such as SMP2P (Symmetric Multiprocessor to Peer Interrupt); bus communication can include communication methods such as IIC (Inter-Integrated Circuit), SPI (Serial Peripheral Interface), and UART (Universal Asynchronous Receiver / Transmitter).
[0137] Step S803: Collect log information of the target sensor based on the indication information through the sensor hub.
[0138] Figure 9 This is a flowchart illustrating a log collection method according to an exemplary embodiment, performed by an electronic device, see [link to flowchart]. Figure 9 The method includes the following steps:
[0139] Step S901: In response to the target instruction, obtain instruction information through the application processor and store the instruction information in a preset storage area.
[0140] The preset storage area can be a storage medium or other storage area.
[0141] Step S902: Read indication information from a preset storage area through a sensor hub, and collect log information of the target sensor based on the indication information.
[0142] The above Figure 8 In the illustrated embodiment, the application processor communicates with the sensor hub to transmit indication information to the sensor hub. Figure 9 In the illustrated embodiment, the application processor stores the indication information in a preset storage area, and the sensor hub reads the indication information from the preset storage area so that the application processor can transmit the indication information to the sensor hub.
[0143] Figure 10 This is a block diagram illustrating a log collection device according to an exemplary embodiment, configured in an electronic device, see [link to relevant documentation]. Figure 10 The device includes:
[0144] The indication information acquisition module 1001 is configured to acquire indication information in response to a target instruction; wherein the target instruction is used to instruct the collection of log information from the target sensor, and the indication information is used to instruct the target sensor.
[0145] The log collection module 1002 is configured to collect log information from the target sensor based on indication information.
[0146] In some embodiments, the apparatus further includes:
[0147] The instruction acquisition module is configured to acquire user feedback information, including sensor anomaly information, which is used to indicate the sensor that is malfunctioning in the current electronic device.
[0148] The instruction acquisition module is also configured to generate target instructions based on sensor anomaly information.
[0149] In some embodiments, the apparatus further includes:
[0150] The instruction acquisition module is configured to acquire the target instruction in response to the detection of an instruction input operation.
[0151] In some embodiments, the log collection module 1002 is configured as follows:
[0152] Based on the first correspondence, the sensor identifier corresponding to the indication information is determined. The first correspondence includes the correspondence between the indication information and the sensor identifier.
[0153] Collect log information of the target sensor corresponding to the sensor identifier.
[0154] In some embodiments, the log collection module 1002 is further configured to:
[0155] When the target sensor is a virtual sensor, determine the physical sensor associated with the target sensor;
[0156] Collect log information from physical sensors related to the target sensor.
[0157] In some embodiments, the log collection module 1002 is configured to:
[0158] Based on the instruction information, preset parameters are configured to obtain the configured preset parameters; the configured preset parameters are used to indicate that log information of the target sensor is collected, and log information of other sensors besides the target sensor is not collected.
[0159] Based on the configured preset parameters, log information from the target sensor is collected.
[0160] In some embodiments, the preset parameters include multiple flag bits, each flag bit corresponding to a sensor, and the value on the flag bit is used to indicate whether to collect log information from the sensor corresponding to the flag bit; the log collection module 1002 is configured to:
[0161] Based on the indication information, the value of each flag bit in the preset parameters is configured to obtain the configured preset parameters.
[0162] In some embodiments, the log collection module 1002 is configured to:
[0163] Based on the instruction information, the value of the target flag bit in the preset parameters is set to the first preset value, and the values of the other flag bits in the preset parameters other than the target flag bit are set to the second preset value;
[0164] Among them, the target flag bit is the flag bit corresponding to the target sensor. The value on the flag bit is a first preset value used to indicate that the log information of the sensor corresponding to the flag bit is collected, and the value on the flag bit is a second preset value used to indicate that the log information of the sensor corresponding to the flag bit is not collected.
[0165] In some embodiments, the instruction information acquisition module 1001 is configured to acquire instruction information through an application processor in response to a target instruction;
[0166] The log collection module 1002 is configured to collect log information of the target sensor based on indication information via the sensor hub.
[0167] In some embodiments, the apparatus further includes:
[0168] The indication information sending module is configured to send indication information to the sensor hub via the application processor using a preset communication method.
[0169] In some embodiments, the apparatus further includes:
[0170] The storage module is configured to store instruction information into a preset storage area via the application processor;
[0171] The reading module is configured to read indication information from a preset storage area via a sensor hub.
[0172] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0173] This disclosure also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the log collection method described in the above embodiments.
[0174] Figure 11 This is a block diagram of an electronic device 1100 according to an exemplary embodiment.
[0175] Reference Figure 11 The electronic device 1100 may include one or more of the following components: a processing component 1102, a memory 1104, a power supply component 1106, a multimedia component 1108, an audio component 1110, an input / output (I / O) interface 1112, a sensor component 1114, and a communication component 1116.
[0176] Processing component 1102 typically controls the overall operation of electronic device 1100, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 1102 may include one or more processors 1120 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 1102 may include one or more modules to facilitate interaction between processing component 1102 and other components. For example, processing component 1102 may include a multimedia module to facilitate interaction between multimedia component 1108 and processing component 1102.
[0177] Memory 1104 is configured to store various types of data to support the operation of electronic device 1100. Examples of such data include instructions for any application or method operating on electronic device 1100, contact data, phonebook data, messages, pictures, videos, etc. Memory 1104 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0178] Power supply component 1106 provides power to various components of electronic device 1100. Power supply component 1106 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 1100.
[0179] Multimedia component 1108 includes a screen that provides an output interface between the electronic device 1100 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 1108 includes a front-facing camera and / or a rear-facing camera. When the electronic device 1100 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0180] Audio component 1110 is configured to output and / or input audio signals. For example, audio component 1110 includes a microphone (MIC) configured to receive external audio signals when electronic device 1100 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1104 or transmitted via communication component 1116. In some embodiments, audio component 1110 also includes a speaker for outputting audio signals.
[0181] I / O interface 1112 provides an interface between processing component 1102 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0182] Sensor assembly 1114 includes one or more sensors for providing state assessments of various aspects of electronic device 1100. For example, sensor assembly 1114 may detect the on / off state of electronic device 1100, the relative positioning of components such as the display and keypad of electronic device 1100, changes in position of electronic device 1100 or a component of electronic device 1100, the presence or absence of user contact with electronic device 1100, the orientation or acceleration / deceleration of electronic device 1100, and temperature changes of electronic device 1100. Sensor assembly 1114 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 1114 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 1114 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0183] Communication component 1116 is configured to facilitate wired or wireless communication between electronic device 1100 and other devices. Electronic device 1100 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 1116 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 1116 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0184] In an exemplary embodiment, the electronic device 1100 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0185] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1104 including instructions, which can be executed by a processor 1120 of an electronic device 1100 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0186] This disclosure also provides a non-transitory computer-readable storage medium, wherein when the instructions in the storage medium are executed by the processor of an electronic device, the electronic device is able to perform the log collection method described in the above embodiments.
[0187] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.
[0188] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A log collection method, characterized in that, The method includes: In response to a target instruction, indication information is acquired; wherein the target instruction is used to instruct the collection of log information from a target sensor, and the indication information is used to instruct the target sensor; Based on the indicated information, log information of the target sensor is collected.
2. The log collection method according to claim 1, characterized in that, The method further includes: Obtain user feedback information, which includes sensor anomaly information, used to indicate a sensor malfunction in the current electronic device; The target instruction is generated based on the sensor anomaly information.
3. The log collection method according to claim 1, characterized in that, The method further includes: In response to the detection of an instruction input operation, the target instruction is obtained.
4. The log collection method according to claim 1, characterized in that, The step of collecting log information from the target sensor based on the indication information includes: Based on the first correspondence, the sensor identifier corresponding to the indication information is determined, wherein the first correspondence includes the correspondence between the indication information and the sensor identifier; Collect log information of the target sensor corresponding to the sensor identifier.
5. The log collection method according to claim 1 or 4, characterized in that, The method further includes: When the target sensor is a virtual sensor, determine the physical sensor associated with the target sensor; Collect log information from physical sensors associated with the target sensor.
6. The log collection method according to claim 1, characterized in that, The step of collecting log information from the target sensor based on the indication information includes: Based on the indication information, preset parameters are configured to obtain the configured preset parameters; the configured preset parameters are used to indicate that log information of the target sensor is collected, and log information of other sensors besides the target sensor is not collected. Based on the preset parameters configured, the log information of the target sensor is collected.
7. The log collection method according to claim 6, characterized in that, The preset parameters include multiple flag bits, each flag bit corresponding to a sensor. The value on the flag bit is used to indicate whether to collect the log information of the sensor corresponding to the flag bit. The step of configuring preset parameters based on the indication information to obtain the configured preset parameters includes: Based on the indicated information, the value of each flag bit in the preset parameters is configured to obtain the configured preset parameters.
8. The log collection method according to claim 7, characterized in that, The step of configuring the value of each flag bit in the preset parameters based on the indication information includes: Based on the indication information, the value of the target flag bit in the preset parameters is set to a first preset value, and the values of the other flag bits in the preset parameters other than the target flag bit are set to a second preset value; Wherein, the target flag bit is the flag bit corresponding to the target sensor, the value on the flag bit is a first preset value used to indicate that the log information of the sensor corresponding to the flag bit is collected, and the value on the flag bit is a second preset value used to indicate that the log information of the sensor corresponding to the flag bit is not collected.
9. The log collection method according to claim 1, characterized in that, The step of responding to a target instruction and obtaining instruction information includes: In response to the target instruction, the indication information is obtained through the application processor; The step of collecting log information from the target sensor based on the indication information includes: Based on the indicated information, the sensor hub collects log information from the target sensor.
10. The log collection method according to claim 9, characterized in that, The method further includes: The application processor sends the indication information to the sensor hub using a preset communication method.
11. The log collection method according to claim 9, characterized in that, The method further includes: The application processor stores the instruction information into a preset storage area; The indication information is read from the preset storage area via the sensor hub.
12. A log collection device, characterized in that, The device includes: The indication information acquisition module is configured to acquire indication information in response to a target instruction; wherein the target instruction is used to instruct the collection of log information from a target sensor, and the indication information is used to instruct the target sensor. The log collection module is configured to collect log information from the target sensor based on the indication information.
13. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to perform the log collection method as described in any one of claims 1-11.
14. A non-transitory computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the log collection method as described in any one of claims 1-11.