harmony 鸿蒙Thermal Log Customization

  • 2023-06-24
  • 浏览 (627)

Thermal Log Customization

Overview

Introduction

By default, the OpenHarmony provides the thermal log feature. Thermal logs record the temperature of device components during usage. However, the content and path of thermal logs vary according to product specifications. To address this issue, OpenHarmony provides the thermal log customization function.

Constraints

The configuration path for battery level customization is subject to the configuration policy. In this development guide, /vendor is used as an example of the configuration path. During actual development, you need to modify the customization path based on the product configuration policy.

How to Develop

Setting Up the Environment

Hardware requirements:

Development board running the standard system, for example, the DAYU200 or Hi3516D V300 open source suite.

Environment requirements:

For details about the requirements on the Linux environment, see Quick Start.

Getting Started with Development

The following uses DAYU200 as an example to illustrate thermal log customization.

  1. Create the thermal folder in the product directory /vendor/hihope/rk3568.

  2. Create a target folder by referring to the default thermal log configuration folder, and install it in //vendor/hihope/rk3568/thermal. The content is as follows:

    profile
    ├── BUILD.gn
    ├── thermal_hdi_config.xml
    
  3. Create a target folder by referring to the default thermal log parameter configuration folder and install it in //vendor/hihope/rk3568/thermal. The file format is as follows:

    etc
    ├── BUILD.gn
    ├── thermal.para
    ├── thermal.para.dac
    
  4. Write the custom thermal_hdi_config.xml file by referring to the thermal_hdi_config.xml file in the default thermal log configuration folder. The following tables describe the related configuration items.

    Table 1 Description of the tracing configuration

|Configuration Item|Description|Data Type|Value Range| |——–|——–|——–|——–| |interval|Interval for recording temperature tracing logs, in ms.|int|>0| |width|Width of the temperature tracing log, in characters.|int|>0| |outpath|Path for storing temperature tracing logs.|string|N/A|

**Table 2** Description of the node configuration

|Node|Configuration Item|Description| |——–|——–|——–| |title|path|Path for obtaining the thermal zone name.| |title|name|Thermal zone name.| |value|path|Path for obtaining the thermal zone temperature.|

```shell
<tracing interval="5000" width="20" outpath="/data/log/thermal-log">
    <node>
        <title path="sys/class/thermal/thermal_zone0/type"/>
        <value path="sys/class/thermal/thermal_zone0/temp"/>
    </node>
    <node>
        <title name="gpu-thermal"/>   
        <value path="sys/class/thermal/thermal_zone1/temp"/>
    </node>
</tracing>
```
  1. Write the custom thermal.para and thermal.para.dac files by referring to the thermal.para and thermal.para.dac files in the default hot log parameter configuration folder. The custom configuration is as follows:

    thermal.para:

    persist.thermal.log.enable=true     # Enable the thermal log function.
    persist.thermal.log.interval=5000   # Set the interval for recording temperature tracing logs, in ms.
    persist.thermal.log.width=20        # Set the width of the temperature tracing log, in characters.
    

    thermal.para.dac:

    persist.thermal.log.="power_host:power_host:600" # Configure access permissions.
    
  2. Write the BUILD.gn file by referring to the BUILD.gn file in the default thermal log configuration folder to pack the thermal_hdi_config.xml file to the //vendor/etc/thermal_config/hdf directory. The configuration is as follows:

    import("//build/ohos.gni")
    
    
    ohos_prebuilt_etc("thermal_hdf_config") {
        source = "thermal_hdi_config.xml"
        relative_install_dir = "thermal_config/hdf"
        install_images = [ chipset_base_dir ]       # Required configuration for installing the thermal_hdi_config.xml file in the vendor directory.
        part_name = "product_rk3568"                # Set part_name to product_rk3568 for subsequent build. You can change it as required.
    }
    
  3. Write the BUILD.gn file by referring to the BUILD.gn file in the default thermal log parameter configuration folder to pack the thermal.para and thermal.para.dac files to the //vendor/etc/param/thermal.para directory. The configuration is as follows:

    import("//build/ohos.gni")
    
    ## Install thermal.para to /vendor/etc/param/thermal.para
    
    
    ohos_prebuilt_etc("thermal.para") {
        source = "thermal.para"
        relative_install_dir = "param"
        install_images = [ chipset_base_dir ]
        part_name = "product_rk3568"
    }
    
    
    ohos_prebuilt_etc("thermal.para.dac") {
        source = "thermal.para.dac"
        relative_install_dir = "param"
        install_images = [ chipset_base_dir ]
        part_name = "product_rk3568"
    }
    
    
    group("param_files") {
        deps = [
            ":thermal.para",
            ":thermal.para.dac",
        ]
    }
    
  4. Add the build target to module_list in ohos.build in the /vendor/hihope/rk3568 directory. For example:

    {
        "parts": {
            "product_rk3568": {
                "module_list": [
                    "//vendor/hihope/rk3568/default_app_config:default_app_config",
                    "//vendor/hihope/rk3568/image_conf:custom_image_conf",
                    "//vendor/hihope/rk3568/preinstall-config:preinstall-config",
                    "//vendor/hihope/rk3568/resourceschedule:resourceschedule",
                    "//vendor/hihope/rk3568/etc:product_etc_conf",
                    "//vendor/hihope/rk3568/thermal/profile:thermal_hdf_config",  // Add the configuration for building of thermal_hdf_config.
                    "//vendor/hihope/rk3568/thermal/etc:param_files"              // Add the configuration for building of thermal.para and thermal.para.dac.
                ]
            }
        },
        "subsystem": "product_hihope"
    }
    

    In the preceding code, //vendor/hihope/rk3568/thermal/ is the folder path, profile and etc are folder names, and thermal_hdf_config and param_files are the build targets.

  5. Build the customized version by referring to Quick Start.

    ./build.sh --product-name rk3568 --ccache
    
  6. Burn the customized version to the DAYU200 development board.

Debugging and Verification

  1. After startup, run the following command to launch the shell command line:

    hdc shell
    
  2. Go to the customized directory.

    cd /data/log/thermal/
    

    View thermal logs.

    cat thermal.000.20170805-175756
    

    The following is the reference thermal log after customization:

    timestamp                    soc-thermal         gpu-thermal
    2017-08-05 17:57:56          37777               37222
    2017-08-05 17:58:01          38333               37777
    2017-08-05 17:58:06          36666               37222
    2017-08-05 17:58:11          36666               37222
    2017-08-05 17:58:16          36666               37222
    2017-08-05 17:58:21          36111               37222
    2017-08-05 17:58:26          36111               37222
    2017-08-05 17:58:31          36666               37222
    2017-08-05 17:58:36          36111               37222
    2017-08-05 17:58:41          36111               37222
    2017-08-05 17:58:46          36666               36666
    

Reference

During development, you can refer to the default thermal log configuration and default thermal log parameter configuration.

Packing path: /vendor/etc/thermal_config/hdf

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Subsystems

harmony 鸿蒙AI Framework Development Guide

harmony 鸿蒙NNRt Access Adaptation

harmony 鸿蒙Application Privilege Configuration

harmony 鸿蒙Development Example

harmony 鸿蒙Setting Up a Development Environment

harmony 鸿蒙Development Guidelines

harmony 鸿蒙Application Framework Overview

harmony 鸿蒙ArkCompiler Development

harmony 鸿蒙Custom Window Title Bar Development

0  赞